SlideShare a Scribd company logo
1 of 86
Download to read offline
16 x 9
Streaming Your Way to Web Scale: Scaling
Bitly via Stream-Based Processing!
All Things Open!
October 23, 2014, 4:15pm
85	
  slides	
  
23	
  Images	
  
21	
  diagrams
Peter Herndon!
peter@bit.ly!
@tpherndon
backend developer for Bitly
Scaling Bitly via Stream-Based Processing
or
Streaming Your Way to Web Scale
http://www.mongodb-is-web-scale.com/!
(**NSFW due to language)
Define streaming — public API surface that puts events into message queues that
are consumed by web services
Need to be asynchronous
we use Tornado
and Go
we had an older queue, but replaced it with a newer one.
written in Go
command v. event messages
Notification of an event
allows interested listeners to respond as they require
λ
Lambda architecture - batch + stream processing
Part Two, NSQ
NSQ
http://nsq.io
Look, Ma, real code!
https://github.com/bitly/nsq
https://github.com/bitly/go-nsq
https://github.com/bitly/pynsq
https://github.com/jehiah/nsqauth-contrib
Servers!
• nsqd!
• nsqlookupd!
• nsqadmin!
• pynsqauthd
Parts is parts! (part 1)
Clients!
• go-nsq!
• pynsq
Parts is parts! (part 2)
Utilities!
• nsq_tail!
• nsq_to_file!
• nsq_to_nsq!
• nsq_stat
Parts is parts! (part 3)
two basic building blocks of distributed NSQ
nsqd & nsqlookupd
put into context, look at evolution of a website
Basic Web App
Web App
Database
Basic web app. In Python, Django + Postgres, Flask + Postgres, Tornado + Postgres
Scaling the Mountain (of Load)
Web App
Database
Web App Web App
First bottleneck: web layer
Cache Rules Everything Around Me
Database
Web AppWeb AppWeb App
Cache
Remove web layer bottleneck, next is DB, so add caching
layer
You Want Me to Replicate You
Database
Database
Web AppWeb AppWeb App
Cache
Works for a while, but DB requests still take too long, so
replicate
Shards Here, Shards There
Web AppWeb AppWeb App
Cache
Database
DatabaseDatabase
Database
Database
Database
…and then shard
It’s Off to Work I Go!
Database
Web App
Cache
Queue
Worker
But individual requests still take too long, because doing too much work. So add message
queue and worker. In Python, Celery
Message From a Bottle(.py)
Database
Web App
Cache
Queue
Worker
Web app sends messages to queue
Working the Event
Database
Web App
Cache
Queue
Worker
Worker pulls message off queue and processes
Write Here, Write Now
Database
Web App
Cache
Queue
Worker
Worker writes results to database, file system, etc.
Write Here, Write Now (redux)
Web App
Database
Worker
Queue
Instead, imagine worker writes results
Sending Out an SMS
Web App
Database
Worker
Queue
and web app writes event messages to queue local to the web service
Listen, listen, LISTEN
Web App
Database
Worker
Queue
Queue
but worker is listening to a queue running on another server
Workin’ On a Chain(ed) Gang
Web App
Database
Worker
Queue
Web App
Database
Worker
Queue
Web App
Database
Worker
Queue
Look it up!
Web App
Database
Worker
Queue
Queue
Worker finds queue with topic via nsqlookupd
if	
  __name__	
  ==	
  "__main__":	
  
	
  	
  	
  	
  tornado.options.parse_command_line()	
  
	
  	
  	
  	
  logatron_client.setup()	
  
	
  	
  	
  	
  	
  
	
  	
  	
  	
  Reader(	
  
	
  	
  	
  	
  	
  	
  	
  	
  topic=settings.get('nsqd_output_topic'),	
  
	
  	
  	
  	
  	
  	
  	
  	
  channel='queuereader_spam_metrics',	
  
	
  	
  	
  	
  	
  	
  	
  	
  validate_method=validate_message,	
  
	
  	
  	
  	
  	
  	
  	
  	
  message_handler=count_spam_actions,	
  
	
  	
  	
  	
  	
  	
  	
  	
  lookupd_http_addresses=settings.get('nsq_lookupd')	
  
	
  	
  	
  	
  )	
  
	
  	
  	
  	
  run()
/<service>/queuereader_<service>.py
How do I find things?
Sending Out an SMS
Web App
Database
Worker
Queue
topic: ‘spam_api’
First time app writes to a TOPIC in the local nsqd
Sending Out an SMS
Web App
Database
Worker
Queue
topic: ‘spam_api’
nsqlookupd
nsqd creates the topic and registers it with nsqlookupd
Where Am I Again?
Web App
Database
Worker
nsqd
topic: 'spam_counter'
nsqd
topic: 'spam_api'
nsqlookupd
topic: 'spam_api'?
Worker in another service looking for a topic asks nsqlookupd, replies with
address
Talkin’ ‘Bout Something
Web App
Database
Worker
nsqd
topic: 'spam_counter'
nsqd
topic: 'spam_api'
channel: 'spam_counter'
queuereader connects to nsqd, registers a channel
Cross-Town Traffic
nsqd
topic: 'spam_api'
Worker Worker Worker
channel: 'spam_counter'
messages are divided by # of subscribers to a channel; allows horizontal
scaling
Channeling the Ghost
nsqd
topic: 'spam_api'
Worker Worker Worker
channel: 'spam_counter'
Worker
channel: 'nsq_to_file''
full copy of all messages to each channel
nsqadmin
nsqadmin
How we manage our message queues
nsqadmin
nsqadmin
pynsqauthd
It’s made of PEOPLE!
https://github.com/jehiah/nsqauth-contrib
pynsq client
It’s still made of PEOPLE!
https://github.com/bitly/pynsq
• settings.py!
• <service>_api.py!
• queuereader_<service>.py!
• README.md
/<service>
Queuereaders are part of streaming architecture
if	
  __name__	
  ==	
  "__main__":	
  
	
  	
  	
  	
  tornado.options.parse_command_line()	
  
	
  	
  	
  	
  logatron_client.setup()	
  
	
  	
  	
  	
  	
  
	
  	
  	
  	
  Reader(	
  
	
  	
  	
  	
  	
  	
  	
  	
  topic=settings.get('nsqd_output_topic'),	
  
	
  	
  	
  	
  	
  	
  	
  	
  channel='queuereader_spam_metrics',	
  
	
  	
  	
  	
  	
  	
  	
  	
  validate_method=validate_message,	
  
	
  	
  	
  	
  	
  	
  	
  	
  message_handler=count_spam_actions,	
  
	
  	
  	
  	
  	
  	
  	
  	
  lookupd_http_addresses=settings.get('nsq_lookupd')	
  
	
  	
  	
  )	
  
	
  	
  	
  	
  run()
