SlideShare ist ein Scribd-Unternehmen logo
1 von 23
Define y gobierna tus APIs
Kafka y python
17/05/2016
Python Madrid · Python y Kafka
Kafka y python
Kafka y Python
Python Madrid · Python y Kafka
¿Quién soy?
Ingeniero de Software
@Paradigma Digital
@lvaroleon
aleonsan
Kafka y Python
Python Madrid · Python y Kafka
Kafka  Origen
Kafka y Python
Python Madrid · Python y Kafka
Kafka  ¿Qué es?
“
”
If you think of Hadoop as long-term
memory, the question then is how you
get the memories in there to begin with
Apache Kafka is like the central nervous
system, which collects all of these
messages from the underlying systems
and transmits them into the memory
vault, or storage.
- Eric Vishria
Kafka y Python
Python Madrid · Python y Kafka
Kafka  Motivation
To be able to act as a unified
platform for handling all the
real-time data feeds a large
company might have.
…
…
…
…
…
…
Event
Tracking
Application
Logs
Application
Messages
Application
Monitoring
data
Kafka y Python
Python Madrid · Python y Kafka
Kafka  How to ?
● Distributed, the essence
● Scalable
● Efficient
● Durable, fault tolerance
Kafka y Python
Python Madrid · Python y Kafka
Kafka  Básicos
P PP
C C C C
…
…
…
Kafka Cluster
● Producers
● Brokers
● Consumers
Kafka y Python
Python Madrid · Python y Kafka
Kafka  Cluster: Topics & Partitions
Kafka Cluster ● Topics
● Partitions
● Message
1 2 3 4 5
1 2 3 4
1 2 3
1 2 3
T1P0
T1P1
T2P0
T2P1
Kafka y Python
Python Madrid · Python y Kafka
Kafka  Partitions & Replication
Kafka Cluster ● Replication factor
○ Leader
○ Followers
● ISR
○ In-sync policies
1 2 3 4 5
Broker1Broker2
1 2 3 4 5
PM
PM
Kafka y Python
Python Madrid · Python y Kafka
Kafka  Producers
● Publish Messages
● Choose partitions
○ policies
● Producer configuration
○ ACKs
○ Retries
○ Batch size
○ ...
Kafka y Python
Python Madrid · Python y Kafka
Kafka  Consumers
● “Subscribe” to a feed
● Consumer groups Kafka Cluster
Partition 0
Broker1Broker2
Partition 1
○ Queue
○ Publish-subscribe
C
C
C
● Order
guarantees
C
C
Kafka y Python
Python Madrid · Python y Kafka
Kafka  Efficiency
● Small I/O problem
○ Message sets
● Message set compression
○ policies
● Standard binary message format
○ Transfer without modifications
Kafka y Python
Python Madrid · Python y Kafka
Kafka  Python Clients
● Kafka-python
○ 0.8+, recomendada 0.9
○ Python 3.6+
○ Python 3.3+
https://github.com/dpkp/kafka-python
● Pykafka
○ 0.8.2+
○ Python 2.7+
○ Python 3.4+
https://github.com/Parsely/pykafka
Kafka y Python
Python Madrid · Python y Kafka
Kafka  Python Clients  Kafka-python
● Producer
class kafka.KafkaProducer:
def __init__(self, **configs)
def send(self, topic, value=None, key=None, partition=None)
● class RecordAccumulator:
● class Partitioner:
def flush(self, timeout=None)
Kafka y Python
Python Madrid · Python y Kafka
Kafka  Python Clients  Kafka-python
● Consumer
○ message iterator
class kafka.KafkaConsumer(six.Iterator):
def __init__(self, *topics, **configs)
def __next__(self)
def subscribe(self, topics=(), pattern=None, listener=None)
def unsubscribe(self)
def assign(self, partitions)
def seek(self, partition, offset)
def commit(self, offsets=None)
Kafka y Python
Python Madrid · Python y Kafka
Kafka  Python Clients  Kafka-python
● Cluster
○ client manages some cluster metadata
class kafka.ClusterMetadata:
def __init__(self, **configs)
def available_partitions_for_topic(self, topic)
def leader_for_partition(self, partition)
def partitions_for_broker(self, broker_id)
…
def update_metadata(self, metadata)
● ConsumerCoordinator
Kafka y Python
Python Madrid · Python y Kafka
Kafka  Python Clients  pyKafka
● Producer
class pykafka.Producer:
def __init__(self, . . . )
def produce(self, message, partition_key=None)
● Consumer
class pykafka.SimpleConsumer:
def __init__(self, . . .)
def consume(self, block=True)
Kafka y Python
Python Madrid · Python y Kafka
Kafka  Python Clients  Kafka-python
● Ejemplo
client = pykafka.KafkaClient(. . .)
topic = client.topics[0]
producer = topic.get_sync_producer()
. . .
consumer = topic.get_simple_consumer()
for message in consumer:
Kafka y Python
Python Madrid · Python y Kafka
Kafka  Python Clients  Demo
Demo Time
Kafka y Python
Python Madrid · Python y Kafka
Kafka y Python  Thanks
for your attention
Thank you
Kafka y Python
Python Madrid · Python y Kafka
Kafka y Python  Questions
¿ ?
Kafka y Python
Python Madrid · Python y Kafka
Kafka  El Clúster

