SlideShare ist ein Scribd-Unternehmen logo
1 von 26
Downloaden Sie, um offline zu lesen
Building an
Asynchronous
Application Framework
with Python and Pulsar
FEBRUARY 9 2022 Pulsar Summit
Zac Bentley
Lead Site Reliability Engineer
Boston, MA
2
2022 © Klaviyo Confidential
The Problem
What We Built
Challenges
What Worked Well
What’s Next?
01
02
03
04
05
3
2022 © Klaviyo Confidential
Segmentation
Reviews
Retail POS
Social
Surveys
Referrals
Logistics
Shipping
Customer service
Loyalty
On site
personalization
Forms
Ecommerce
Order confirmation
SMS
Email
Existing Architecture
5
2022 © Klaviyo Confidential
Problems
Reliability Scalability Ownership/Process Architectural
6
2022 © Klaviyo Confidential
Problems
Reliability
RabbitMQ has reliability issues when
pushed too hard.
“Backpressure will find you”
Deep queues behave poorly.
Lots of outages and firefighting.
Scalability Ownership/Process Architectural
7
2022 © Klaviyo Confidential
Problems
Reliability Scalability
Scaling RabbitMQ is intrusive:
application code has to be aware of
topology changes at every level.
Geometry changes are painful.
Scale-out doesn’t bring
reliability/redundancy benefits.
Ownership/Process Architectural
8
2022 © Klaviyo Confidential
Problems
Reliability Scalability Ownership/Process
Individual team ownership is
expensive in:
- Roadmap time.
- Hiring/onboarding capacity.
- Coordination.
Per-team ownership creates
redundant expertise.
Architectural
9
2022 © Klaviyo Confidential
Problems
Reliability Scalability Ownership/Process Architectural
Celery is pretty hostile to SOA.
Ordered consuming: not possible.
Processing more >1 message at a time:
not possible.
Pub/sub: difficult.
Replay/introspection: not possible.
Existing API: Producers
from app.tasks import mytask
# Synchronous call:
mytask("arg1", "arg2", kwarg1=SomeObject())
# Asynchronous call:
mytask.apply_async(args=("arg1", "arg2"), kwargs={"kwarg1": SomeObject()})
@celery.task(acks_late=True)
def mytask(arg1, arg2, kwarg1=None):
...
@celery.task(acks_late=True)
def mytask2(*args, **kwargs):
...
Existing API: Consumer Workload Declaration
11
2022 © Klaviyo Confidential
Problems
Reliability Scalability Ownership/Process Architectural
02 What We Built
1. Platform Services: a team
2. Pulsar: a broker deployment
3. StreamNative: a support relationship
4. Chariot: an asynchronous application framework
ORM for Pulsar Interactions
for tenant in Tenant.search(name="standalone"):
if tenant.allowed_clusters == ["standalone"]:
ns = Namespace(
tenant=tenant,
name="mynamespace",
acknowledged_quota=AcknowledgedMessageQuota(age=timedelta(minutes=10)),
)
ns.create()
topic = Topic(
namespace=ns,
name="mytopic"
)
topic.create()
subscription = Subscription(
topic=topic,
name="mysubscription",
type=SubscriptionType.KeyShared,
)
subscription.create()
assert Subscription.get(name="mysubscription") == subscription
consumer = subscription.consumer(name="myconsumer").connect()
while True:
message = consumer.receive()
consumer.acknowledge(message)
Declarative API for Schema Management & Migrations
from klaviyo_schema.registry.teamname.data.payload_pb2 import PayloadProto
my_topic = ChariotTopic(
name="demo",
durability=Durability.DURABILITY_REDUNDANT,
max_message_size="1kb",
max_producers=100,
max_consumers=10,
publish_rate_limits=(
RateLimit(
messages=1000,
period="1m",
actions=[RateLimitAction.RATE_LIMIT_ACTION_BLOCK],
),
),
thresholds=(
Threshold(
kind=ThresholdKind.THRESHOLD_KIND_UNACKNOWLEDGED,
size="200mb",
actions=[ThresholdAction.THRESHOLD_FAIL_PUBLISH],
),
),
consumer_groups=(ConsumerGroup(name="demo-consumer-group", type=SubscriptionType.KeyShared),),
payload=RegisteredPayloadFromClass(payload_class=PayloadProto),
)
Existing API: Producers
from app.tasks import mytask
# Synchronous call:
mytask("arg1", "arg2", kwarg1=SomeObject())
# Asynchronous call:
mytask.apply_async(args=("arg1", "arg2"), kwargs={"kwarg1": SomeObject()})
@celery.task(acks_late=True)
def mytask(arg1, arg2, kwarg1=None):
...
@celery.task(acks_late=True)
def mytask2(*args, **kwargs):
...
Existing API: Consumer Workload Declaration
New API: Producers
class DemoExecutor(AsynchronousExecutor):
@lifecycle_method(timeout=timedelta(seconds=10))
async def on_executor_shutdown_requested(self): ...
@lifecycle_method(timeout=timedelta(seconds=10))
async def on_executor_shutdown(self): ...
@lifecycle_method(timeout=timedelta(seconds=10))
async def on_executor_startup(self): ...
@lifecycle_method(timeout=timedelta(seconds=10))
async def on_message_batch(self, messages: Sequence[PayloadProto]):
for idx, msg in enumerate(messages):
if idx % 2 == 0:
await self.chariot_ack(msg)
else:
await self.chariot_reject(msg)
from klaviyo_schema.registry.teamname.data.payload_pb2 import PayloadProto
from klaviyo_schema.registry.teamname.topics import my_topic
await my_topic.send(PayloadProto(...))
New API: Consumer Workload Declaration
Back-Of-Queue Retries
class DemoExecutor(AsynchronousExecutor):
@lifecycle_method(timeout=timedelta(seconds=10))
@requeue_retry(
batch_predicate=retry_on_exception_type(
RetryException, retry_log_level=logging.INFO
),
message_predicate=retry_until_approximate_attempt_count(10),
delay=wait_exponential(max=timedelta(seconds=5)) + timedelta(seconds=1),
)
async def on_message_batch(self, messages: Sequence[PayloadProto]):
raise RetryException("Expected retry")
~> chariot worker start --topic demo --consumer-group democg --parallel 10 
--start-executors-lazily --executor-class app.executors.demo:DemoExecutor 
--message-batch-assignment-behavior AnyKeyToAnyExecutor
~> chariot worker start --topic demo --consumer-group democg --parallel 10 
--start-executors-lazily --executor-class app.executors.demo:DemoExecutor 
--message-batch-assignment-behavior NoOverlapBestEffortKeyExecutorAffinity 
--message-batch-flush-after-items 1000 --message-batch-flush-after-time 10sec
Custom Batching and “Steering” for Parallel Execution without Reordering
18
2022 © Klaviyo Confidential
Problems Solutions
Reliability Scalability Ownership/Process Architectural
19
2022 © Klaviyo Confidential
Solutions
Reliability
To become a user is to express the
enforced maximum workload you’ll
run.
Pulsar’s redundancy helps weather
outages.
Deep backlogs are usable because
reads aren’t always writes.
Scalability Ownership/Process Architectural
20
2022 © Klaviyo Confidential
Solutions
Reliability Scalability
The “CEO” (Central Expert Owner)
can scale out pulsar to respond to
demand.
Teams express scalability need in the
form of elevated rate limits or partition
counts.
Consultation with the community and
StreamNative is invaluable.
Ownership/Process Architectural
21
2022 © Klaviyo Confidential
Solutions
Reliability Scalability Ownership/Process
Teams own producers/consumers.
Teams submit their contracts, in the
form of schema PRs, to the broker
owners.
Schema changes and backwards
compatibility aren’t simple but they
are now predictable.
Architectural
22
2022 © Klaviyo Confidential
Solutions
Reliability Scalability Ownership/Process Architectural
Many new patterns are now on the table:
- Pub-sub
- Ordered consume
- Batched consumption +
out-of-order acks
- Deduplication/debouncing
Reading topics at rest improves visibility.
Async interaction with the same stream
from multiple codebases is now possible.
03 Challenges
● Distribution as a library/framework
rather than an application
● Python/C++ Pulsar client maturity
● Combining advanced broker features
surfaced bugs
● Forking consumer daemons +
threaded clients + async/await style
is a costly combination
● Expectation management
● The “gap ledger”
● Management API quality
04 What Worked Well
Process:
● Support from above
● Managed rollout speed
● Solving 2025’s problems, not 2022’s
● “Steel-thread” style focus on specific
use-cases
● Willingness to commit to bring work
in-house and start fresh where it
made sense
Technology:
● Declarative schemas for messages
and dataflows
● Schema registry as code rather than
a SPOF
● Managed Pulsar allows us to learn
with less pain
● Isolating user code from consumer
code improves reliability
05 What’s Next?
Near Term:
● Manage internal adoption
● Scale to meet annual shopping
holidays’ needs
● Start work on a “publish gateway” for
connection pooling, circuit breaking,
etc.
Long Term:
● Online schema changes
● Key-local state
● Complex workflow support
● Make our work available to the
community
klaviyo.com/careers
zac@klaviyo.com