/<service>/queuereader_<service>.py, 1 of 4
if	
  __name__	
  ==	
  "__main__":	
  
	
  	
  	
  	
  tornado.options.parse_command_line()	
  
	
  	
  	
  	
  logatron_client.setup()	
  
	
  	
  	
  	
  	
  
	
  	
  	
  	
  Reader(	
  
	
  	
  	
  	
  	
  	
  	
  	
  topic=settings.get('nsqd_output_topic'),	
  
	
  	
  	
  	
  	
  	
  	
  	
  channel='queuereader_spam_metrics',	
  
	
  	
  	
  	
  	
  	
  	
  	
  validate_method=validate_message,	
  
	
  	
  	
  	
  	
  	
  	
  	
  message_handler=count_spam_actions,	
  
	
  	
  	
  	
  	
  	
  	
  	
  lookupd_http_addresses=settings.get('nsq_lookupd')	
  
	
  	
  	
  )	
  
	
  	
  	
  	
  run()
/<service>/queuereader_<service>.py, 1 of 4
def	
  validate_message(message):	
  
	
  	
  	
  	
  if	
  message.get('o')	
  ==	
  '+'	
  and	
  message.get('l'):	
  
	
  	
  	
  	
  	
  	
  	
  	
  return	
  True	
  
	
  	
  	
  	
  if	
  message.get('o')	
  ==	
  '-­‐'	
  and	
  message.get('l')	
  
	
   	
   	
  	
  	
  and	
  message.get('bl'):	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
   return	
  True	
  
	
  	
  	
  	
  return	
  False
/<service>/queuereader_<service>.py, 2 of 4
if	
  __name__	
  ==	
  "__main__":	
  
	
  	
  	
  	
  tornado.options.parse_command_line()	
  
	
  	
  	
  	
  logatron_client.setup()	
  
	
  	
  	
  	
  	
  
	
  	
  	
  	
  Reader(	
  
	
  	
  	
  	
  	
  	
  	
  	
  topic=settings.get('nsqd_output_topic'),	
  
	
  	
  	
  	
  	
  	
  	
  	
  channel='queuereader_spam_metrics',	
  
	
  	
  	
  	
  	
  	
  	
  	
  validate_method=validate_message,	
  
	
  	
  	
  	
  	
  	
  	
  	
  message_handler=count_spam_actions,	
  
	
  	
  	
  	
  	
  	
  	
  	
  lookupd_http_addresses=settings.get('nsq_lookupd')	
  
	
  	
  	
  )	
  
	
  	
  	
  	
  run()
/<service>/queuereader_<service>.py, 1 of 4
def	
  count_spam_actions(message,	
  nsq_msg):	
  
	
  	
  	
  	
  key_section	
  =	
  statsd_keys[message['o']]	
  
	
  	
  	
  	
  key	
  =	
  key_section.get(message['l'],	
  key_section['default'])	
  
	
  	
  	
  	
  statsd.incr(key)	
  
	
  	
  	
  	
  	
  
	
  	
  	
  	
  if	
  key	
  ==	
  'remove_by_manual':	
  
	
  	
  	
  	
  	
  	
  	
  	
  key_section	
  =	
  statsd_keys['-­‐manual']	
  
	
  	
  	
  	
  	
  	
  	
  	
  key	
  =	
  key_section.get(message['bl'],	
  key_section['default'])	
  
	
  	
  	
  	
  	
  	
  	
  	
  statsd.incr(key)	
  
	
  	
  	
  	
  	
  
	
  	
  	
  	
  return	
  nsq_msg.finish()
/<service>/queuereader_<service>.py, 3 of 4
def	
  count_spam_actions(message,	
  nsq_msg):	
  
	
  	
  	
  	
  key_section	
  =	
  statsd_keys[message['o']]	
  
	
  	
  	
  	
  key	
  =	
  key_section.get(message['l'],	
  key_section['default'])	
  
	
  	
  	
  	
  statsd.incr(key)	
  
	
  	
  	
  	
  	
  
	
  	
  	
  	
  if	
  key	
  ==	
  'remove_by_manual':	
  
	
  	
  	
  	
  	
  	
  	
  	
  key_section	
  =	
  statsd_keys['-­‐manual']	
  
	
  	
  	
  	
  	
  	
  	
  	
  key	
  =	
  key_section.get(message['bl'],	
  key_section['default'])	
  
	
  	
  	
  	
  	
  	
  	
  	
  statsd.incr(key)	
  
	
  	
  	
  	
  	
  
	
  	
  	
  	
  return	
  nsq_msg.finish()
/<service>/queuereader_<service>.py, 3 of 4
if	
  __name__	
  ==	
  "__main__":	
  
	
  	
  	
  	
  tornado.options.parse_command_line()	
  
	
  	
  	
  	
  logatron_client.setup()	
  
	
  	
  	
  	
  	
  
	
  	
  	
  	
  Reader(	
  
	
  	
  	
  	
  	
  	
  	
  	
  topic=settings.get('nsqd_output_topic'),	
  
	
  	
  	
  	
  	
  	
  	
  	
  channel='queuereader_spam_metrics',	
  
	
  	
  	
  	
  	
  	
  	
  	
  validate_method=validate_message,	
  
	
  	
  	
  	
  	
  	
  	
  	
  message_handler=count_spam_actions,	
  
	
  	
  	
  	
  	
  	
  	
  	
  lookupd_http_addresses=settings.get('nsq_lookupd')	
  
	
  	
  	
  )	
  
	
  	
  	
  	
  run()