Weitere ähnliche Inhalte

Was ist angesagt?

Was ist angesagt? (20)

meetPHP#8 - PHP startups prototypes
meetPHP#8 - PHP startups prototypesmeetPHP#8 - PHP startups prototypes
meetPHP#8 - PHP startups prototypes
 
Using Grails to power your electric car
Using Grails to power your electric carUsing Grails to power your electric car
Using Grails to power your electric car
 
Rust Primer
Rust PrimerRust Primer
Rust Primer
 
Rust's Journey to Async/await
Rust's Journey to Async/awaitRust's Journey to Async/await
Rust's Journey to Async/await
 
Kafka Summit NYC 2017 - Introducing Exactly Once Semantics in Apache Kafka
Kafka Summit NYC 2017 - Introducing Exactly Once Semantics in Apache KafkaKafka Summit NYC 2017 - Introducing Exactly Once Semantics in Apache Kafka
Kafka Summit NYC 2017 - Introducing Exactly Once Semantics in Apache Kafka
 
Low latency in java 8 by Peter Lawrey
Low latency in java 8 by Peter Lawrey Low latency in java 8 by Peter Lawrey
Low latency in java 8 by Peter Lawrey
 
Jdd2014: High performance logging - Peter Lawrey
Jdd2014: High performance logging - Peter LawreyJdd2014: High performance logging - Peter Lawrey
Jdd2014: High performance logging - Peter Lawrey
 
A Quick Intro to ReactiveX
A Quick Intro to ReactiveXA Quick Intro to ReactiveX
A Quick Intro to ReactiveX
 
Producer Performance Tuning for Apache Kafka
Producer Performance Tuning for Apache KafkaProducer Performance Tuning for Apache Kafka
Producer Performance Tuning for Apache Kafka
 
Xanadu - Java Chapter Meeting
Xanadu - Java Chapter Meeting Xanadu - Java Chapter Meeting
Xanadu - Java Chapter Meeting
 
Thanos: Global, durable Prometheus monitoring
Thanos: Global, durable Prometheus monitoringThanos: Global, durable Prometheus monitoring
Thanos: Global, durable Prometheus monitoring
 
S3, Cassandra or Outer Space? Dumping Time Series Data using Spark - Demi Ben...
S3, Cassandra or Outer Space? Dumping Time Series Data using Spark - Demi Ben...S3, Cassandra or Outer Space? Dumping Time Series Data using Spark - Demi Ben...
S3, Cassandra or Outer Space? Dumping Time Series Data using Spark - Demi Ben...
 
Microservices with Micronaut
Microservices with MicronautMicroservices with Micronaut
Microservices with Micronaut
 
LOGBack and SLF4J
LOGBack and SLF4JLOGBack and SLF4J
LOGBack and SLF4J
 
Monitoring with Prometheus
Monitoring with PrometheusMonitoring with Prometheus
Monitoring with Prometheus
 
Keeping Latency Low and Throughput High with Application-level Priority Manag...
Keeping Latency Low and Throughput High with Application-level Priority Manag...Keeping Latency Low and Throughput High with Application-level Priority Manag...
Keeping Latency Low and Throughput High with Application-level Priority Manag...
 
Tale of Kafka Consumer for Spark Streaming
Tale of Kafka Consumer for Spark StreamingTale of Kafka Consumer for Spark Streaming
Tale of Kafka Consumer for Spark Streaming
 
SignalFx Kafka Consumer Optimization
SignalFx Kafka Consumer OptimizationSignalFx Kafka Consumer Optimization
SignalFx Kafka Consumer Optimization
 
TorqueBox at GNUnify 2012
TorqueBox at GNUnify 2012TorqueBox at GNUnify 2012
TorqueBox at GNUnify 2012
 
LCE13: Test and Validation Summit: Evolution of Testing in Linaro (I)
LCE13: Test and Validation Summit: Evolution of Testing in Linaro (I)LCE13: Test and Validation Summit: Evolution of Testing in Linaro (I)
LCE13: Test and Validation Summit: Evolution of Testing in Linaro (I)
 

Andere mochten auch

Andere mochten auch (18)

Cómo usar google analytics
Cómo usar google analyticsCómo usar google analytics
Cómo usar google analytics
 
