SlideShare a Scribd company logo
1 of 34
Event Machine
               Ricardo Almeida
               @almeidaricardo




https://github.com/eventmachine/eventmachine
PostRank Tools

     • Mysql, Ruby (API), Rails, Sinatra, Phyton,
          Java, JRuby, EC2, Nagios, Ganglia, Solr
     • Eventmachine, RabbitMQ
     • From XMPP to AMQP
     • Cassandra, Goliath
http://webpulp.tv/post/4184040219/scaling-postrank-using-ruby-and-eventmachine-with-ilya
Ilya Grigorik
Event Machine

• Fast, simple event-processing library for Ruby
  programs

• Event-driven I/O
• Reactor pattern
Designed to

• Extremely high scalability, performance and stability
• An API that eliminates the complexities of high-
  performance threaded network programming
Social Core

• Escalabilidade
• Disponibilidade - Todos requests devem ser
  respondidos

• Consistência
Architectures
                                    Job Manager
GET / POST                  Queue
             Server Event

                                    Process
Tools
•   Rails 3.1.0.rc6

•   Ruby 1.9.2-head

•   Event-Machine

•   Thin

•   Goliath

•   Mysql (gem mysql2 v 0.3.6)

•   MongoDB

•   RabbitMQ (AMQP)
EM-Tools

• https://github.com/eventmachine/eventmachine/wiki
• https://github.com/igrigorik/em-http-request
• https://github.com/igrigorik/em-synchrony
• https://github.com/postrank-labs/goliath
Benchmarks


• ApacheBench,Version 2.3
• Autoperf (httperf)
Provas!!
Sleep Select (1 sec)

• Tools:
 • ApacheBench
 • Rails 3.1.0.rc6 + Ruby 1.9.2-head + Mysql +
    webrick


 https://gist.github.com/1166610
Sleep Select (1 sec)

  •   ab -c 10 -n 10 'http://localhost:3000/people/wait'

  •   Time taken for tests:   11.255 seconds




https://gist.github.com/1166610
Sleep Select (1 sec)
• Tools:                        Assync Rails

 • ApacheBench
 • webrick
 • Rails 3.1.0.rc6 + Ruby 1.9.2-head + Mysql + Thin
    + EventMachine

 https://gist.github.com/1166610
Sleep Select (1 sec)

  •   ab -c 10 -n 10 'http://localhost:3000/people/wait'

  •   Time taken for tests:   2.371 seconds




https://gist.github.com/1166610
Goliath
•   Heartbeat

•   Assync Upload

•   Routes

•   Validations
Sleep Select (1 sec)
• Tools:
 • ApacheBench
 • Rails 3.1.0.rc6 + Thin
 • Ruby 1.9.2-head + EventMachine + Mysql +
    Goliath

 https://gist.github.com/1166462
Goliath +
ActiveRecord
Sleep Select (1 sec)

  •   ab -c 10 -n 10 'http://0.0.0.0:9000/wait?format=json'

  •   Time taken for tests:   2.198 seconds




https://gist.github.com/1166610
HTTP assinc
    Req/Resp no MongoDB
• Tools:
 • ApacheBench
 • Mysql
 • Ruby 1.9.2-head + EventMachine + Goliath +
   MongoDB
HTTP assinc
Req/Resp no MongoDB
•   ab -c 10 -n 10 'http://0.0.0.0:9000/teste?format=json'

•   Time taken for tests:   0.209 seconds
HTTP assinc
Req/Resp no MongoDB
•   ab -c 50 -n 50 'http://0.0.0.0:9000/teste?format=json'

•   Time taken for tests:   1.105 seconds
EM + RabbitMQ
EM + RabbitMQ
Domínios

•   AAPG              •   Facebook

•   Anotations        •   Twitter

•   Activity (New)    •   Google+
http://www.slideshare.net/hungryblank/distributed-and-concurrent-programming-with-rabbitmq-and-eventmachine-rails-underground-2009
http://www.slideshare.net/hungryblank/distributed-and-concurrent-programming-with-rabbitmq-and-eventmachine-rails-underground-2009
http://www.slideshare.net/hungryblank/distributed-and-concurrent-programming-with-rabbitmq-and-eventmachine-rails-underground-2009
SPDY




http://www.igvita.com/2011/04/07/life-beyond-http-11-googles-spdy/
Obrigado!
 Ricardo Almeida
 @almeidaricardo

More Related Content

What's hot

What's hot (20)

To the moon and beyond with Java 17 APIs! | DevNation Tech Talk
To the moon and beyond with Java 17 APIs! | DevNation Tech TalkTo the moon and beyond with Java 17 APIs! | DevNation Tech Talk
To the moon and beyond with Java 17 APIs! | DevNation Tech Talk
 