/<service>/queuereader_<service>.py, 4 of 4
if	
  __name__	
  ==	
  "__main__":	
  
	
  	
  	
  	
  tornado.options.parse_command_line()	
  
	
  	
  	
  	
  logatron_client.setup()	
  
	
  	
  	
  	
  	
  
	
  	
  	
  	
  Reader(	
  
	
  	
  	
  	
  	
  	
  	
  	
  topic=settings.get('nsqd_output_topic'),	
  
	
  	
  	
  	
  	
  	
  	
  	
  channel='queuereader_spam_metrics',	
  
	
  	
  	
  	
  	
  	
  	
  	
  validate_method=validate_message,	
  
	
  	
  	
  	
  	
  	
  	
  	
  message_handler=count_spam_actions,	
  
	
  	
  	
  	
  	
  	
  	
  	
  lookupd_http_addresses=settings.get('nsq_lookupd')	
  
	
  	
  	
  )	
  
	
  	
  	
  	
  run()
/<service>/queuereader_<service>.py, 4 of 4
utilities
nsq_tail!
nsq_to_file!
to_nsq!
nsq_to_nsq!
nsq_stat
Parts is parts! (part 3, redux)
Features & Guarantees!
(aka Trade-Offs)
Distributed, No SPOF || Horizontally Scalable || TLS || statsd integration || Easy to Deploy || Cluster
Administration
Messages NOT Durable
Delivered at least once
Un-ordered Delivery
Eventually-Consistent
Discovery
A Thousand Points of Light (well, 58)
A Thousand Points of Light (well, 58)
Whoa…
8.2 billion decodes per month
Streaming Architecture
Easy to build new services
Easy to scale individual components horizontally
Durable in the face of single component failure
Distributed
THINGS TO THINK ABOUT
Monitoring, monitoring, monitoring
Failure modes — how can things fail? How does your application as a whole handle the failure of individual components?
Measurement — metrics show the range
Timeouts — connection timeouts, DNS timeouts — a slow network is the same as a failed service
NSQ
http://nsq.io
Duke of URL
https://github.com/bitly/nsq
https://github.com/bitly/go-nsq
https://github.com/bitly/pynsq
https://github.com/jehiah/nsqauth-contrib
Web Scale - http://www.mongodb-is-web-scale.com!
Waterfall - https://www.flickr.com/photos/desatur8/14949285342!
Tornado - https://www.flickr.com/photos/indigente/798304!
John de Lancie - https://www.flickr.com/photos/cayusa/1394930005!
Ben Whishaw - https://www.flickr.com/photos/rossendalewadey/6032496676!
Command Key - https://www.flickr.com/photos/klash/3175479797!
iPhone6 Event - https://www.flickr.com/photos/notionscapital/15067798867!
Wait for iPhone - https://www.flickr.com/photos/josh_gray/662814907!
NSQ Logo - http://nsq.io!
!
All other photos by T. Peter Herndon!
!
Photo Credits
Questions?
Peter Herndon!
peter@bit.ly!
@tpherndon

More Related Content

What's hot

服务框架: Thrift & PasteScript
服务框架: Thrift & PasteScript服务框架: Thrift & PasteScript
服务框架: Thrift & PasteScriptQiangning Hong
 
Mongodb connection string
Mongodb connection stringMongodb connection string
Mongodb connection stringPravin Dwiwedi
 
From A to Z | WireShark Tutorial
From A to Z | WireShark TutorialFrom A to Z | WireShark Tutorial
From A to Z | WireShark TutorialTurkHackTeam EDU
 
Using ngx_lua in UPYUN
Using ngx_lua in UPYUNUsing ngx_lua in UPYUN
Using ngx_lua in UPYUNCong Zhang
 
Devinsampa nginx-scripting
Devinsampa nginx-scriptingDevinsampa nginx-scripting
Devinsampa nginx-scriptingTony Fabeen
 
Introduction to Cassandra
Introduction to CassandraIntroduction to Cassandra
Introduction to Cassandraaaronmorton
 
Apache Cassandra, part 1 – principles, data model
Apache Cassandra, part 1 – principles, data modelApache Cassandra, part 1 – principles, data model
Apache Cassandra, part 1 – principles, data modelAndrey Lomakin
 
Roll Your Own API Management Platform with nginx and Lua
Roll Your Own API Management Platform with nginx and LuaRoll Your Own API Management Platform with nginx and Lua
Roll Your Own API Management Platform with nginx and LuaJon Moore
 
Nagios Conference 2014 - Rodrigo Faria - Developing your Plugin
Nagios Conference 2014 - Rodrigo Faria - Developing your PluginNagios Conference 2014 - Rodrigo Faria - Developing your Plugin
Nagios Conference 2014 - Rodrigo Faria - Developing your PluginNagios
 
Norikra in Action (ver. 2014 spring)
Norikra in Action (ver. 2014 spring)Norikra in Action (ver. 2014 spring)
Norikra in Action (ver. 2014 spring)SATOSHI TAGOMORI
 
Service discovery and configuration provisioning
Service discovery and configuration provisioningService discovery and configuration provisioning
Service discovery and configuration provisioningSource Ministry
 
NoSQL and SQL Anti Patterns
NoSQL and SQL Anti PatternsNoSQL and SQL Anti Patterns
NoSQL and SQL Anti PatternsGleicon Moraes
 
Scoobi - Scala for Startups
Scoobi - Scala for StartupsScoobi - Scala for Startups
Scoobi - Scala for Startupsbmlever
 
Norikra: SQL Stream Processing In Ruby
Norikra: SQL Stream Processing In RubyNorikra: SQL Stream Processing In Ruby
Norikra: SQL Stream Processing In RubySATOSHI TAGOMORI
 

What's hot (19)