Weitere ähnliche Inhalte

Was ist angesagt?

Introduction to Istio Service Mesh
Introduction to Istio Service MeshIntroduction to Istio Service Mesh
Introduction to Istio Service MeshGeorgios Andrianakis
 
Microservices With Istio Service Mesh
Microservices With Istio Service MeshMicroservices With Istio Service Mesh
Microservices With Istio Service MeshNatanael Fonseca
 
Oracleのソース・ターゲットエンドポイントとしての利用
Oracleのソース・ターゲットエンドポイントとしての利用Oracleのソース・ターゲットエンドポイントとしての利用
Oracleのソース・ターゲットエンドポイントとしての利用QlikPresalesJapan
 
Gitops: the kubernetes way
Gitops: the kubernetes wayGitops: the kubernetes way
Gitops: the kubernetes waysparkfabrik
 
Architecture Patterns for Event Streaming (Nick Dearden, Confluent) London 20...
Architecture Patterns for Event Streaming (Nick Dearden, Confluent) London 20...Architecture Patterns for Event Streaming (Nick Dearden, Confluent) London 20...
Architecture Patterns for Event Streaming (Nick Dearden, Confluent) London 20...confluent
 
Istio service mesh introduction
Istio service mesh introductionIstio service mesh introduction
Istio service mesh introductionKyohei Mizumoto
 
Design and Implementation of Incremental Cooperative Rebalancing
Design and Implementation of Incremental Cooperative RebalancingDesign and Implementation of Incremental Cooperative Rebalancing
Design and Implementation of Incremental Cooperative Rebalancingconfluent
 
Pacemaker+DRBD
Pacemaker+DRBDPacemaker+DRBD
Pacemaker+DRBDDan Frincu
 
An Introduction to OpenStack Heat
An Introduction to OpenStack HeatAn Introduction to OpenStack Heat
An Introduction to OpenStack HeatMirantis
 
Kubernetes Networking
Kubernetes NetworkingKubernetes Networking
Kubernetes NetworkingCJ Cullen
 
Autoscaling Flink with Reactive Mode
Autoscaling Flink with Reactive ModeAutoscaling Flink with Reactive Mode
Autoscaling Flink with Reactive ModeFlink Forward
 