Overview atlas (1)
Overview atlas (1)Overview atlas (1)
Overview atlas (1)
 
Transformación Digital
Transformación DigitalTransformación Digital
Transformación Digital
 
Python y Flink
Python y FlinkPython y Flink
Python y Flink
 
¿Cómo se despliega y autoescala Couchbase en Cloud? ¡Aprende de manera práctica!
¿Cómo se despliega y autoescala Couchbase en Cloud? ¡Aprende de manera práctica!¿Cómo se despliega y autoescala Couchbase en Cloud? ¡Aprende de manera práctica!
¿Cómo se despliega y autoescala Couchbase en Cloud? ¡Aprende de manera práctica!
 
Cultura Digital Paradigma
Cultura Digital ParadigmaCultura Digital Paradigma
Cultura Digital Paradigma
 
ECMAScript 6
ECMAScript 6ECMAScript 6
ECMAScript 6
 
Analysis of Websites as Graphs for SEO
Analysis of Websites as Graphs for SEOAnalysis of Websites as Graphs for SEO
Analysis of Websites as Graphs for SEO
 
Use Groovy&Grails in your spring boot projects
Use Groovy&Grails in your spring boot projectsUse Groovy&Grails in your spring boot projects
Use Groovy&Grails in your spring boot projects
 
Manuel Hurtado. Couchbase paradigma4oct
Manuel Hurtado. Couchbase paradigma4octManuel Hurtado. Couchbase paradigma4oct
Manuel Hurtado. Couchbase paradigma4oct
 
Programación Reactiva con RxJava
Programación Reactiva con RxJavaProgramación Reactiva con RxJava
Programación Reactiva con RxJava
 
Google Analytics for Developers
Google Analytics for DevelopersGoogle Analytics for Developers
Google Analytics for Developers
 
¿Cómo vencer a los dragones digitales?
¿Cómo vencer a los dragones digitales?¿Cómo vencer a los dragones digitales?
¿Cómo vencer a los dragones digitales?
 
Introducción a Kubernetes
Introducción a KubernetesIntroducción a Kubernetes
Introducción a Kubernetes
 
HTML5 Web Components
HTML5 Web ComponentsHTML5 Web Components
HTML5 Web Components
 
Introducción a Django
Introducción a DjangoIntroducción a Django
Introducción a Django
 
Jeff Dean at AI Frontiers: Trends and Developments in Deep Learning Research
Jeff Dean at AI Frontiers: Trends and Developments in Deep Learning ResearchJeff Dean at AI Frontiers: Trends and Developments in Deep Learning Research
Jeff Dean at AI Frontiers: Trends and Developments in Deep Learning Research
 
Alex Smola at AI Frontiers: Scalable Deep Learning Using MXNet
Alex Smola at AI Frontiers: Scalable Deep Learning Using MXNetAlex Smola at AI Frontiers: Scalable Deep Learning Using MXNet
Alex Smola at AI Frontiers: Scalable Deep Learning Using MXNet
 

Ähnlich wie Kafka y python

ApacheCon2022_Deep Dive into Building Streaming Applications with Apache Pulsar
ApacheCon2022_Deep Dive into Building Streaming Applications with Apache PulsarApacheCon2022_Deep Dive into Building Streaming Applications with Apache Pulsar
ApacheCon2022_Deep Dive into Building Streaming Applications with Apache Pulsar
Timothy Spann
 
Scylla Summit 2022: Learning Rust the Hard Way for a Production Kafka+ScyllaD...
Scylla Summit 2022: Learning Rust the Hard Way for a Production Kafka+ScyllaD...Scylla Summit 2022: Learning Rust the Hard Way for a Production Kafka+ScyllaD...
Scylla Summit 2022: Learning Rust the Hard Way for a Production Kafka+ScyllaD...
ScyllaDB
 
NYC Dec 2022 Meetup_ Building Real-Time Requires a Team
NYC Dec 2022 Meetup_ Building Real-Time Requires a TeamNYC Dec 2022 Meetup_ Building Real-Time Requires a Team
NYC Dec 2022 Meetup_ Building Real-Time Requires a Team
Timothy Spann
 

Ähnlich wie Kafka y python (20)

Introducing Kafka-on-Pulsar: bring native Kafka protocol support to Apache Pu...
Introducing Kafka-on-Pulsar: bring native Kafka protocol support to Apache Pu...Introducing Kafka-on-Pulsar: bring native Kafka protocol support to Apache Pu...
Introducing Kafka-on-Pulsar: bring native Kafka protocol support to Apache Pu...
 
Devfest uk & ireland using apache nifi with apache pulsar for fast data on-r...
Devfest uk & ireland  using apache nifi with apache pulsar for fast data on-r...Devfest uk & ireland  using apache nifi with apache pulsar for fast data on-r...
Devfest uk & ireland using apache nifi with apache pulsar for fast data on-r...
 