服务框架: Thrift & PasteScript
服务框架: Thrift & PasteScript服务框架: Thrift & PasteScript
服务框架: Thrift & PasteScript
 
Mongodb connection string
Mongodb connection stringMongodb connection string
Mongodb connection string
 
Dynomite Nosql
Dynomite NosqlDynomite Nosql
Dynomite Nosql
 
Python database interfaces
Python database  interfacesPython database  interfaces
Python database interfaces
 
From A to Z | WireShark Tutorial
From A to Z | WireShark TutorialFrom A to Z | WireShark Tutorial
From A to Z | WireShark Tutorial
 
DPNHTW
DPNHTWDPNHTW
DPNHTW
 
Using ngx_lua in UPYUN
Using ngx_lua in UPYUNUsing ngx_lua in UPYUN
Using ngx_lua in UPYUN
 
Devinsampa nginx-scripting
Devinsampa nginx-scriptingDevinsampa nginx-scripting
Devinsampa nginx-scripting
 
Introduction to Cassandra
Introduction to CassandraIntroduction to Cassandra
Introduction to Cassandra
 
Apache Cassandra, part 1 – principles, data model
Apache Cassandra, part 1 – principles, data modelApache Cassandra, part 1 – principles, data model
Apache Cassandra, part 1 – principles, data model
 
Roll Your Own API Management Platform with nginx and Lua
Roll Your Own API Management Platform with nginx and LuaRoll Your Own API Management Platform with nginx and Lua
Roll Your Own API Management Platform with nginx and Lua
 
Nagios Conference 2014 - Rodrigo Faria - Developing your Plugin
Nagios Conference 2014 - Rodrigo Faria - Developing your PluginNagios Conference 2014 - Rodrigo Faria - Developing your Plugin
Nagios Conference 2014 - Rodrigo Faria - Developing your Plugin
 
minor final
minor finalminor final
minor final
 
Norikra in Action (ver. 2014 spring)
Norikra in Action (ver. 2014 spring)Norikra in Action (ver. 2014 spring)
Norikra in Action (ver. 2014 spring)
 
Service discovery and configuration provisioning
Service discovery and configuration provisioningService discovery and configuration provisioning
Service discovery and configuration provisioning
 
NoSQL and SQL Anti Patterns
NoSQL and SQL Anti PatternsNoSQL and SQL Anti Patterns
NoSQL and SQL Anti Patterns
 
Kamailio and VoIP Wild World
Kamailio and VoIP Wild WorldKamailio and VoIP Wild World
Kamailio and VoIP Wild World
 
Scoobi - Scala for Startups
Scoobi - Scala for StartupsScoobi - Scala for Startups
Scoobi - Scala for Startups
 
Norikra: SQL Stream Processing In Ruby
Norikra: SQL Stream Processing In RubyNorikra: SQL Stream Processing In Ruby
Norikra: SQL Stream Processing In Ruby
 

Similar to Streaming Way to Webscale: How We Scale Bitly via Streaming

fog or: How I Learned to Stop Worrying and Love the Cloud
fog or: How I Learned to Stop Worrying and Love the Cloudfog or: How I Learned to Stop Worrying and Love the Cloud
fog or: How I Learned to Stop Worrying and Love the CloudWesley Beary
 
fog or: How I Learned to Stop Worrying and Love the Cloud (OpenStack Edition)
fog or: How I Learned to Stop Worrying and Love the Cloud (OpenStack Edition)fog or: How I Learned to Stop Worrying and Love the Cloud (OpenStack Edition)
fog or: How I Learned to Stop Worrying and Love the Cloud (OpenStack Edition)Wesley Beary
 
Mt logging with_bam
Mt logging with_bamMt logging with_bam
Mt logging with_bamAmani Soysa
 
Building a High-Performance Distributed Task Queue on MongoDB
Building a High-Performance Distributed Task Queue on MongoDBBuilding a High-Performance Distributed Task Queue on MongoDB
Building a High-Performance Distributed Task Queue on MongoDBMongoDB
 
Swift distributed tracing method and tools v2
Swift distributed tracing method and tools v2Swift distributed tracing method and tools v2
Swift distributed tracing method and tools v2zhang hua
 
Small pieces loosely joined
Small pieces loosely joinedSmall pieces loosely joined
Small pieces loosely joinedennui2342
 
2 years with python and serverless
2 years with python and serverless2 years with python and serverless
2 years with python and serverlessHector Canto
 
Apidays Paris 2023 - Forget TypeScript, Choose Rust to build Robust, Fast and...
Apidays Paris 2023 - Forget TypeScript, Choose Rust to build Robust, Fast and...Apidays Paris 2023 - Forget TypeScript, Choose Rust to build Robust, Fast and...
Apidays Paris 2023 - Forget TypeScript, Choose Rust to build Robust, Fast and...apidays
 
Timeseries - data visualization in Grafana
Timeseries - data visualization in GrafanaTimeseries - data visualization in Grafana
Timeseries - data visualization in GrafanaOCoderFest
 
WSO2 Product Release Webinar: WSO2 Complex Event Processor 4.0
WSO2 Product Release Webinar: WSO2 Complex Event Processor 4.0WSO2 Product Release Webinar: WSO2 Complex Event Processor 4.0
WSO2 Product Release Webinar: WSO2 Complex Event Processor 4.0WSO2
 
How I Learned to Stop Worrying and Love the Cloud - Wesley Beary, Engine Yard
How I Learned to Stop Worrying and Love the Cloud - Wesley Beary, Engine YardHow I Learned to Stop Worrying and Love the Cloud - Wesley Beary, Engine Yard
How I Learned to Stop Worrying and Love the Cloud - Wesley Beary, Engine YardSV Ruby on Rails Meetup
 
Pemrograman Python untuk Pemula
Pemrograman Python untuk PemulaPemrograman Python untuk Pemula
Pemrograman Python untuk PemulaOon Arfiandwi
 
Swift profiling middleware and tools
Swift profiling middleware and toolsSwift profiling middleware and tools
Swift profiling middleware and toolszhang hua
 