Rust with-kafka-07-02-2019
Rust with-kafka-07-02-2019Rust with-kafka-07-02-2019
Rust with-kafka-07-02-2019
 
[En] IPVS for Docker Containers
[En] IPVS for Docker Containers[En] IPVS for Docker Containers
[En] IPVS for Docker Containers
 
Scapy the packet 途中01
Scapy the packet 途中01Scapy the packet 途中01
Scapy the packet 途中01
 
Jörg Schad - NO ONE PUTS Java IN THE CONTAINER - Codemotion Milan 2017
Jörg Schad - NO ONE PUTS Java IN THE CONTAINER - Codemotion Milan 2017Jörg Schad - NO ONE PUTS Java IN THE CONTAINER - Codemotion Milan 2017
Jörg Schad - NO ONE PUTS Java IN THE CONTAINER - Codemotion Milan 2017
 
Scapy talk
Scapy talkScapy talk
Scapy talk
 
fsharp goodness for everyday work
fsharp goodness for everyday workfsharp goodness for everyday work
fsharp goodness for everyday work
 
WTF is Twisted?
WTF is Twisted?WTF is Twisted?
WTF is Twisted?
 
Load Balancing in the Cloud using Nginx & Kubernetes
Load Balancing in the Cloud using Nginx & KubernetesLoad Balancing in the Cloud using Nginx & Kubernetes
Load Balancing in the Cloud using Nginx & Kubernetes
 
Docker and Fluentd
Docker and FluentdDocker and Fluentd
Docker and Fluentd
 
Sysdig monitor - a brief introduction
Sysdig monitor - a brief introductionSysdig monitor - a brief introduction
Sysdig monitor - a brief introduction
 
Rust's Journey to Async/await
Rust's Journey to Async/awaitRust's Journey to Async/await
Rust's Journey to Async/await
 
Support of containerized workloads in ONAP
Support of containerized workloads in ONAPSupport of containerized workloads in ONAP
Support of containerized workloads in ONAP
 
Capistrano demo
Capistrano demoCapistrano demo
Capistrano demo
 
Asynchronous Python with Twisted
Asynchronous Python with TwistedAsynchronous Python with Twisted
Asynchronous Python with Twisted
 
KUBEBOOT - SPRING BOOT DEPLOYMENT ON KUBERNETES HAS NEVER BEEN SO EASY
KUBEBOOT - SPRING BOOT DEPLOYMENT ON KUBERNETES HAS NEVER BEEN SO EASYKUBEBOOT - SPRING BOOT DEPLOYMENT ON KUBERNETES HAS NEVER BEEN SO EASY
KUBEBOOT - SPRING BOOT DEPLOYMENT ON KUBERNETES HAS NEVER BEEN SO EASY
 
Integrating microservices with apache camel on kubernetes
Integrating microservices with apache camel on kubernetesIntegrating microservices with apache camel on kubernetes
Integrating microservices with apache camel on kubernetes
 
The details of CI/CD environment for Ruby
The details of CI/CD environment for RubyThe details of CI/CD environment for Ruby
The details of CI/CD environment for Ruby
 
Whoops! I Rewrote It in Rust
Whoops! I Rewrote It in RustWhoops! I Rewrote It in Rust
Whoops! I Rewrote It in Rust
 
Pharo VM Performance
Pharo VM PerformancePharo VM Performance
Pharo VM Performance
 

Similar to Event machine

The Architecture of PicCollage Server
The Architecture of PicCollage ServerThe Architecture of PicCollage Server
The Architecture of PicCollage Server
Lin Jen-Shin
 
Counters with Riak on Amazon EC2 at Hackover
Counters with Riak on Amazon EC2 at HackoverCounters with Riak on Amazon EC2 at Hackover
Counters with Riak on Amazon EC2 at Hackover
Andrei Savu
 

Similar to Event machine (20)

Host Health Monitoring with Docker Run
Host Health Monitoring with Docker RunHost Health Monitoring with Docker Run
Host Health Monitoring with Docker Run
 
Using Riak for Events storage and analysis at Booking.com
Using Riak for Events storage and analysis at Booking.comUsing Riak for Events storage and analysis at Booking.com
Using Riak for Events storage and analysis at Booking.com
 
The Architecture of PicCollage Server
The Architecture of PicCollage ServerThe Architecture of PicCollage Server
The Architecture of PicCollage Server
 
Impression of Rails 3
Impression of Rails 3Impression of Rails 3
Impression of Rails 3
 
Rack
RackRack
Rack
 
(ARC348) Seagull: How Yelp Built A System For Task Execution
(ARC348) Seagull: How Yelp Built A System For Task Execution(ARC348) Seagull: How Yelp Built A System For Task Execution
(ARC348) Seagull: How Yelp Built A System For Task Execution
 