91APP: 從 "零" 開始的 DevOps
91APP: 從 "零" 開始的 DevOps91APP: 從 "零" 開始的 DevOps
91APP: 從 "零" 開始的 DevOpsAndrew Wu
 
Deployment model Blue Green deployment
Deployment model Blue Green deploymentDeployment model Blue Green deployment
Deployment model Blue Green deploymentjeetendra mandal
 
Kubernetes Deployment Strategies
Kubernetes Deployment StrategiesKubernetes Deployment Strategies
Kubernetes Deployment StrategiesAbdennour TM
 

Was ist angesagt? (20)

Kafka internals
Kafka internalsKafka internals
Kafka internals
 
Anthos
AnthosAnthos
Anthos
 
Introduction to Istio Service Mesh
Introduction to Istio Service MeshIntroduction to Istio Service Mesh
Introduction to Istio Service Mesh
 
Microservices With Istio Service Mesh
Microservices With Istio Service MeshMicroservices With Istio Service Mesh
Microservices With Istio Service Mesh
 
Oracleのソース・ターゲットエンドポイントとしての利用
Oracleのソース・ターゲットエンドポイントとしての利用Oracleのソース・ターゲットエンドポイントとしての利用
Oracleのソース・ターゲットエンドポイントとしての利用
 
Gitops: the kubernetes way
Gitops: the kubernetes wayGitops: the kubernetes way
Gitops: the kubernetes way
 
Architecture Patterns for Event Streaming (Nick Dearden, Confluent) London 20...
Architecture Patterns for Event Streaming (Nick Dearden, Confluent) London 20...Architecture Patterns for Event Streaming (Nick Dearden, Confluent) London 20...
Architecture Patterns for Event Streaming (Nick Dearden, Confluent) London 20...
 
Istio service mesh introduction
Istio service mesh introductionIstio service mesh introduction
Istio service mesh introduction
 
Terraform on Azure
Terraform on AzureTerraform on Azure
Terraform on Azure
 
Design and Implementation of Incremental Cooperative Rebalancing
Design and Implementation of Incremental Cooperative RebalancingDesign and Implementation of Incremental Cooperative Rebalancing
Design and Implementation of Incremental Cooperative Rebalancing
 
Pacemaker+DRBD
Pacemaker+DRBDPacemaker+DRBD
Pacemaker+DRBD
 
An Introduction to OpenStack Heat
An Introduction to OpenStack HeatAn Introduction to OpenStack Heat
An Introduction to OpenStack Heat
 
Ansible Tower
Ansible TowerAnsible Tower
Ansible Tower
 
Kubernetes Networking
Kubernetes NetworkingKubernetes Networking
Kubernetes Networking
 
Autoscaling Flink with Reactive Mode
Autoscaling Flink with Reactive ModeAutoscaling Flink with Reactive Mode
Autoscaling Flink with Reactive Mode
 
91APP: 從 "零" 開始的 DevOps
91APP: 從 "零" 開始的 DevOps91APP: 從 "零" 開始的 DevOps
91APP: 從 "零" 開始的 DevOps
 
Deployment model Blue Green deployment
Deployment model Blue Green deploymentDeployment model Blue Green deployment
Deployment model Blue Green deployment
 
Kubernetes Deployment Strategies
Kubernetes Deployment StrategiesKubernetes Deployment Strategies
Kubernetes Deployment Strategies
 
Kafka basics
Kafka basicsKafka basics
Kafka basics
 
Intro to kubernetes
Intro to kubernetesIntro to kubernetes
Intro to kubernetes
 

Ähnlich wie Building an Asynchronous Application Framework with Python and Pulsar - Pulsar Summit SF 2022

Architecting Microservices in .Net
Architecting Microservices in .NetArchitecting Microservices in .Net
Architecting Microservices in .NetRichard Banks
 
The Future of Service Mesh
The Future of Service MeshThe Future of Service Mesh
The Future of Service MeshAll Things Open
 
Contino Webinar - Migrating your Trading Workloads to the Cloud
Contino Webinar -  Migrating your Trading Workloads to the CloudContino Webinar -  Migrating your Trading Workloads to the Cloud
Contino Webinar - Migrating your Trading Workloads to the CloudBen Saunders
 
CNCF On-Demand Webinar_ LitmusChaos Project Updates.pdf
CNCF On-Demand Webinar_ LitmusChaos Project Updates.pdfCNCF On-Demand Webinar_ LitmusChaos Project Updates.pdf
CNCF On-Demand Webinar_ LitmusChaos Project Updates.pdfLibbySchulze
 
External should that be a microservice
External should that be a microserviceExternal should that be a microservice
External should that be a microserviceRohit Kelapure
 
Cloud world forum talk 062515
Cloud world forum talk 062515Cloud world forum talk 062515
Cloud world forum talk 062515Ajay Dankar
 
Applying Code Customizations to Magento 2
Applying Code Customizations to Magento 2 Applying Code Customizations to Magento 2
Applying Code Customizations to Magento 2 Igor Miniailo
 
Confluent Partner Tech Talk with SVA
Confluent Partner Tech Talk with SVAConfluent Partner Tech Talk with SVA
Confluent Partner Tech Talk with SVAconfluent
 
Cloud 12 08 V2
Cloud 12 08 V2Cloud 12 08 V2
Cloud 12 08 V2Pini Cohen
 
Primatics Financial - Parallel, High Throughput Risk Calculations On The Cloud
Primatics Financial - Parallel, High Throughput Risk Calculations On The CloudPrimatics Financial - Parallel, High Throughput Risk Calculations On The Cloud
Primatics Financial - Parallel, High Throughput Risk Calculations On The CloudAmnon Raviv
 
End User Computing at CloudHesive.pptx
End User Computing at CloudHesive.pptxEnd User Computing at CloudHesive.pptx
End User Computing at CloudHesive.pptxCloudHesive
 