OSA Con 2022: Streaming Data Made Easy
OSA Con 2022:  Streaming Data Made EasyOSA Con 2022:  Streaming Data Made Easy
OSA Con 2022: Streaming Data Made EasyTimothy Spann
 
OSA Con 2022 - Streaming Data Made Easy - Tim Spann & David Kjerrumgaard - St...
OSA Con 2022 - Streaming Data Made Easy - Tim Spann & David Kjerrumgaard - St...OSA Con 2022 - Streaming Data Made Easy - Tim Spann & David Kjerrumgaard - St...
OSA Con 2022 - Streaming Data Made Easy - Tim Spann & David Kjerrumgaard - St...Altinity Ltd
 
How I Built a Power Debugger Out of the Standard Library and Things I Found o...
How I Built a Power Debugger Out of the Standard Library and Things I Found o...How I Built a Power Debugger Out of the Standard Library and Things I Found o...
How I Built a Power Debugger Out of the Standard Library and Things I Found o...doughellmann
 
Assignment 4.pdf
Assignment 4.pdfAssignment 4.pdf
Assignment 4.pdfdash41
 

Similar to Streaming Way to Webscale: How We Scale Bitly via Streaming (20)

fog or: How I Learned to Stop Worrying and Love the Cloud
fog or: How I Learned to Stop Worrying and Love the Cloudfog or: How I Learned to Stop Worrying and Love the Cloud
fog or: How I Learned to Stop Worrying and Love the Cloud
 
fog or: How I Learned to Stop Worrying and Love the Cloud (OpenStack Edition)
fog or: How I Learned to Stop Worrying and Love the Cloud (OpenStack Edition)fog or: How I Learned to Stop Worrying and Love the Cloud (OpenStack Edition)
fog or: How I Learned to Stop Worrying and Love the Cloud (OpenStack Edition)
 
Mt logging with_bam
Mt logging with_bamMt logging with_bam
Mt logging with_bam
 
Pycon - Python for ethical hackers
Pycon - Python for ethical hackers Pycon - Python for ethical hackers
Pycon - Python for ethical hackers
 
Building a High-Performance Distributed Task Queue on MongoDB
Building a High-Performance Distributed Task Queue on MongoDBBuilding a High-Performance Distributed Task Queue on MongoDB
Building a High-Performance Distributed Task Queue on MongoDB
 
Swift distributed tracing method and tools v2
Swift distributed tracing method and tools v2Swift distributed tracing method and tools v2
Swift distributed tracing method and tools v2
 
Small pieces loosely joined
Small pieces loosely joinedSmall pieces loosely joined
Small pieces loosely joined
 
CGI.ppt
CGI.pptCGI.ppt
CGI.ppt
 
2 years with python and serverless
2 years with python and serverless2 years with python and serverless
2 years with python and serverless
 
Apidays Paris 2023 - Forget TypeScript, Choose Rust to build Robust, Fast and...
Apidays Paris 2023 - Forget TypeScript, Choose Rust to build Robust, Fast and...Apidays Paris 2023 - Forget TypeScript, Choose Rust to build Robust, Fast and...
Apidays Paris 2023 - Forget TypeScript, Choose Rust to build Robust, Fast and...
 
Timeseries - data visualization in Grafana
Timeseries - data visualization in GrafanaTimeseries - data visualization in Grafana
Timeseries - data visualization in Grafana
 
WSO2 Product Release Webinar: WSO2 Complex Event Processor 4.0
WSO2 Product Release Webinar: WSO2 Complex Event Processor 4.0WSO2 Product Release Webinar: WSO2 Complex Event Processor 4.0
WSO2 Product Release Webinar: WSO2 Complex Event Processor 4.0
 
How I Learned to Stop Worrying and Love the Cloud - Wesley Beary, Engine Yard
How I Learned to Stop Worrying and Love the Cloud - Wesley Beary, Engine YardHow I Learned to Stop Worrying and Love the Cloud - Wesley Beary, Engine Yard
How I Learned to Stop Worrying and Love the Cloud - Wesley Beary, Engine Yard
 
Pemrograman Python untuk Pemula
Pemrograman Python untuk PemulaPemrograman Python untuk Pemula
Pemrograman Python untuk Pemula
 
Streams in Node.js
Streams in Node.jsStreams in Node.js
Streams in Node.js
 
Swift profiling middleware and tools
Swift profiling middleware and toolsSwift profiling middleware and tools
Swift profiling middleware and tools
 
OSA Con 2022: Streaming Data Made Easy
OSA Con 2022:  Streaming Data Made EasyOSA Con 2022:  Streaming Data Made Easy
OSA Con 2022: Streaming Data Made Easy
 
OSA Con 2022 - Streaming Data Made Easy - Tim Spann & David Kjerrumgaard - St...
OSA Con 2022 - Streaming Data Made Easy - Tim Spann & David Kjerrumgaard - St...OSA Con 2022 - Streaming Data Made Easy - Tim Spann & David Kjerrumgaard - St...
OSA Con 2022 - Streaming Data Made Easy - Tim Spann & David Kjerrumgaard - St...
 
How I Built a Power Debugger Out of the Standard Library and Things I Found o...
How I Built a Power Debugger Out of the Standard Library and Things I Found o...How I Built a Power Debugger Out of the Standard Library and Things I Found o...
How I Built a Power Debugger Out of the Standard Library and Things I Found o...
 
Assignment 4.pdf
Assignment 4.pdfAssignment 4.pdf
Assignment 4.pdf
 

More from All Things Open

Building Reliability - The Realities of Observability
Building Reliability - The Realities of ObservabilityBuilding Reliability - The Realities of Observability
Building Reliability - The Realities of ObservabilityAll Things Open
 
Modern Database Best Practices
Modern Database Best PracticesModern Database Best Practices
Modern Database Best PracticesAll Things Open
 
Open Source and Public Policy
Open Source and Public PolicyOpen Source and Public Policy
Open Source and Public PolicyAll Things Open
 