Ship It ! with Ruby/ Rails Ecosystem
Ship It ! with Ruby/ Rails EcosystemShip It ! with Ruby/ Rails Ecosystem
Ship It ! with Ruby/ Rails Ecosystem
 
EventMachine
EventMachineEventMachine
EventMachine
 
Rails Performance
Rails PerformanceRails Performance
Rails Performance
 
2017 Codemotion OWASP ZAP in CI/CD
2017 Codemotion OWASP ZAP in CI/CD2017 Codemotion OWASP ZAP in CI/CD
2017 Codemotion OWASP ZAP in CI/CD
 
Taking Spinnaker for a spin @ London DevOps Meetup 36
Taking Spinnaker for a spin @ London DevOps Meetup 36Taking Spinnaker for a spin @ London DevOps Meetup 36
Taking Spinnaker for a spin @ London DevOps Meetup 36
 
Puppet Camp New York 2014: Streamlining Puppet Development Workflow
Puppet Camp New York 2014: Streamlining Puppet Development Workflow Puppet Camp New York 2014: Streamlining Puppet Development Workflow
Puppet Camp New York 2014: Streamlining Puppet Development Workflow
 
Steamlining your puppet development workflow
Steamlining your puppet development workflowSteamlining your puppet development workflow
Steamlining your puppet development workflow
 
Don’t Forget About Your Past—Optimizing Apache Druid Performance With Neil Bu...
Don’t Forget About Your Past—Optimizing Apache Druid Performance With Neil Bu...Don’t Forget About Your Past—Optimizing Apache Druid Performance With Neil Bu...
Don’t Forget About Your Past—Optimizing Apache Druid Performance With Neil Bu...
 
Automating OWASP ZAP - DevCSecCon talk
Automating OWASP ZAP - DevCSecCon talk Automating OWASP ZAP - DevCSecCon talk
Automating OWASP ZAP - DevCSecCon talk
 
Simon Bennetts - Automating ZAP
Simon Bennetts - Automating ZAP Simon Bennetts - Automating ZAP
Simon Bennetts - Automating ZAP
 
Security Testing with OWASP ZAP in CI/CD - Simon Bennetts - Codemotion Amster...
Security Testing with OWASP ZAP in CI/CD - Simon Bennetts - Codemotion Amster...Security Testing with OWASP ZAP in CI/CD - Simon Bennetts - Codemotion Amster...
Security Testing with OWASP ZAP in CI/CD - Simon Bennetts - Codemotion Amster...
 
Counters with Riak on Amazon EC2 at Hackover
Counters with Riak on Amazon EC2 at HackoverCounters with Riak on Amazon EC2 at Hackover
Counters with Riak on Amazon EC2 at Hackover
 
Titanium 3.2 CLI - TiAppCamp2 - 11/2/2013
Titanium 3.2 CLI - TiAppCamp2 - 11/2/2013Titanium 3.2 CLI - TiAppCamp2 - 11/2/2013
Titanium 3.2 CLI - TiAppCamp2 - 11/2/2013
 
IVS CTO Night And Day 2018 Winter - [re:Cap] Serverless & Mobile
IVS CTO Night And Day 2018 Winter - [re:Cap] Serverless & MobileIVS CTO Night And Day 2018 Winter - [re:Cap] Serverless & Mobile
IVS CTO Night And Day 2018 Winter - [re:Cap] Serverless & Mobile
 

More from almeidaricardo

More from almeidaricardo (7)

Pipeline - Continuous Delivery
Pipeline - Continuous DeliveryPipeline - Continuous Delivery
Pipeline - Continuous Delivery
 
Excelencia puc
Excelencia pucExcelencia puc
Excelencia puc
 
Excelência - PUC
Excelência - PUCExcelência - PUC
Excelência - PUC
 
Canaries in the air #gurusorocaba
Canaries in the air #gurusorocabaCanaries in the air #gurusorocaba
Canaries in the air #gurusorocaba
 
Bdd e ci
Bdd e ciBdd e ci
Bdd e ci
 
Buscas Poderosas Com Solr
Buscas Poderosas Com SolrBuscas Poderosas Com Solr
Buscas Poderosas Com Solr
 
Palestra Fatec
Palestra FatecPalestra Fatec
Palestra Fatec
 

Recently uploaded

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 

Recently uploaded (20)

HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
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?
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
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
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
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
 
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
 

Event machine

Editor's Notes

  1. \n
  2. \n
  3. \n
  4. \n
  5. \n
  6. \n
  7. \n
  8. \n
  9. \n
  10. \n
  11. \n
  12. \n
  13. \n
  14. \n
  15. \n
  16. \n
  17. \n
  18. \n
  19. \n
  20. \n
  21. \n
  22. \n
  23. \n
  24. \n
  25. \n
  26. \n
  27. \n
  28. \n
  29. \n
  30. \n
  31. \n
  32. \n
  33. \n
  34. \n