Ce diaporama a bien été signalé.
Nous utilisons votre profil LinkedIn et vos données d’activité pour vous proposer des publicités personnalisées et pertinentes. Vous pouvez changer vos préférences de publicités à tout moment.
Ruby Proxies for Scale, Performance and Monitoring Ilya Grigorik CTO / AideRSS Event-Driven Architectures  @igrigorik #mes...
postrank.com/topic/ruby The slides… Twitter My blog
<ul><li>Proxy Love </li></ul>
<ul><li>Myth: Slow Frameworks </li></ul>“ Rails, Django, Seaside, Scala…” cant scale.
<ul><li>The Proxy Solution </li></ul>
<ul><li>The “More” Proxy Solution </li></ul>
<ul><li>Transparent, Cut-Through Proxy </li></ul>Transparent
<ul><li>Transparent Proxy = Scalability Power Tool </li></ul>90% use case
Proxies for Monitoring, Performance and Scale welcome to   the wonderful world of intercepting, caching, … , proxy servers
Problem: Staging Environment Production Simulated User
“ Representative Load / Staging” Duplication Simulating traffic?
Staging fail. Profile of queries has changed Fail Load on production has changed Fail Parallel environment Fail Slower rel...
Replay  log data,  rinse, repeat github.com/igrigorik/autoperf
<ul><li>Benchmarking Proxy </li></ul><ul><li>flash of the obvious </li></ul>Real (production) traffic Duplex Ruby Proxy, F...
Transparent Duplex Proxy, FTW
Same response, different turnaround time Different response body!
<ul><li>github.com/igrigorik/em-proxy </li></ul>Duplex Ruby Proxy, FTW!
<ul><li>EM-Proxy Workflow </li></ul>1. Accept connection - Connect & Forward to Production - Connect & Forward to Staging ...
Ruby EventMachine crash course EM::Connection #receive_data   - new data ready for processing #unbind -  connection termin...
Duplex incoming data
Forward Production Response Analyze Results
Open connection to application server
Buffer until connected
Pass response to Duplex Notify when done
Analyze Time, Response…
Analyze Time, Response… Response Time
Cute, right? but so what…
%w[  <Transparent>  Intercepting  Caching … ]  solution for every problem
Validating Proxy easy, real-time diagnostics Woops!
Who said you’re not allowed to touch the data? Intercepting Proxy for those hard-to-reach spots
SMTP / Mail:  inject SPAM detection De(encrypt):  stream data MySQL:  inject sharding logic Intercepting Proxy for those h...
@PostRank:  Beanstalkd + Ruby Proxy  because RAM is still expensive
<ul><li>Beanstalkd  Math </li></ul>~ 93  Bytes of overhead per job ~300  Bytes of data / job x 80,000,000  jobs in memory ...
<ul><li>Extending Beanstalkd </li></ul>Observations:  1.  Each job is rescheduled several times 2.  > 95%  are scheduled f...
@PostRank: “Chronos Scheduler” 1 “Medium” EC2 Instance Intercepting Proxy
Extend the protocol Chronos Scheduler Beanstalkd persistence Process incoming data Buffer “SCHEDULE” requests, otherwise f...
Archive to MySQL Chronos Scheduler Beanstalkd persistence Buffer “SCHEDULE”
@PostRank: “Chronos Scheduler” Extend the protocol ARCHIVE RESERVE, … 10 line patch to client: queue.archive(job)
@PostRank: “Chronos Scheduler” ~79,000,000 jobs, 4GB RAM ARCHIVE RESERVE, … Upcoming jobs: ~ 1M 400% cheaper + extensible!...
%w[ Transparent  <Intercepting>   Auth  Cache … ]  easy to make & a powerful hammer
Cheers. Questions? The slides… Twitter My blog
Prochain SlideShare
Chargement dans…5
×

Ruby Proxies for Scale, Performance, and Monitoring - GoGaRuCo - igvita.com

18 657 vues

Publié le

A high-performance proxy server is less than a hundred lines of Ruby code and it is an indispensable tool for anyone who knows how to use it. In this session we will first walk through the basics of event-driven architectures and high-performance network programming in Ruby using the EventMachine framework.

Publié dans : Technologie
  • Soyez le premier à commenter