Weaving Microservices into a Unified GraphQL Schema with graph-quilt - Ashpak...
Weaving Microservices into a Unified GraphQL Schema with graph-quilt - Ashpak...Weaving Microservices into a Unified GraphQL Schema with graph-quilt - Ashpak...
Weaving Microservices into a Unified GraphQL Schema with graph-quilt - Ashpak...All Things Open
 
The State of Passwordless Auth on the Web - Phil Nash
The State of Passwordless Auth on the Web - Phil NashThe State of Passwordless Auth on the Web - Phil Nash
The State of Passwordless Auth on the Web - Phil NashAll Things Open
 
Total ReDoS: The dangers of regex in JavaScript
Total ReDoS: The dangers of regex in JavaScriptTotal ReDoS: The dangers of regex in JavaScript
Total ReDoS: The dangers of regex in JavaScriptAll Things Open
 
What Does Real World Mass Adoption of Decentralized Tech Look Like?
What Does Real World Mass Adoption of Decentralized Tech Look Like?What Does Real World Mass Adoption of Decentralized Tech Look Like?
What Does Real World Mass Adoption of Decentralized Tech Look Like?All Things Open
 
How to Write & Deploy a Smart Contract
How to Write & Deploy a Smart ContractHow to Write & Deploy a Smart Contract
How to Write & Deploy a Smart ContractAll Things Open
 
Spinning Your Drones with Cadence Workflows, Apache Kafka and TensorFlow
 Spinning Your Drones with Cadence Workflows, Apache Kafka and TensorFlow Spinning Your Drones with Cadence Workflows, Apache Kafka and TensorFlow
Spinning Your Drones with Cadence Workflows, Apache Kafka and TensorFlowAll Things Open
 
DEI Challenges and Success
DEI Challenges and SuccessDEI Challenges and Success
DEI Challenges and SuccessAll Things Open
 
Scaling Web Applications with Background
Scaling Web Applications with BackgroundScaling Web Applications with Background
Scaling Web Applications with BackgroundAll Things Open
 
Supercharging tutorials with WebAssembly
Supercharging tutorials with WebAssemblySupercharging tutorials with WebAssembly
Supercharging tutorials with WebAssemblyAll Things Open
 
Using SQL to Find Needles in Haystacks
Using SQL to Find Needles in HaystacksUsing SQL to Find Needles in Haystacks
Using SQL to Find Needles in HaystacksAll Things Open
 
Configuration Security as a Game of Pursuit Intercept
Configuration Security as a Game of Pursuit InterceptConfiguration Security as a Game of Pursuit Intercept
Configuration Security as a Game of Pursuit InterceptAll Things Open
 
Scaling an Open Source Sponsorship Program
Scaling an Open Source Sponsorship ProgramScaling an Open Source Sponsorship Program
Scaling an Open Source Sponsorship ProgramAll Things Open
 
Build Developer Experience Teams for Open Source
Build Developer Experience Teams for Open SourceBuild Developer Experience Teams for Open Source
Build Developer Experience Teams for Open SourceAll Things Open
 
Deploying Models at Scale with Apache Beam
Deploying Models at Scale with Apache BeamDeploying Models at Scale with Apache Beam
Deploying Models at Scale with Apache BeamAll Things Open
 
Sudo – Giving access while staying in control
Sudo – Giving access while staying in controlSudo – Giving access while staying in control
Sudo – Giving access while staying in controlAll Things Open
 
Fortifying the Future: Tackling Security Challenges in AI/ML Applications
Fortifying the Future: Tackling Security Challenges in AI/ML ApplicationsFortifying the Future: Tackling Security Challenges in AI/ML Applications
Fortifying the Future: Tackling Security Challenges in AI/ML ApplicationsAll Things Open
 
Securing Cloud Resources Deployed with Control Planes on Kubernetes using Gov...
Securing Cloud Resources Deployed with Control Planes on Kubernetes using Gov...Securing Cloud Resources Deployed with Control Planes on Kubernetes using Gov...
Securing Cloud Resources Deployed with Control Planes on Kubernetes using Gov...All Things Open
 

More from All Things Open (20)

Building Reliability - The Realities of Observability
Building Reliability - The Realities of ObservabilityBuilding Reliability - The Realities of Observability
Building Reliability - The Realities of Observability
 
Modern Database Best Practices
Modern Database Best PracticesModern Database Best Practices
Modern Database Best Practices
 
Open Source and Public Policy
Open Source and Public PolicyOpen Source and Public Policy
Open Source and Public Policy
 
Weaving Microservices into a Unified GraphQL Schema with graph-quilt - Ashpak...
Weaving Microservices into a Unified GraphQL Schema with graph-quilt - Ashpak...Weaving Microservices into a Unified GraphQL Schema with graph-quilt - Ashpak...
Weaving Microservices into a Unified GraphQL Schema with graph-quilt - Ashpak...
 
The State of Passwordless Auth on the Web - Phil Nash
The State of Passwordless Auth on the Web - Phil NashThe State of Passwordless Auth on the Web - Phil Nash
The State of Passwordless Auth on the Web - Phil Nash
 
Total ReDoS: The dangers of regex in JavaScript
Total ReDoS: The dangers of regex in JavaScriptTotal ReDoS: The dangers of regex in JavaScript
Total ReDoS: The dangers of regex in JavaScript
 
What Does Real World Mass Adoption of Decentralized Tech Look Like?
What Does Real World Mass Adoption of Decentralized Tech Look Like?What Does Real World Mass Adoption of Decentralized Tech Look Like?
What Does Real World Mass Adoption of Decentralized Tech Look Like?
 
How to Write & Deploy a Smart Contract
How to Write & Deploy a Smart ContractHow to Write & Deploy a Smart Contract
How to Write & Deploy a Smart Contract
 
Spinning Your Drones with Cadence Workflows, Apache Kafka and TensorFlow
 Spinning Your Drones with Cadence Workflows, Apache Kafka and TensorFlow Spinning Your Drones with Cadence Workflows, Apache Kafka and TensorFlow
Spinning Your Drones with Cadence Workflows, Apache Kafka and TensorFlow
 