Container Technologies and Transformational value
Container Technologies and Transformational valueContainer Technologies and Transformational value
Container Technologies and Transformational valueMihai Criveti
 
Microservice Builder: A Microservice DevOps Pipeline for Rapid Delivery and P...
Microservice Builder: A Microservice DevOps Pipeline for Rapid Delivery and P...Microservice Builder: A Microservice DevOps Pipeline for Rapid Delivery and P...
Microservice Builder: A Microservice DevOps Pipeline for Rapid Delivery and P...David Currie
 
Cloud Computing Certification
Cloud Computing CertificationCloud Computing Certification
Cloud Computing CertificationVskills
 
5 Years Of Building SaaS On AWS
5 Years Of Building SaaS On AWS5 Years Of Building SaaS On AWS
5 Years Of Building SaaS On AWSChristian Beedgen
 
Cloud_controllers_public_webinar_aug31_v1.pptx
Cloud_controllers_public_webinar_aug31_v1.pptxCloud_controllers_public_webinar_aug31_v1.pptx
Cloud_controllers_public_webinar_aug31_v1.pptxAvi Networks
 

Ähnlich wie Building an Asynchronous Application Framework with Python and Pulsar - Pulsar Summit SF 2022 (20)

Architecting Microservices in .Net
Architecting Microservices in .NetArchitecting Microservices in .Net
Architecting Microservices in .Net
 
The Future of Service Mesh
The Future of Service MeshThe Future of Service Mesh
The Future of Service Mesh
 
Contino Webinar - Migrating your Trading Workloads to the Cloud
Contino Webinar -  Migrating your Trading Workloads to the CloudContino Webinar -  Migrating your Trading Workloads to the Cloud
Contino Webinar - Migrating your Trading Workloads to the Cloud
 
CNCF On-Demand Webinar_ LitmusChaos Project Updates.pdf
CNCF On-Demand Webinar_ LitmusChaos Project Updates.pdfCNCF On-Demand Webinar_ LitmusChaos Project Updates.pdf
CNCF On-Demand Webinar_ LitmusChaos Project Updates.pdf
 
Cloud monitoring overview
Cloud monitoring overviewCloud monitoring overview
Cloud monitoring overview
 
Mohideen Khader-122316
Mohideen Khader-122316Mohideen Khader-122316
Mohideen Khader-122316
 
External should that be a microservice
External should that be a microserviceExternal should that be a microservice
External should that be a microservice
 
7. introduction
7. introduction7. introduction
7. introduction
 
Damodar_TIBCO
Damodar_TIBCODamodar_TIBCO
Damodar_TIBCO
 
Cloud world forum talk 062515
Cloud world forum talk 062515Cloud world forum talk 062515
Cloud world forum talk 062515
 
Applying Code Customizations to Magento 2
Applying Code Customizations to Magento 2 Applying Code Customizations to Magento 2
Applying Code Customizations to Magento 2
 
Confluent Partner Tech Talk with SVA
Confluent Partner Tech Talk with SVAConfluent Partner Tech Talk with SVA
Confluent Partner Tech Talk with SVA
 
Cloud 12 08 V2
Cloud 12 08 V2Cloud 12 08 V2
Cloud 12 08 V2
 
Primatics Financial - Parallel, High Throughput Risk Calculations On The Cloud
Primatics Financial - Parallel, High Throughput Risk Calculations On The CloudPrimatics Financial - Parallel, High Throughput Risk Calculations On The Cloud
Primatics Financial - Parallel, High Throughput Risk Calculations On The Cloud
 
End User Computing at CloudHesive.pptx
End User Computing at CloudHesive.pptxEnd User Computing at CloudHesive.pptx
End User Computing at CloudHesive.pptx
 
Container Technologies and Transformational value
Container Technologies and Transformational valueContainer Technologies and Transformational value
Container Technologies and Transformational value
 
Microservice Builder: A Microservice DevOps Pipeline for Rapid Delivery and P...
Microservice Builder: A Microservice DevOps Pipeline for Rapid Delivery and P...Microservice Builder: A Microservice DevOps Pipeline for Rapid Delivery and P...
Microservice Builder: A Microservice DevOps Pipeline for Rapid Delivery and P...
 
Cloud Computing Certification
Cloud Computing CertificationCloud Computing Certification
Cloud Computing Certification
 
5 Years Of Building SaaS On AWS
5 Years Of Building SaaS On AWS5 Years Of Building SaaS On AWS
5 Years Of Building SaaS On AWS
 
Cloud_controllers_public_webinar_aug31_v1.pptx
Cloud_controllers_public_webinar_aug31_v1.pptxCloud_controllers_public_webinar_aug31_v1.pptx
Cloud_controllers_public_webinar_aug31_v1.pptx
 

Mehr von StreamNative

Is Using KoP (Kafka-on-Pulsar) a Good Idea? - Pulsar Summit SF 2022
Is Using KoP (Kafka-on-Pulsar) a Good Idea? - Pulsar Summit SF 2022Is Using KoP (Kafka-on-Pulsar) a Good Idea? - Pulsar Summit SF 2022
Is Using KoP (Kafka-on-Pulsar) a Good Idea? - Pulsar Summit SF 2022StreamNative
 
Distributed Database Design Decisions to Support High Performance Event Strea...
Distributed Database Design Decisions to Support High Performance Event Strea...Distributed Database Design Decisions to Support High Performance Event Strea...
Distributed Database Design Decisions to Support High Performance Event Strea...StreamNative
 
Simplify Pulsar Functions Development with SQL - Pulsar Summit SF 2022
Simplify Pulsar Functions Development with SQL - Pulsar Summit SF 2022Simplify Pulsar Functions Development with SQL - Pulsar Summit SF 2022
Simplify Pulsar Functions Development with SQL - Pulsar Summit SF 2022StreamNative
 