Ruby Proxies for Scale, Performance, and Monitoring - GoGaRuCo - igvita.com

  1. Ruby Proxies for Scale, Performance and Monitoring Ilya Grigorik CTO / AideRSS Event-Driven Architectures @igrigorik #meshu #eda http://bit.ly/eda
  2. postrank.com/topic/ruby The slides… Twitter My blog
  3. <ul><li>Proxy Love </li></ul>
  4. <ul><li>Myth: Slow Frameworks </li></ul>“ Rails, Django, Seaside, Scala…” cant scale.
  5. <ul><li>The Proxy Solution </li></ul>
  6. <ul><li>The “More” Proxy Solution </li></ul>
  7. <ul><li>Transparent, Cut-Through Proxy </li></ul>Transparent
  8. <ul><li>Transparent Proxy = Scalability Power Tool </li></ul>90% use case
  9. Proxies for Monitoring, Performance and Scale welcome to the wonderful world of intercepting, caching, … , proxy servers
  10. Problem: Staging Environment Production Simulated User
  11. “ Representative Load / Staging” Duplication Simulating traffic?
  12. Staging fail. Profile of queries has changed Fail Load on production has changed Fail Parallel environment Fail Slower release cycle Fail
  13. Replay log data, rinse, repeat github.com/igrigorik/autoperf
  14. <ul><li>Benchmarking Proxy </li></ul><ul><li>flash of the obvious </li></ul>Real (production) traffic Duplex Ruby Proxy, FTW!
  15. Transparent Duplex Proxy, FTW
  16. Same response, different turnaround time Different response body!
  17. <ul><li>github.com/igrigorik/em-proxy </li></ul>Duplex Ruby Proxy, FTW!
  18. <ul><li>EM-Proxy Workflow </li></ul>1. Accept connection - Connect & Forward to Production - Connect & Forward to Staging 2. Stream response to client from Production - Buffer response from Staging 3. Run “Processor / Analyzer” once both return
  19. Ruby EventMachine crash course EM::Connection #receive_data - new data ready for processing #unbind - connection terminated #connection_completed - connected
  20. Duplex incoming data
  21. Forward Production Response Analyze Results
  22. Open connection to application server
  23. Buffer until connected
  24. Pass response to Duplex Notify when done
  25. Analyze Time, Response…
  26. Analyze Time, Response… Response Time
  27. Cute, right? but so what…
  28. %w[ <Transparent> Intercepting Caching … ] solution for every problem
  29. Validating Proxy easy, real-time diagnostics Woops!
  30. Who said you’re not allowed to touch the data? Intercepting Proxy for those hard-to-reach spots
  31. SMTP / Mail: inject SPAM detection De(encrypt): stream data MySQL: inject sharding logic Intercepting Proxy for those hard-to-reach spots
  32. @PostRank: Beanstalkd + Ruby Proxy because RAM is still expensive
  33. <ul><li>Beanstalkd Math </li></ul>~ 93 Bytes of overhead per job ~300 Bytes of data / job x 80,000,000 jobs in memory ~ 30 GB of RAM = 2 X-Large EC2 instances Oi, expensive!
  34. <ul><li>Extending Beanstalkd </li></ul>Observations: 1. Each job is rescheduled several times 2. > 95% are scheduled for > 3 hours into the future 3. Beanstalkd does not have overflow page-to-disk Memory is wasted… We’ll add it ourselves!
  35. @PostRank: “Chronos Scheduler” 1 “Medium” EC2 Instance Intercepting Proxy
  36. Extend the protocol Chronos Scheduler Beanstalkd persistence Process incoming data Buffer “SCHEDULE” requests, otherwise forward
  37. Archive to MySQL Chronos Scheduler Beanstalkd persistence Buffer “SCHEDULE”
  38. @PostRank: “Chronos Scheduler” Extend the protocol ARCHIVE RESERVE, … 10 line patch to client: queue.archive(job)
  39. @PostRank: “Chronos Scheduler” ~79,000,000 jobs, 4GB RAM ARCHIVE RESERVE, … Upcoming jobs: ~ 1M 400% cheaper + extensible! 1 Proxy, 1 Beanstalkd, 1 MySQL = 200 req/s
  40. %w[ Transparent <Intercepting> Auth Cache … ] easy to make & a powerful hammer
  41. Cheers. Questions? The slides… Twitter My blog

×