DEI Challenges and Success
DEI Challenges and SuccessDEI Challenges and Success
DEI Challenges and Success
 
Scaling Web Applications with Background
Scaling Web Applications with BackgroundScaling Web Applications with Background
Scaling Web Applications with Background
 
Supercharging tutorials with WebAssembly
Supercharging tutorials with WebAssemblySupercharging tutorials with WebAssembly
Supercharging tutorials with WebAssembly
 
Using SQL to Find Needles in Haystacks
Using SQL to Find Needles in HaystacksUsing SQL to Find Needles in Haystacks
Using SQL to Find Needles in Haystacks
 
Configuration Security as a Game of Pursuit Intercept
Configuration Security as a Game of Pursuit InterceptConfiguration Security as a Game of Pursuit Intercept
Configuration Security as a Game of Pursuit Intercept
 
Scaling an Open Source Sponsorship Program
Scaling an Open Source Sponsorship ProgramScaling an Open Source Sponsorship Program
Scaling an Open Source Sponsorship Program
 
Build Developer Experience Teams for Open Source
Build Developer Experience Teams for Open SourceBuild Developer Experience Teams for Open Source
Build Developer Experience Teams for Open Source
 
Deploying Models at Scale with Apache Beam
Deploying Models at Scale with Apache BeamDeploying Models at Scale with Apache Beam
Deploying Models at Scale with Apache Beam
 
Sudo – Giving access while staying in control
Sudo – Giving access while staying in controlSudo – Giving access while staying in control
Sudo – Giving access while staying in control
 
Fortifying the Future: Tackling Security Challenges in AI/ML Applications
Fortifying the Future: Tackling Security Challenges in AI/ML ApplicationsFortifying the Future: Tackling Security Challenges in AI/ML Applications
Fortifying the Future: Tackling Security Challenges in AI/ML Applications
 
Securing Cloud Resources Deployed with Control Planes on Kubernetes using Gov...
Securing Cloud Resources Deployed with Control Planes on Kubernetes using Gov...Securing Cloud Resources Deployed with Control Planes on Kubernetes using Gov...
Securing Cloud Resources Deployed with Control Planes on Kubernetes using Gov...
 

Recently uploaded

Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphNeo4j
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?XfilesPro
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptxLBM Solutions
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 

Recently uploaded (20)

Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptx
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 