Towards a ZooKeeper-less Pulsar, etcd, etcd, etcd. - Pulsar Summit SF 2022
Towards a ZooKeeper-less Pulsar, etcd, etcd, etcd. - Pulsar Summit SF 2022Towards a ZooKeeper-less Pulsar, etcd, etcd, etcd. - Pulsar Summit SF 2022
Towards a ZooKeeper-less Pulsar, etcd, etcd, etcd. - Pulsar Summit SF 2022StreamNative
 
Validating Apache Pulsar’s Behavior under Failure Conditions - Pulsar Summit ...
Validating Apache Pulsar’s Behavior under Failure Conditions - Pulsar Summit ...Validating Apache Pulsar’s Behavior under Failure Conditions - Pulsar Summit ...
Validating Apache Pulsar’s Behavior under Failure Conditions - Pulsar Summit ...StreamNative
 
Cross the Streams! Creating Streaming Data Pipelines with Apache Flink + Apac...
Cross the Streams! Creating Streaming Data Pipelines with Apache Flink + Apac...Cross the Streams! Creating Streaming Data Pipelines with Apache Flink + Apac...
Cross the Streams! Creating Streaming Data Pipelines with Apache Flink + Apac...StreamNative
 
Message Redelivery: An Unexpected Journey - Pulsar Summit SF 2022
Message Redelivery: An Unexpected Journey - Pulsar Summit SF 2022Message Redelivery: An Unexpected Journey - Pulsar Summit SF 2022
Message Redelivery: An Unexpected Journey - Pulsar Summit SF 2022StreamNative
 
Unlocking the Power of Lakehouse Architectures with Apache Pulsar and Apache ...
Unlocking the Power of Lakehouse Architectures with Apache Pulsar and Apache ...Unlocking the Power of Lakehouse Architectures with Apache Pulsar and Apache ...
Unlocking the Power of Lakehouse Architectures with Apache Pulsar and Apache ...StreamNative
 
Understanding Broker Load Balancing - Pulsar Summit SF 2022
Understanding Broker Load Balancing - Pulsar Summit SF 2022Understanding Broker Load Balancing - Pulsar Summit SF 2022
Understanding Broker Load Balancing - Pulsar Summit SF 2022StreamNative
 
Building an Asynchronous Application Framework with Python and Pulsar - Pulsa...
Building an Asynchronous Application Framework with Python and Pulsar - Pulsa...Building an Asynchronous Application Framework with Python and Pulsar - Pulsa...
Building an Asynchronous Application Framework with Python and Pulsar - Pulsa...StreamNative
 
Pulsar's Journey in Yahoo!: On-prem, Cloud and Hybrid - Pulsar Summit SF 2022
Pulsar's Journey in Yahoo!: On-prem, Cloud and Hybrid - Pulsar Summit SF 2022Pulsar's Journey in Yahoo!: On-prem, Cloud and Hybrid - Pulsar Summit SF 2022
Pulsar's Journey in Yahoo!: On-prem, Cloud and Hybrid - Pulsar Summit SF 2022StreamNative
 
Event-Driven Applications Done Right - Pulsar Summit SF 2022
Event-Driven Applications Done Right - Pulsar Summit SF 2022Event-Driven Applications Done Right - Pulsar Summit SF 2022
Event-Driven Applications Done Right - Pulsar Summit SF 2022StreamNative
 
Pulsar @ Scale. 200M RPM and 1K instances - Pulsar Summit SF 2022
Pulsar @ Scale. 200M RPM and 1K instances - Pulsar Summit SF 2022Pulsar @ Scale. 200M RPM and 1K instances - Pulsar Summit SF 2022
Pulsar @ Scale. 200M RPM and 1K instances - Pulsar Summit SF 2022StreamNative
 
Data Democracy: Journey to User-Facing Analytics - Pulsar Summit SF 2022
Data Democracy: Journey to User-Facing Analytics - Pulsar Summit SF 2022Data Democracy: Journey to User-Facing Analytics - Pulsar Summit SF 2022
Data Democracy: Journey to User-Facing Analytics - Pulsar Summit SF 2022StreamNative
 
Welcome and Opening Remarks - Pulsar Summit SF 2022
Welcome and Opening Remarks - Pulsar Summit SF 2022Welcome and Opening Remarks - Pulsar Summit SF 2022
Welcome and Opening Remarks - Pulsar Summit SF 2022StreamNative
 
Log System As Backbone – How We Built the World’s Most Advanced Vector Databa...
Log System As Backbone – How We Built the World’s Most Advanced Vector Databa...Log System As Backbone – How We Built the World’s Most Advanced Vector Databa...
Log System As Backbone – How We Built the World’s Most Advanced Vector Databa...StreamNative
 
MoP(MQTT on Pulsar) - a Powerful Tool for Apache Pulsar in IoT - Pulsar Summi...
MoP(MQTT on Pulsar) - a Powerful Tool for Apache Pulsar in IoT - Pulsar Summi...MoP(MQTT on Pulsar) - a Powerful Tool for Apache Pulsar in IoT - Pulsar Summi...
MoP(MQTT on Pulsar) - a Powerful Tool for Apache Pulsar in IoT - Pulsar Summi...StreamNative
 
Improvements Made in KoP 2.9.0 - Pulsar Summit Asia 2021
Improvements Made in KoP 2.9.0  - Pulsar Summit Asia 2021Improvements Made in KoP 2.9.0  - Pulsar Summit Asia 2021
Improvements Made in KoP 2.9.0 - Pulsar Summit Asia 2021StreamNative
 
