SlideShare a Scribd company logo
1 of 17
Download to read offline
AGNIAGNI
MESSAGING. ON FIRE.MESSAGING. ON FIRE.
RickDillon
Yep.⇧Thatdudeisagod.
WHY DO WE NEED MESSAGING?WHY DO WE NEED MESSAGING?
Web apps should be fast, so...
do work asynchronously!
And break out cross-cutting concerns into services
HOW DO SERVICES COMMUNICATE?HOW DO SERVICES COMMUNICATE?
HTTP, of course.
But then, two problems emerge:
Traffic can be bursty
Systems go down for maintenance
So we thought:
“ Wouldn't it be great if all the requests coming in
were queued somewhere? ”
So we built Agni.
DESIGNDESIGN
Agni is built around three principles:
Simplicity
Queuing
Priority
SIMPLICITYSIMPLICITY
One primitive: the queue. Avoid the complexities of AMQP.
Channels
Consumers
Exchanges
Bindings
Routes
Route keys
QUEUINGQUEUING
Asynchronous-by-design: just because no one is subscribed to
a queue doesn't mean that messages can't wait for a
consumer.
Durability is baked in.
Flexible architecture: publishers don't need to know about
who is consuming published data.
PRIORITYPRIORITY
'Asynchronous' doesn't mean 'not important'. Prioritize the stuff
that needs to be done fast.
The Messenger object is used for both publishing and
subscribing.
It's easy to make one.
require 'agni'
m = Agni::Messenger.new('amqp://localhost')
Subscribing is a one-liner.
m.subscribe('test_queue') {|m,p| printf p}
So is publishing.
1.upto(100).each{|n| m.publish("test#{n}", 'test_queue')}
Sending prioritized messages adds only a single parameter.
1.upto(100000).each{|n| m.publish("test#{n}", 'test_queue', n%10)}
BEHIND THE SCENESBEHIND THE SCENES
Based on RabbitMQ via
Use ten queues, each with their own AMQP channel
Configure each channel with its own prefetch value
Use an in-memory Fibonacci heap to priortize the incoming
prefetch streams
Process messages off of the heap
ruby-amqp
LIMITATIONSLIMITATIONS
Each message is only consumed once (by design)
EventMachine-Fast (5,000 messages/sec)
Supports ten levels of priority
STATUSSTATUS
Agni has been in production use at Apartment List for close to
six months, and delivers millions of messages daily.
It is being made available publically for the first time this week.
Agni is Open Source, available under the BSD license. Check it
out online at:
Try it out, file bugs, fork it, and send pull requests!
https://github.com/apartmentlist/agni

More Related Content

Similar to Agni

Practical Thin Server Architecture With Dojo Sapo Codebits 2008
Practical Thin Server Architecture With Dojo Sapo Codebits 2008Practical Thin Server Architecture With Dojo Sapo Codebits 2008
Practical Thin Server Architecture With Dojo Sapo Codebits 2008
codebits
 
Practical Thin Server Architecture With Dojo Peter Svensson
Practical Thin Server Architecture With Dojo Peter SvenssonPractical Thin Server Architecture With Dojo Peter Svensson
Practical Thin Server Architecture With Dojo Peter Svensson
rajivmordani
 

Similar to Agni (20)

Practical Thin Server Architecture With Dojo Sapo Codebits 2008
Practical Thin Server Architecture With Dojo Sapo Codebits 2008Practical Thin Server Architecture With Dojo Sapo Codebits 2008
Practical Thin Server Architecture With Dojo Sapo Codebits 2008
 
How Yelp Leapt to Microservices with More than a Message Queue
How Yelp Leapt to Microservices with More than a Message QueueHow Yelp Leapt to Microservices with More than a Message Queue
How Yelp Leapt to Microservices with More than a Message Queue
 
Better Than Best Effort at Bloomberg from ThousandEyes Connect
Better Than Best Effort at Bloomberg from ThousandEyes ConnectBetter Than Best Effort at Bloomberg from ThousandEyes Connect
Better Than Best Effort at Bloomberg from ThousandEyes Connect
 
MOINC Server
MOINC ServerMOINC Server
MOINC Server
 
MOINC Server
MOINC ServerMOINC Server
MOINC Server
 
Microservices
MicroservicesMicroservices
Microservices
 
Practical Thin Server Architecture With Dojo Peter Svensson
Practical Thin Server Architecture With Dojo Peter SvenssonPractical Thin Server Architecture With Dojo Peter Svensson
Practical Thin Server Architecture With Dojo Peter Svensson
 
RabbitMQ in Microservice Architecture.docx
RabbitMQ in Microservice Architecture.docxRabbitMQ in Microservice Architecture.docx
RabbitMQ in Microservice Architecture.docx
 