Build real time stream processing applications using Apache Kafka
Build real time stream processing applications using Apache KafkaBuild real time stream processing applications using Apache Kafka
Build real time stream processing applications using Apache Kafka
 
[Conf42-KubeNative] Building Real-time Pulsar Apps on K8
[Conf42-KubeNative] Building Real-time Pulsar Apps on K8[Conf42-KubeNative] Building Real-time Pulsar Apps on K8
[Conf42-KubeNative] Building Real-time Pulsar Apps on K8
 
14th Athens Big Data Meetup - Landoop Workshop - Apache Kafka Entering The St...
14th Athens Big Data Meetup - Landoop Workshop - Apache Kafka Entering The St...14th Athens Big Data Meetup - Landoop Workshop - Apache Kafka Entering The St...
14th Athens Big Data Meetup - Landoop Workshop - Apache Kafka Entering The St...
 
Kafka on Pulsar:bringing native Kafka protocol support to Pulsar_Sijie&Pierre
Kafka on Pulsar:bringing native Kafka protocol support to Pulsar_Sijie&PierreKafka on Pulsar:bringing native Kafka protocol support to Pulsar_Sijie&Pierre
Kafka on Pulsar:bringing native Kafka protocol support to Pulsar_Sijie&Pierre
 
Dataframes Showdown (miniConf 2022)
Dataframes Showdown (miniConf 2022)Dataframes Showdown (miniConf 2022)
Dataframes Showdown (miniConf 2022)
 
Structured Streaming with Kafka
Structured Streaming with KafkaStructured Streaming with Kafka
Structured Streaming with Kafka
 
Introduction to Apache Kafka
Introduction to Apache KafkaIntroduction to Apache Kafka
Introduction to Apache Kafka
 
Data Analytics and Machine Learning: From Node to Cluster on ARM64
Data Analytics and Machine Learning: From Node to Cluster on ARM64Data Analytics and Machine Learning: From Node to Cluster on ARM64
Data Analytics and Machine Learning: From Node to Cluster on ARM64
 
BKK16-404B Data Analytics and Machine Learning- from Node to Cluster
BKK16-404B Data Analytics and Machine Learning- from Node to ClusterBKK16-404B Data Analytics and Machine Learning- from Node to Cluster
BKK16-404B Data Analytics and Machine Learning- from Node to Cluster
 
BKK16-408B Data Analytics and Machine Learning From Node to Cluster
BKK16-408B Data Analytics and Machine Learning From Node to ClusterBKK16-408B Data Analytics and Machine Learning From Node to Cluster
BKK16-408B Data Analytics and Machine Learning From Node to Cluster
 
ApacheCon2022_Deep Dive into Building Streaming Applications with Apache Pulsar
ApacheCon2022_Deep Dive into Building Streaming Applications with Apache PulsarApacheCon2022_Deep Dive into Building Streaming Applications with Apache Pulsar
ApacheCon2022_Deep Dive into Building Streaming Applications with Apache Pulsar
 
Scylla Summit 2022: Learning Rust the Hard Way for a Production Kafka+ScyllaD...
Scylla Summit 2022: Learning Rust the Hard Way for a Production Kafka+ScyllaD...Scylla Summit 2022: Learning Rust the Hard Way for a Production Kafka+ScyllaD...
Scylla Summit 2022: Learning Rust the Hard Way for a Production Kafka+ScyllaD...
 
Strimzi - Where Apache Kafka meets OpenShift - OpenShift Spain MeetUp
Strimzi - Where Apache Kafka meets OpenShift - OpenShift Spain MeetUpStrimzi - Where Apache Kafka meets OpenShift - OpenShift Spain MeetUp
Strimzi - Where Apache Kafka meets OpenShift - OpenShift Spain MeetUp
 
Tech Days 2015: AdaCore Roadmap
Tech Days 2015: AdaCore RoadmapTech Days 2015: AdaCore Roadmap
Tech Days 2015: AdaCore Roadmap
 
NYC Dec 2022 Meetup_ Building Real-Time Requires a Team
NYC Dec 2022 Meetup_ Building Real-Time Requires a TeamNYC Dec 2022 Meetup_ Building Real-Time Requires a Team
NYC Dec 2022 Meetup_ Building Real-Time Requires a Team
 
D. Fast, Simple User-Space Network Functions with Snabb (RIPE 77)
D. Fast, Simple User-Space Network Functions with Snabb (RIPE 77)D. Fast, Simple User-Space Network Functions with Snabb (RIPE 77)
D. Fast, Simple User-Space Network Functions with Snabb (RIPE 77)
 