Pulsar in the Lakehouse: Overview of Apache Pulsar and Delta Lake Connector -...
Pulsar in the Lakehouse: Overview of Apache Pulsar and Delta Lake Connector -...Pulsar in the Lakehouse: Overview of Apache Pulsar and Delta Lake Connector -...
Pulsar in the Lakehouse: Overview of Apache Pulsar and Delta Lake Connector -...StreamNative
 
The Evolution History of RoP(RocketMQ-on-Pulsar) - Pulsar Summit Asia 2021
The Evolution History of RoP(RocketMQ-on-Pulsar) - Pulsar Summit Asia 2021The Evolution History of RoP(RocketMQ-on-Pulsar) - Pulsar Summit Asia 2021
The Evolution History of RoP(RocketMQ-on-Pulsar) - Pulsar Summit Asia 2021StreamNative
 

Mehr von StreamNative (20)

Is Using KoP (Kafka-on-Pulsar) a Good Idea? - Pulsar Summit SF 2022
Is Using KoP (Kafka-on-Pulsar) a Good Idea? - Pulsar Summit SF 2022Is Using KoP (Kafka-on-Pulsar) a Good Idea? - Pulsar Summit SF 2022
Is Using KoP (Kafka-on-Pulsar) a Good Idea? - Pulsar Summit SF 2022
 
Distributed Database Design Decisions to Support High Performance Event Strea...
Distributed Database Design Decisions to Support High Performance Event Strea...Distributed Database Design Decisions to Support High Performance Event Strea...
Distributed Database Design Decisions to Support High Performance Event Strea...
 
Simplify Pulsar Functions Development with SQL - Pulsar Summit SF 2022
Simplify Pulsar Functions Development with SQL - Pulsar Summit SF 2022Simplify Pulsar Functions Development with SQL - Pulsar Summit SF 2022
Simplify Pulsar Functions Development with SQL - Pulsar Summit SF 2022
 
Towards a ZooKeeper-less Pulsar, etcd, etcd, etcd. - Pulsar Summit SF 2022
Towards a ZooKeeper-less Pulsar, etcd, etcd, etcd. - Pulsar Summit SF 2022Towards a ZooKeeper-less Pulsar, etcd, etcd, etcd. - Pulsar Summit SF 2022
Towards a ZooKeeper-less Pulsar, etcd, etcd, etcd. - Pulsar Summit SF 2022
 
Validating Apache Pulsar’s Behavior under Failure Conditions - Pulsar Summit ...
Validating Apache Pulsar’s Behavior under Failure Conditions - Pulsar Summit ...Validating Apache Pulsar’s Behavior under Failure Conditions - Pulsar Summit ...
Validating Apache Pulsar’s Behavior under Failure Conditions - Pulsar Summit ...
 
Cross the Streams! Creating Streaming Data Pipelines with Apache Flink + Apac...
Cross the Streams! Creating Streaming Data Pipelines with Apache Flink + Apac...Cross the Streams! Creating Streaming Data Pipelines with Apache Flink + Apac...
Cross the Streams! Creating Streaming Data Pipelines with Apache Flink + Apac...
 
Message Redelivery: An Unexpected Journey - Pulsar Summit SF 2022
Message Redelivery: An Unexpected Journey - Pulsar Summit SF 2022Message Redelivery: An Unexpected Journey - Pulsar Summit SF 2022
Message Redelivery: An Unexpected Journey - Pulsar Summit SF 2022
 
Unlocking the Power of Lakehouse Architectures with Apache Pulsar and Apache ...
Unlocking the Power of Lakehouse Architectures with Apache Pulsar and Apache ...Unlocking the Power of Lakehouse Architectures with Apache Pulsar and Apache ...
Unlocking the Power of Lakehouse Architectures with Apache Pulsar and Apache ...
 
Understanding Broker Load Balancing - Pulsar Summit SF 2022
Understanding Broker Load Balancing - Pulsar Summit SF 2022Understanding Broker Load Balancing - Pulsar Summit SF 2022
Understanding Broker Load Balancing - Pulsar Summit SF 2022
 
Building an Asynchronous Application Framework with Python and Pulsar - Pulsa...
Building an Asynchronous Application Framework with Python and Pulsar - Pulsa...Building an Asynchronous Application Framework with Python and Pulsar - Pulsa...
Building an Asynchronous Application Framework with Python and Pulsar - Pulsa...
 
Pulsar's Journey in Yahoo!: On-prem, Cloud and Hybrid - Pulsar Summit SF 2022
Pulsar's Journey in Yahoo!: On-prem, Cloud and Hybrid - Pulsar Summit SF 2022Pulsar's Journey in Yahoo!: On-prem, Cloud and Hybrid - Pulsar Summit SF 2022
Pulsar's Journey in Yahoo!: On-prem, Cloud and Hybrid - Pulsar Summit SF 2022
 
Event-Driven Applications Done Right - Pulsar Summit SF 2022
Event-Driven Applications Done Right - Pulsar Summit SF 2022Event-Driven Applications Done Right - Pulsar Summit SF 2022
Event-Driven Applications Done Right - Pulsar Summit SF 2022
 
Pulsar @ Scale. 200M RPM and 1K instances - Pulsar Summit SF 2022
Pulsar @ Scale. 200M RPM and 1K instances - Pulsar Summit SF 2022Pulsar @ Scale. 200M RPM and 1K instances - Pulsar Summit SF 2022
Pulsar @ Scale. 200M RPM and 1K instances - Pulsar Summit SF 2022
 
Data Democracy: Journey to User-Facing Analytics - Pulsar Summit SF 2022
Data Democracy: Journey to User-Facing Analytics - Pulsar Summit SF 2022Data Democracy: Journey to User-Facing Analytics - Pulsar Summit SF 2022
Data Democracy: Journey to User-Facing Analytics - Pulsar Summit SF 2022
 