Streaming Way to Webscale: How We Scale Bitly via Streaming

  • 1. 16 x 9 Streaming Your Way to Web Scale: Scaling Bitly via Stream-Based Processing! All Things Open! October 23, 2014, 4:15pm 85  slides   23  Images   21  diagrams
  • 3. Scaling Bitly via Stream-Based Processing
  • 4. or
  • 5. Streaming Your Way to Web Scale
  • 6.
  • 8. Define streaming — public API surface that puts events into message queues that are consumed by web services
  • 9. Need to be asynchronous
  • 12. we had an older queue, but replaced it with a newer one.
  • 14. command v. event messages
  • 16. allows interested listeners to respond as they require
  • 17. λ Lambda architecture - batch + stream processing
  • 20. Look, Ma, real code! https://github.com/bitly/nsq https://github.com/bitly/go-nsq https://github.com/bitly/pynsq https://github.com/jehiah/nsqauth-contrib
  • 21. Servers! • nsqd! • nsqlookupd! • nsqadmin! • pynsqauthd Parts is parts! (part 1)
  • 23. Utilities! • nsq_tail! • nsq_to_file! • nsq_to_nsq! • nsq_stat Parts is parts! (part 3)
  • 24. two basic building blocks of distributed NSQ
  • 25. nsqd & nsqlookupd put into context, look at evolution of a website
  • 26. Basic Web App Web App Database Basic web app. In Python, Django + Postgres, Flask + Postgres, Tornado + Postgres
  • 27. Scaling the Mountain (of Load) Web App Database Web App Web App First bottleneck: web layer
  • 28. Cache Rules Everything Around Me Database Web AppWeb AppWeb App Cache Remove web layer bottleneck, next is DB, so add caching layer
  • 29. You Want Me to Replicate You Database Database Web AppWeb AppWeb App Cache Works for a while, but DB requests still take too long, so replicate
  • 30. Shards Here, Shards There Web AppWeb AppWeb App Cache Database DatabaseDatabase Database Database Database …and then shard
  • 31. It’s Off to Work I Go! Database Web App Cache Queue Worker But individual requests still take too long, because doing too much work. So add message queue and worker. In Python, Celery
  • 32. Message From a Bottle(.py) Database Web App Cache Queue Worker Web app sends messages to queue
  • 33. Working the Event Database Web App Cache Queue Worker Worker pulls message off queue and processes
  • 34. Write Here, Write Now Database Web App Cache Queue Worker Worker writes results to database, file system, etc.
  • 35. Write Here, Write Now (redux) Web App Database Worker Queue Instead, imagine worker writes results
  • 36. Sending Out an SMS Web App Database Worker Queue and web app writes event messages to queue local to the web service
  • 37. Listen, listen, LISTEN Web App Database Worker Queue Queue but worker is listening to a queue running on another server
  • 38. Workin’ On a Chain(ed) Gang Web App Database Worker Queue Web App Database Worker Queue Web App Database Worker Queue
  • 39. Look it up! Web App Database Worker Queue Queue Worker finds queue with topic via nsqlookupd
  • 40. if  __name__  ==  "__main__":          tornado.options.parse_command_line()          logatron_client.setup()                    Reader(                  topic=settings.get('nsqd_output_topic'),                  channel='queuereader_spam_metrics',                  validate_method=validate_message,                  message_handler=count_spam_actions,                  lookupd_http_addresses=settings.get('nsq_lookupd')          )          run() /<service>/queuereader_<service>.py How do I find things?
  • 41. Sending Out an SMS Web App Database Worker Queue topic: ‘spam_api’ First time app writes to a TOPIC in the local nsqd
  • 42. Sending Out an SMS Web App Database Worker Queue topic: ‘spam_api’ nsqlookupd nsqd creates the topic and registers it with nsqlookupd
  • 43. Where Am I Again? Web App Database Worker nsqd topic: 'spam_counter' nsqd topic: 'spam_api' nsqlookupd topic: 'spam_api'? Worker in another service looking for a topic asks nsqlookupd, replies with address
  • 44. Talkin’ ‘Bout Something Web App Database Worker nsqd topic: 'spam_counter' nsqd topic: 'spam_api' channel: 'spam_counter' queuereader connects to nsqd, registers a channel
  • 45. Cross-Town Traffic nsqd topic: 'spam_api' Worker Worker Worker channel: 'spam_counter' messages are divided by # of subscribers to a channel; allows horizontal scaling
  • 46. Channeling the Ghost nsqd topic: 'spam_api' Worker Worker Worker channel: 'spam_counter' Worker channel: 'nsq_to_file'' full copy of all messages to each channel
  • 47.
  • 49. nsqadmin How we manage our message queues
  • 52.
  • 54. It’s made of PEOPLE! https://github.com/jehiah/nsqauth-contrib
  • 55.
  • 56.
  • 57.
  • 59. It’s still made of PEOPLE! https://github.com/bitly/pynsq
  • 60. • settings.py! • <service>_api.py! • queuereader_<service>.py! • README.md /<service> Queuereaders are part of streaming architecture
  • 61. if  __name__  ==  "__main__":          tornado.options.parse_command_line()          logatron_client.setup()                    Reader(                  topic=settings.get('nsqd_output_topic'),                  channel='queuereader_spam_metrics',                  validate_method=validate_message,                  message_handler=count_spam_actions,                  lookupd_http_addresses=settings.get('nsq_lookupd')        )          run() /<service>/queuereader_<service>.py, 1 of 4
  • 62. if  __name__  ==  "__main__":          tornado.options.parse_command_line()          logatron_client.setup()                    Reader(                  topic=settings.get('nsqd_output_topic'),                  channel='queuereader_spam_metrics',                  validate_method=validate_message,                  message_handler=count_spam_actions,                  lookupd_http_addresses=settings.get('nsq_lookupd')        )          run() /<service>/queuereader_<service>.py, 1 of 4
  • 63. def  validate_message(message):          if  message.get('o')  ==  '+'  and  message.get('l'):                  return  True          if  message.get('o')  ==  '-­‐'  and  message.get('l')            and  message.get('bl'):                     return  True          return  False /<service>/queuereader_<service>.py, 2 of 4
  • 64. if  __name__  ==  "__main__":          tornado.options.parse_command_line()          logatron_client.setup()                    Reader(                  topic=settings.get('nsqd_output_topic'),                  channel='queuereader_spam_metrics',                  validate_method=validate_message,                  message_handler=count_spam_actions,                  lookupd_http_addresses=settings.get('nsq_lookupd')        )          run() /<service>/queuereader_<service>.py, 1 of 4
  • 65. def  count_spam_actions(message,  nsq_msg):          key_section  =  statsd_keys[message['o']]          key  =  key_section.get(message['l'],  key_section['default'])          statsd.incr(key)                    if  key  ==  'remove_by_manual':                  key_section  =  statsd_keys['-­‐manual']                  key  =  key_section.get(message['bl'],  key_section['default'])                  statsd.incr(key)                    return  nsq_msg.finish() /<service>/queuereader_<service>.py, 3 of 4
  • 66. def  count_spam_actions(message,  nsq_msg):          key_section  =  statsd_keys[message['o']]          key  =  key_section.get(message['l'],  key_section['default'])          statsd.incr(key)                    if  key  ==  'remove_by_manual':                  key_section  =  statsd_keys['-­‐manual']                  key  =  key_section.get(message['bl'],  key_section['default'])                  statsd.incr(key)                    return  nsq_msg.finish() /<service>/queuereader_<service>.py, 3 of 4
  • 67. if  __name__  ==  "__main__":          tornado.options.parse_command_line()          logatron_client.setup()                    Reader(                  topic=settings.get('nsqd_output_topic'),                  channel='queuereader_spam_metrics',                  validate_method=validate_message,                  message_handler=count_spam_actions,                  lookupd_http_addresses=settings.get('nsq_lookupd')        )          run() /<service>/queuereader_<service>.py, 4 of 4
  • 68. if  __name__  ==  "__main__":          tornado.options.parse_command_line()          logatron_client.setup()                    Reader(                  topic=settings.get('nsqd_output_topic'),                  channel='queuereader_spam_metrics',                  validate_method=validate_message,                  message_handler=count_spam_actions,                  lookupd_http_addresses=settings.get('nsq_lookupd')        )          run() /<service>/queuereader_<service>.py, 4 of 4
  • 69.
  • 72. Features & Guarantees! (aka Trade-Offs) Distributed, No SPOF || Horizontally Scalable || TLS || statsd integration || Easy to Deploy || Cluster Administration
  • 77. A Thousand Points of Light (well, 58)
  • 78. A Thousand Points of Light (well, 58)
  • 80. Streaming Architecture Easy to build new services Easy to scale individual components horizontally Durable in the face of single component failure Distributed
  • 81. THINGS TO THINK ABOUT Monitoring, monitoring, monitoring Failure modes — how can things fail? How does your application as a whole handle the failure of individual components? Measurement — metrics show the range Timeouts — connection timeouts, DNS timeouts — a slow network is the same as a failed service
  • 84. Web Scale - http://www.mongodb-is-web-scale.com! Waterfall - https://www.flickr.com/photos/desatur8/14949285342! Tornado - https://www.flickr.com/photos/indigente/798304! John de Lancie - https://www.flickr.com/photos/cayusa/1394930005! Ben Whishaw - https://www.flickr.com/photos/rossendalewadey/6032496676! Command Key - https://www.flickr.com/photos/klash/3175479797! iPhone6 Event - https://www.flickr.com/photos/notionscapital/15067798867! Wait for iPhone - https://www.flickr.com/photos/josh_gray/662814907! NSQ Logo - http://nsq.io! ! All other photos by T. Peter Herndon! ! Photo Credits