Being Ready for Apache Kafka - Apache: Big Data Europe 2015
Being Ready for Apache Kafka - Apache: Big Data Europe 2015Being Ready for Apache Kafka - Apache: Big Data Europe 2015
Being Ready for Apache Kafka - Apache: Big Data Europe 2015
 
Big mountain data and dev conference apache pulsar with mqtt for edge compu...
Big mountain data and dev conference   apache pulsar with mqtt for edge compu...Big mountain data and dev conference   apache pulsar with mqtt for edge compu...
Big mountain data and dev conference apache pulsar with mqtt for edge compu...
 

Mehr von Paradigma Digital

Mehr von Paradigma Digital (14)

Ddd + ah + microservicios
Ddd + ah + microserviciosDdd + ah + microservicios
Ddd + ah + microservicios
 
Bots 3.0: Dejando atrás los bots conversacionales con Dialogflow.
Bots 3.0: Dejando atrás los bots conversacionales con Dialogflow.Bots 3.0: Dejando atrás los bots conversacionales con Dialogflow.
Bots 3.0: Dejando atrás los bots conversacionales con Dialogflow.
 
Have you met Istio?
Have you met Istio?Have you met Istio?
Have you met Istio?
 
Linkerd a fondo
Linkerd a fondoLinkerd a fondo
Linkerd a fondo
 
Horneando apis
Horneando apisHorneando apis
Horneando apis
 
Java 8 time to join the future
Java 8  time to join the futureJava 8  time to join the future
Java 8 time to join the future
 
Programación Reactiva con Spring WebFlux
Programación Reactiva con Spring WebFluxProgramación Reactiva con Spring WebFlux
Programación Reactiva con Spring WebFlux
 
Orquestando microservicios como lo hace Netflix
Orquestando microservicios como lo hace NetflixOrquestando microservicios como lo hace Netflix
Orquestando microservicios como lo hace Netflix
 
Meetup microservicios: API Management
Meetup microservicios: API ManagementMeetup microservicios: API Management
Meetup microservicios: API Management
 
Meetup de kubernetes, conceptos básicos.
Meetup  de kubernetes, conceptos básicos.Meetup  de kubernetes, conceptos básicos.
Meetup de kubernetes, conceptos básicos.
 
Docker, kubernetes, openshift y openstack, para mi abuela. techfest 2017.pptx
Docker, kubernetes, openshift y openstack, para mi abuela. techfest 2017.pptxDocker, kubernetes, openshift y openstack, para mi abuela. techfest 2017.pptx
Docker, kubernetes, openshift y openstack, para mi abuela. techfest 2017.pptx
 
Implementando microservicios
Implementando microserviciosImplementando microservicios
Implementando microservicios
 
Equipo de Marketing de Paradigma Digital
Equipo de Marketing de Paradigma DigitalEquipo de Marketing de Paradigma Digital
Equipo de Marketing de Paradigma Digital
 
Seminario Apache Solr
Seminario Apache SolrSeminario Apache Solr
Seminario Apache Solr
 

Kürzlich hochgeladen

Top profile Call Girls In Chandrapur [ 7014168258 ] Call Me For Genuine Model...
Top profile Call Girls In Chandrapur [ 7014168258 ] Call Me For Genuine Model...Top profile Call Girls In Chandrapur [ 7014168258 ] Call Me For Genuine Model...
Top profile Call Girls In Chandrapur [ 7014168258 ] Call Me For Genuine Model...
gajnagarg
 
Top profile Call Girls In dimapur [ 7014168258 ] Call Me For Genuine Models W...
Top profile Call Girls In dimapur [ 7014168258 ] Call Me For Genuine Models W...Top profile Call Girls In dimapur [ 7014168258 ] Call Me For Genuine Models W...
Top profile Call Girls In dimapur [ 7014168258 ] Call Me For Genuine Models W...
gajnagarg
 
Top profile Call Girls In Begusarai [ 7014168258 ] Call Me For Genuine Models...
Top profile Call Girls In Begusarai [ 7014168258 ] Call Me For Genuine Models...Top profile Call Girls In Begusarai [ 7014168258 ] Call Me For Genuine Models...
Top profile Call Girls In Begusarai [ 7014168258 ] Call Me For Genuine Models...
nirzagarg
 
Top profile Call Girls In Purnia [ 7014168258 ] Call Me For Genuine Models We...
Top profile Call Girls In Purnia [ 7014168258 ] Call Me For Genuine Models We...Top profile Call Girls In Purnia [ 7014168258 ] Call Me For Genuine Models We...
Top profile Call Girls In Purnia [ 7014168258 ] Call Me For Genuine Models We...
nirzagarg
 
Reconciling Conflicting Data Curation Actions: Transparency Through Argument...
Reconciling Conflicting Data Curation Actions:  Transparency Through Argument...Reconciling Conflicting Data Curation Actions:  Transparency Through Argument...
Reconciling Conflicting Data Curation Actions: Transparency Through Argument...
Bertram Ludäscher
 