Welcome and Opening Remarks - Pulsar Summit SF 2022
Welcome and Opening Remarks - Pulsar Summit SF 2022Welcome and Opening Remarks - Pulsar Summit SF 2022
Welcome and Opening Remarks - Pulsar Summit SF 2022
 
Log System As Backbone – How We Built the World’s Most Advanced Vector Databa...
Log System As Backbone – How We Built the World’s Most Advanced Vector Databa...Log System As Backbone – How We Built the World’s Most Advanced Vector Databa...
Log System As Backbone – How We Built the World’s Most Advanced Vector Databa...
 
MoP(MQTT on Pulsar) - a Powerful Tool for Apache Pulsar in IoT - Pulsar Summi...
MoP(MQTT on Pulsar) - a Powerful Tool for Apache Pulsar in IoT - Pulsar Summi...MoP(MQTT on Pulsar) - a Powerful Tool for Apache Pulsar in IoT - Pulsar Summi...
MoP(MQTT on Pulsar) - a Powerful Tool for Apache Pulsar in IoT - Pulsar Summi...
 
Improvements Made in KoP 2.9.0 - Pulsar Summit Asia 2021
Improvements Made in KoP 2.9.0  - Pulsar Summit Asia 2021Improvements Made in KoP 2.9.0  - Pulsar Summit Asia 2021
Improvements Made in KoP 2.9.0 - Pulsar Summit Asia 2021
 
Pulsar in the Lakehouse: Overview of Apache Pulsar and Delta Lake Connector -...
Pulsar in the Lakehouse: Overview of Apache Pulsar and Delta Lake Connector -...Pulsar in the Lakehouse: Overview of Apache Pulsar and Delta Lake Connector -...
Pulsar in the Lakehouse: Overview of Apache Pulsar and Delta Lake Connector -...
 
The Evolution History of RoP(RocketMQ-on-Pulsar) - Pulsar Summit Asia 2021
The Evolution History of RoP(RocketMQ-on-Pulsar) - Pulsar Summit Asia 2021The Evolution History of RoP(RocketMQ-on-Pulsar) - Pulsar Summit Asia 2021
The Evolution History of RoP(RocketMQ-on-Pulsar) - Pulsar Summit Asia 2021
 

Kürzlich hochgeladen

From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionDilum Bandara
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsNathaniel Shimoni
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demoHarshalMandlekar2
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxLoriGlavin3
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfLoriGlavin3
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 

Kürzlich hochgeladen (20)

From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An Introduction
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directions
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demo
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdf
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 