Choosing the right messaging service for your serverless app [with lumigo]
Choosing the right messaging service for your serverless app [with lumigo]Choosing the right messaging service for your serverless app [with lumigo]
Choosing the right messaging service for your serverless app [with lumigo]
 
Building and Scaling a WebSockets Pubsub System
Building and Scaling a WebSockets Pubsub SystemBuilding and Scaling a WebSockets Pubsub System
Building and Scaling a WebSockets Pubsub System
 
agile microservices @scaibo
agile microservices @scaiboagile microservices @scaibo
agile microservices @scaibo
 
Microevent
MicroeventMicroevent
Microevent
 
How to build a social network on serverless
How to build a social network on serverlessHow to build a social network on serverless
How to build a social network on serverless
 
Consumer-Driven Contract Testing With Postman
Consumer-Driven Contract Testing With PostmanConsumer-Driven Contract Testing With Postman
Consumer-Driven Contract Testing With Postman
 
linkerd.pdf
linkerd.pdflinkerd.pdf
linkerd.pdf
 
Conga case study: Application visibility in AWS with ExtraHop
Conga case study: Application visibility in AWS with ExtraHopConga case study: Application visibility in AWS with ExtraHop
Conga case study: Application visibility in AWS with ExtraHop
 
Battery Ventures: Simulating and Visualizing Large Scale Cassandra Deployments
Battery Ventures: Simulating and Visualizing Large Scale Cassandra DeploymentsBattery Ventures: Simulating and Visualizing Large Scale Cassandra Deployments
Battery Ventures: Simulating and Visualizing Large Scale Cassandra Deployments
 
Microservices intro
Microservices introMicroservices intro
Microservices intro
 
Real Time Streaming - Apache Kafka
Real Time Streaming - Apache KafkaReal Time Streaming - Apache Kafka
Real Time Streaming - Apache Kafka
 
Microservices in Action: putting microservice-based applications into production
Microservices in Action: putting microservice-based applications into productionMicroservices in Action: putting microservice-based applications into production
Microservices in Action: putting microservice-based applications into production
 

Recently uploaded

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Recently uploaded (20)

Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu SubbuApidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelNavi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 

Agni

  • 1. AGNIAGNI MESSAGING. ON FIRE.MESSAGING. ON FIRE. RickDillon Yep.⇧Thatdudeisagod.
  • 2. WHY DO WE NEED MESSAGING?WHY DO WE NEED MESSAGING? Web apps should be fast, so... do work asynchronously! And break out cross-cutting concerns into services
  • 3. HOW DO SERVICES COMMUNICATE?HOW DO SERVICES COMMUNICATE? HTTP, of course. But then, two problems emerge: Traffic can be bursty Systems go down for maintenance
  • 4. So we thought: “ Wouldn't it be great if all the requests coming in were queued somewhere? ”
  • 5. So we built Agni.
  • 6. DESIGNDESIGN Agni is built around three principles: Simplicity Queuing Priority
  • 7. SIMPLICITYSIMPLICITY One primitive: the queue. Avoid the complexities of AMQP. Channels Consumers Exchanges Bindings Routes Route keys
  • 8. QUEUINGQUEUING Asynchronous-by-design: just because no one is subscribed to a queue doesn't mean that messages can't wait for a consumer. Durability is baked in. Flexible architecture: publishers don't need to know about who is consuming published data.
  • 9. PRIORITYPRIORITY 'Asynchronous' doesn't mean 'not important'. Prioritize the stuff that needs to be done fast.
  • 10. The Messenger object is used for both publishing and subscribing. It's easy to make one. require 'agni' m = Agni::Messenger.new('amqp://localhost')
  • 11. Subscribing is a one-liner. m.subscribe('test_queue') {|m,p| printf p}
  • 12. So is publishing. 1.upto(100).each{|n| m.publish("test#{n}", 'test_queue')}
  • 13. Sending prioritized messages adds only a single parameter. 1.upto(100000).each{|n| m.publish("test#{n}", 'test_queue', n%10)}
  • 14. BEHIND THE SCENESBEHIND THE SCENES Based on RabbitMQ via Use ten queues, each with their own AMQP channel Configure each channel with its own prefetch value Use an in-memory Fibonacci heap to priortize the incoming prefetch streams Process messages off of the heap ruby-amqp
  • 15. LIMITATIONSLIMITATIONS Each message is only consumed once (by design) EventMachine-Fast (5,000 messages/sec) Supports ten levels of priority
  • 16. STATUSSTATUS Agni has been in production use at Apartment List for close to six months, and delivers millions of messages daily. It is being made available publically for the first time this week.
  • 17. Agni is Open Source, available under the BSD license. Check it out online at: Try it out, file bugs, fork it, and send pull requests! https://github.com/apartmentlist/agni