Top profile Call Girls In Tumkur [ 7014168258 ] Call Me For Genuine Models We...
Top profile Call Girls In Tumkur [ 7014168258 ] Call Me For Genuine Models We...Top profile Call Girls In Tumkur [ 7014168258 ] Call Me For Genuine Models We...
Top profile Call Girls In Tumkur [ 7014168258 ] Call Me For Genuine Models We...
nirzagarg
 
Top profile Call Girls In Bihar Sharif [ 7014168258 ] Call Me For Genuine Mod...
Top profile Call Girls In Bihar Sharif [ 7014168258 ] Call Me For Genuine Mod...Top profile Call Girls In Bihar Sharif [ 7014168258 ] Call Me For Genuine Mod...
Top profile Call Girls In Bihar Sharif [ 7014168258 ] Call Me For Genuine Mod...
nirzagarg
 
In Riyadh ((+919101817206)) Cytotec kit @ Abortion Pills Saudi Arabia
In Riyadh ((+919101817206)) Cytotec kit @ Abortion Pills Saudi ArabiaIn Riyadh ((+919101817206)) Cytotec kit @ Abortion Pills Saudi Arabia
In Riyadh ((+919101817206)) Cytotec kit @ Abortion Pills Saudi Arabia
ahmedjiabur940
 
Top profile Call Girls In Indore [ 7014168258 ] Call Me For Genuine Models We...
Top profile Call Girls In Indore [ 7014168258 ] Call Me For Genuine Models We...Top profile Call Girls In Indore [ 7014168258 ] Call Me For Genuine Models We...
Top profile Call Girls In Indore [ 7014168258 ] Call Me For Genuine Models We...
gajnagarg
 
怎样办理圣地亚哥州立大学毕业证(SDSU毕业证书)成绩单学校原版复制
怎样办理圣地亚哥州立大学毕业证(SDSU毕业证书)成绩单学校原版复制怎样办理圣地亚哥州立大学毕业证(SDSU毕业证书)成绩单学校原版复制
怎样办理圣地亚哥州立大学毕业证(SDSU毕业证书)成绩单学校原版复制
vexqp
 

Kürzlich hochgeladen (20)

Top profile Call Girls In Chandrapur [ 7014168258 ] Call Me For Genuine Model...
Top profile Call Girls In Chandrapur [ 7014168258 ] Call Me For Genuine Model...Top profile Call Girls In Chandrapur [ 7014168258 ] Call Me For Genuine Model...
Top profile Call Girls In Chandrapur [ 7014168258 ] Call Me For Genuine Model...
 
Top Call Girls in Balaghat 9332606886Call Girls Advance Cash On Delivery Ser...
Top Call Girls in Balaghat  9332606886Call Girls Advance Cash On Delivery Ser...Top Call Girls in Balaghat  9332606886Call Girls Advance Cash On Delivery Ser...
Top Call Girls in Balaghat 9332606886Call Girls Advance Cash On Delivery Ser...
 
Top profile Call Girls In dimapur [ 7014168258 ] Call Me For Genuine Models W...
Top profile Call Girls In dimapur [ 7014168258 ] Call Me For Genuine Models W...Top profile Call Girls In dimapur [ 7014168258 ] Call Me For Genuine Models W...
Top profile Call Girls In dimapur [ 7014168258 ] Call Me For Genuine Models W...
 
Predicting HDB Resale Prices - Conducting Linear Regression Analysis With Orange
Predicting HDB Resale Prices - Conducting Linear Regression Analysis With OrangePredicting HDB Resale Prices - Conducting Linear Regression Analysis With Orange
Predicting HDB Resale Prices - Conducting Linear Regression Analysis With Orange
 
Statistics notes ,it includes mean to index numbers
Statistics notes ,it includes mean to index numbersStatistics notes ,it includes mean to index numbers
Statistics notes ,it includes mean to index numbers
 
DATA SUMMIT 24 Building Real-Time Pipelines With FLaNK
DATA SUMMIT 24  Building Real-Time Pipelines With FLaNKDATA SUMMIT 24  Building Real-Time Pipelines With FLaNK
DATA SUMMIT 24 Building Real-Time Pipelines With FLaNK
 
Top profile Call Girls In Begusarai [ 7014168258 ] Call Me For Genuine Models...
Top profile Call Girls In Begusarai [ 7014168258 ] Call Me For Genuine Models...Top profile Call Girls In Begusarai [ 7014168258 ] Call Me For Genuine Models...
Top profile Call Girls In Begusarai [ 7014168258 ] Call Me For Genuine Models...
 