Building an Asynchronous Application Framework with Python and Pulsar - Pulsar Summit SF 2022

  • 1. Building an Asynchronous Application Framework with Python and Pulsar FEBRUARY 9 2022 Pulsar Summit Zac Bentley Lead Site Reliability Engineer Boston, MA
  • 2. 2 2022 © Klaviyo Confidential The Problem What We Built Challenges What Worked Well What’s Next? 01 02 03 04 05
  • 3. 3 2022 © Klaviyo Confidential Segmentation Reviews Retail POS Social Surveys Referrals Logistics Shipping Customer service Loyalty On site personalization Forms Ecommerce Order confirmation SMS Email
  • 5. 5 2022 © Klaviyo Confidential Problems Reliability Scalability Ownership/Process Architectural
  • 6. 6 2022 © Klaviyo Confidential Problems Reliability RabbitMQ has reliability issues when pushed too hard. “Backpressure will find you” Deep queues behave poorly. Lots of outages and firefighting. Scalability Ownership/Process Architectural
  • 7. 7 2022 © Klaviyo Confidential Problems Reliability Scalability Scaling RabbitMQ is intrusive: application code has to be aware of topology changes at every level. Geometry changes are painful. Scale-out doesn’t bring reliability/redundancy benefits. Ownership/Process Architectural
  • 8. 8 2022 © Klaviyo Confidential Problems Reliability Scalability Ownership/Process Individual team ownership is expensive in: - Roadmap time. - Hiring/onboarding capacity. - Coordination. Per-team ownership creates redundant expertise. Architectural
  • 9. 9 2022 © Klaviyo Confidential Problems Reliability Scalability Ownership/Process Architectural Celery is pretty hostile to SOA. Ordered consuming: not possible. Processing more >1 message at a time: not possible. Pub/sub: difficult. Replay/introspection: not possible.
  • 10. Existing API: Producers from app.tasks import mytask # Synchronous call: mytask("arg1", "arg2", kwarg1=SomeObject()) # Asynchronous call: mytask.apply_async(args=("arg1", "arg2"), kwargs={"kwarg1": SomeObject()}) @celery.task(acks_late=True) def mytask(arg1, arg2, kwarg1=None): ... @celery.task(acks_late=True) def mytask2(*args, **kwargs): ... Existing API: Consumer Workload Declaration
  • 11. 11 2022 © Klaviyo Confidential Problems Reliability Scalability Ownership/Process Architectural
  • 12. 02 What We Built 1. Platform Services: a team 2. Pulsar: a broker deployment 3. StreamNative: a support relationship 4. Chariot: an asynchronous application framework
  • 13. ORM for Pulsar Interactions for tenant in Tenant.search(name="standalone"): if tenant.allowed_clusters == ["standalone"]: ns = Namespace( tenant=tenant, name="mynamespace", acknowledged_quota=AcknowledgedMessageQuota(age=timedelta(minutes=10)), ) ns.create() topic = Topic( namespace=ns, name="mytopic" ) topic.create() subscription = Subscription( topic=topic, name="mysubscription", type=SubscriptionType.KeyShared, ) subscription.create() assert Subscription.get(name="mysubscription") == subscription consumer = subscription.consumer(name="myconsumer").connect() while True: message = consumer.receive() consumer.acknowledge(message)
  • 14. Declarative API for Schema Management & Migrations from klaviyo_schema.registry.teamname.data.payload_pb2 import PayloadProto my_topic = ChariotTopic( name="demo", durability=Durability.DURABILITY_REDUNDANT, max_message_size="1kb", max_producers=100, max_consumers=10, publish_rate_limits=( RateLimit( messages=1000, period="1m", actions=[RateLimitAction.RATE_LIMIT_ACTION_BLOCK], ), ), thresholds=( Threshold( kind=ThresholdKind.THRESHOLD_KIND_UNACKNOWLEDGED, size="200mb", actions=[ThresholdAction.THRESHOLD_FAIL_PUBLISH], ), ), consumer_groups=(ConsumerGroup(name="demo-consumer-group", type=SubscriptionType.KeyShared),), payload=RegisteredPayloadFromClass(payload_class=PayloadProto), )
  • 15. Existing API: Producers from app.tasks import mytask # Synchronous call: mytask("arg1", "arg2", kwarg1=SomeObject()) # Asynchronous call: mytask.apply_async(args=("arg1", "arg2"), kwargs={"kwarg1": SomeObject()}) @celery.task(acks_late=True) def mytask(arg1, arg2, kwarg1=None): ... @celery.task(acks_late=True) def mytask2(*args, **kwargs): ... Existing API: Consumer Workload Declaration
  • 16. New API: Producers class DemoExecutor(AsynchronousExecutor): @lifecycle_method(timeout=timedelta(seconds=10)) async def on_executor_shutdown_requested(self): ... @lifecycle_method(timeout=timedelta(seconds=10)) async def on_executor_shutdown(self): ... @lifecycle_method(timeout=timedelta(seconds=10)) async def on_executor_startup(self): ... @lifecycle_method(timeout=timedelta(seconds=10)) async def on_message_batch(self, messages: Sequence[PayloadProto]): for idx, msg in enumerate(messages): if idx % 2 == 0: await self.chariot_ack(msg) else: await self.chariot_reject(msg) from klaviyo_schema.registry.teamname.data.payload_pb2 import PayloadProto from klaviyo_schema.registry.teamname.topics import my_topic await my_topic.send(PayloadProto(...)) New API: Consumer Workload Declaration
  • 17. Back-Of-Queue Retries class DemoExecutor(AsynchronousExecutor): @lifecycle_method(timeout=timedelta(seconds=10)) @requeue_retry( batch_predicate=retry_on_exception_type( RetryException, retry_log_level=logging.INFO ), message_predicate=retry_until_approximate_attempt_count(10), delay=wait_exponential(max=timedelta(seconds=5)) + timedelta(seconds=1), ) async def on_message_batch(self, messages: Sequence[PayloadProto]): raise RetryException("Expected retry") ~> chariot worker start --topic demo --consumer-group democg --parallel 10 --start-executors-lazily --executor-class app.executors.demo:DemoExecutor --message-batch-assignment-behavior AnyKeyToAnyExecutor ~> chariot worker start --topic demo --consumer-group democg --parallel 10 --start-executors-lazily --executor-class app.executors.demo:DemoExecutor --message-batch-assignment-behavior NoOverlapBestEffortKeyExecutorAffinity --message-batch-flush-after-items 1000 --message-batch-flush-after-time 10sec Custom Batching and “Steering” for Parallel Execution without Reordering
  • 18. 18 2022 © Klaviyo Confidential Problems Solutions Reliability Scalability Ownership/Process Architectural
  • 19. 19 2022 © Klaviyo Confidential Solutions Reliability To become a user is to express the enforced maximum workload you’ll run. Pulsar’s redundancy helps weather outages. Deep backlogs are usable because reads aren’t always writes. Scalability Ownership/Process Architectural
  • 20. 20 2022 © Klaviyo Confidential Solutions Reliability Scalability The “CEO” (Central Expert Owner) can scale out pulsar to respond to demand. Teams express scalability need in the form of elevated rate limits or partition counts. Consultation with the community and StreamNative is invaluable. Ownership/Process Architectural
  • 21. 21 2022 © Klaviyo Confidential Solutions Reliability Scalability Ownership/Process Teams own producers/consumers. Teams submit their contracts, in the form of schema PRs, to the broker owners. Schema changes and backwards compatibility aren’t simple but they are now predictable. Architectural
  • 22. 22 2022 © Klaviyo Confidential Solutions Reliability Scalability Ownership/Process Architectural Many new patterns are now on the table: - Pub-sub - Ordered consume - Batched consumption + out-of-order acks - Deduplication/debouncing Reading topics at rest improves visibility. Async interaction with the same stream from multiple codebases is now possible.
  • 23. 03 Challenges ● Distribution as a library/framework rather than an application ● Python/C++ Pulsar client maturity ● Combining advanced broker features surfaced bugs ● Forking consumer daemons + threaded clients + async/await style is a costly combination ● Expectation management ● The “gap ledger” ● Management API quality
  • 24. 04 What Worked Well Process: ● Support from above ● Managed rollout speed ● Solving 2025’s problems, not 2022’s ● “Steel-thread” style focus on specific use-cases ● Willingness to commit to bring work in-house and start fresh where it made sense Technology: ● Declarative schemas for messages and dataflows ● Schema registry as code rather than a SPOF ● Managed Pulsar allows us to learn with less pain ● Isolating user code from consumer code improves reliability
  • 25. 05 What’s Next? Near Term: ● Manage internal adoption ● Scale to meet annual shopping holidays’ needs ● Start work on a “publish gateway” for connection pooling, circuit breaking, etc. Long Term: ● Online schema changes ● Key-local state ● Complex workflow support ● Make our work available to the community