TrafficWave Generator Will Instantly drive targeted and engaging traffic back...
TrafficWave Generator Will Instantly drive targeted and engaging traffic back...TrafficWave Generator Will Instantly drive targeted and engaging traffic back...
TrafficWave Generator Will Instantly drive targeted and engaging traffic back...
 
Gulbai Tekra * Cheap Call Girls In Ahmedabad Phone No 8005736733 Elite Escort...
Gulbai Tekra * Cheap Call Girls In Ahmedabad Phone No 8005736733 Elite Escort...Gulbai Tekra * Cheap Call Girls In Ahmedabad Phone No 8005736733 Elite Escort...
Gulbai Tekra * Cheap Call Girls In Ahmedabad Phone No 8005736733 Elite Escort...
 
Top profile Call Girls In Purnia [ 7014168258 ] Call Me For Genuine Models We...
Top profile Call Girls In Purnia [ 7014168258 ] Call Me For Genuine Models We...Top profile Call Girls In Purnia [ 7014168258 ] Call Me For Genuine Models We...
Top profile Call Girls In Purnia [ 7014168258 ] Call Me For Genuine Models We...
 
7. Epi of Chronic respiratory diseases.ppt
7. Epi of Chronic respiratory diseases.ppt7. Epi of Chronic respiratory diseases.ppt
7. Epi of Chronic respiratory diseases.ppt
 
Reconciling Conflicting Data Curation Actions: Transparency Through Argument...
Reconciling Conflicting Data Curation Actions:  Transparency Through Argument...Reconciling Conflicting Data Curation Actions:  Transparency Through Argument...
Reconciling Conflicting Data Curation Actions: Transparency Through Argument...
 
Top profile Call Girls In Tumkur [ 7014168258 ] Call Me For Genuine Models We...
Top profile Call Girls In Tumkur [ 7014168258 ] Call Me For Genuine Models We...Top profile Call Girls In Tumkur [ 7014168258 ] Call Me For Genuine Models We...
Top profile Call Girls In Tumkur [ 7014168258 ] Call Me For Genuine Models We...
 
Vadodara 💋 Call Girl 7737669865 Call Girls in Vadodara Escort service book now
Vadodara 💋 Call Girl 7737669865 Call Girls in Vadodara Escort service book nowVadodara 💋 Call Girl 7737669865 Call Girls in Vadodara Escort service book now
Vadodara 💋 Call Girl 7737669865 Call Girls in Vadodara Escort service book now
 
Top profile Call Girls In Bihar Sharif [ 7014168258 ] Call Me For Genuine Mod...
Top profile Call Girls In Bihar Sharif [ 7014168258 ] Call Me For Genuine Mod...Top profile Call Girls In Bihar Sharif [ 7014168258 ] Call Me For Genuine Mod...
Top profile Call Girls In Bihar Sharif [ 7014168258 ] Call Me For Genuine Mod...
 
In Riyadh ((+919101817206)) Cytotec kit @ Abortion Pills Saudi Arabia
In Riyadh ((+919101817206)) Cytotec kit @ Abortion Pills Saudi ArabiaIn Riyadh ((+919101817206)) Cytotec kit @ Abortion Pills Saudi Arabia
In Riyadh ((+919101817206)) Cytotec kit @ Abortion Pills Saudi Arabia
 
Digital Transformation Playbook by Graham Ware
Digital Transformation Playbook by Graham WareDigital Transformation Playbook by Graham Ware
Digital Transformation Playbook by Graham Ware
 
Discover Why Less is More in B2B Research
Discover Why Less is More in B2B ResearchDiscover Why Less is More in B2B Research
Discover Why Less is More in B2B Research
 
Top profile Call Girls In Indore [ 7014168258 ] Call Me For Genuine Models We...
Top profile Call Girls In Indore [ 7014168258 ] Call Me For Genuine Models We...Top profile Call Girls In Indore [ 7014168258 ] Call Me For Genuine Models We...
Top profile Call Girls In Indore [ 7014168258 ] Call Me For Genuine Models We...
 
怎样办理圣地亚哥州立大学毕业证(SDSU毕业证书)成绩单学校原版复制
怎样办理圣地亚哥州立大学毕业证(SDSU毕业证书)成绩单学校原版复制怎样办理圣地亚哥州立大学毕业证(SDSU毕业证书)成绩单学校原版复制
怎样办理圣地亚哥州立大学毕业证(SDSU毕业证书)成绩单学校原版复制
 

Kafka y python

  • 1. Define y gobierna tus APIs Kafka y python 17/05/2016
  • 2. Python Madrid · Python y Kafka Kafka y python
  • 3. Kafka y Python Python Madrid · Python y Kafka ¿Quién soy? Ingeniero de Software @Paradigma Digital @lvaroleon aleonsan
  • 4. Kafka y Python Python Madrid · Python y Kafka Kafka Origen
  • 5. Kafka y Python Python Madrid · Python y Kafka Kafka ¿Qué es? “ ” If you think of Hadoop as long-term memory, the question then is how you get the memories in there to begin with Apache Kafka is like the central nervous system, which collects all of these messages from the underlying systems and transmits them into the memory vault, or storage. - Eric Vishria
  • 6. Kafka y Python Python Madrid · Python y Kafka Kafka Motivation To be able to act as a unified platform for handling all the real-time data feeds a large company might have. … … … … … … Event Tracking Application Logs Application Messages Application Monitoring data
  • 7. Kafka y Python Python Madrid · Python y Kafka Kafka How to ? ● Distributed, the essence ● Scalable ● Efficient ● Durable, fault tolerance
  • 8. Kafka y Python Python Madrid · Python y Kafka Kafka Básicos P PP C C C C … … … Kafka Cluster ● Producers ● Brokers ● Consumers
  • 9. Kafka y Python Python Madrid · Python y Kafka Kafka Cluster: Topics & Partitions Kafka Cluster ● Topics ● Partitions ● Message 1 2 3 4 5 1 2 3 4 1 2 3 1 2 3 T1P0 T1P1 T2P0 T2P1
  • 10. Kafka y Python Python Madrid · Python y Kafka Kafka Partitions & Replication Kafka Cluster ● Replication factor ○ Leader ○ Followers ● ISR ○ In-sync policies 1 2 3 4 5 Broker1Broker2 1 2 3 4 5 PM PM
  • 11. Kafka y Python Python Madrid · Python y Kafka Kafka Producers ● Publish Messages ● Choose partitions ○ policies ● Producer configuration ○ ACKs ○ Retries ○ Batch size ○ ...
  • 12. Kafka y Python Python Madrid · Python y Kafka Kafka Consumers ● “Subscribe” to a feed ● Consumer groups Kafka Cluster Partition 0 Broker1Broker2 Partition 1 ○ Queue ○ Publish-subscribe C C C ● Order guarantees C C
  • 13. Kafka y Python Python Madrid · Python y Kafka Kafka Efficiency ● Small I/O problem ○ Message sets ● Message set compression ○ policies ● Standard binary message format ○ Transfer without modifications
  • 14. Kafka y Python Python Madrid · Python y Kafka Kafka Python Clients ● Kafka-python ○ 0.8+, recomendada 0.9 ○ Python 3.6+ ○ Python 3.3+ https://github.com/dpkp/kafka-python ● Pykafka ○ 0.8.2+ ○ Python 2.7+ ○ Python 3.4+ https://github.com/Parsely/pykafka
  • 15. Kafka y Python Python Madrid · Python y Kafka Kafka Python Clients Kafka-python ● Producer class kafka.KafkaProducer: def __init__(self, **configs) def send(self, topic, value=None, key=None, partition=None) ● class RecordAccumulator: ● class Partitioner: def flush(self, timeout=None)
  • 16. Kafka y Python Python Madrid · Python y Kafka Kafka Python Clients Kafka-python ● Consumer ○ message iterator class kafka.KafkaConsumer(six.Iterator): def __init__(self, *topics, **configs) def __next__(self) def subscribe(self, topics=(), pattern=None, listener=None) def unsubscribe(self) def assign(self, partitions) def seek(self, partition, offset) def commit(self, offsets=None)
  • 17. Kafka y Python Python Madrid · Python y Kafka Kafka Python Clients Kafka-python ● Cluster ○ client manages some cluster metadata class kafka.ClusterMetadata: def __init__(self, **configs) def available_partitions_for_topic(self, topic) def leader_for_partition(self, partition) def partitions_for_broker(self, broker_id) … def update_metadata(self, metadata) ● ConsumerCoordinator
  • 18. Kafka y Python Python Madrid · Python y Kafka Kafka Python Clients pyKafka ● Producer class pykafka.Producer: def __init__(self, . . . ) def produce(self, message, partition_key=None) ● Consumer class pykafka.SimpleConsumer: def __init__(self, . . .) def consume(self, block=True)
  • 19. Kafka y Python Python Madrid · Python y Kafka Kafka Python Clients Kafka-python ● Ejemplo client = pykafka.KafkaClient(. . .) topic = client.topics[0] producer = topic.get_sync_producer() . . . consumer = topic.get_simple_consumer() for message in consumer:
  • 20. Kafka y Python Python Madrid · Python y Kafka Kafka Python Clients Demo Demo Time
  • 21. Kafka y Python Python Madrid · Python y Kafka Kafka y Python Thanks for your attention Thank you
  • 22. Kafka y Python Python Madrid · Python y Kafka Kafka y Python Questions ¿ ?
  • 23. Kafka y Python Python Madrid · Python y Kafka Kafka El Clúster