Close
Glad You're Ready. Let's Get Started!

Let us know how we can contact you.

Thank you!

We'll respond shortly.

LABS
RailsConf: Art of the Ruby Proxy for Scale, Performance, and Monitoring – Ilya Grigorik (AideRSS Inc.)

Slides are online already

Random nuggets from the talk:

The overhead of most requests is calls out of a framework to a DB, FS etc, but because it is called from the framework, that is what gets the blame. This sustains the myth that “<insert your framework of choice> doesn’t scale”. Solution: put a proxy in front of the server and duplicate the server behind it.

Types of proxy:

  • Transparent
  • Intercepting
  • Caching

Transparent Cut-Through Proxy = 90% use case

  • Transparent Proxy – user cannot detect he is behind a proxy
  • Cut-Through – forwards on the fly (not store and forward)

The Problem

Flaws of Staging environments:

  • Any change in profile of queries invalidates your testing
  • Cost

The Solution

  • What if you could take your production traffic and fork it to two environments

EventMachine

  • EventMachine inplements a design pattern knows as the reactor pattern
  • Will connect to any file descriptor (e.g. a socket)
  • Written in C++ for high performance and concurrency without threads
  • EM does have a native thread pool used for EM.defer
  • http://bit.ly/aiderss-eventmachine excellent PDF to document EM

EM-Proxy

  • http://github.com/igrigorik/em-proxy
  • A simple DSL for writing proxy servers.
  • The return from on_data and on_response blocks is just passed on/back.
  • If you return nil from a block, no data gets forwarded.
  • 5% performance hit for large messages
  • 20% perforamnce hit if messages are very small, mitigate by putting behind HA proxy and add another server.
  • No way to send to only 1 back-end server yet (can’t implement a load-balancing proxy).

Misc name-dropping

  • httpperf is really good for replaying traffic against a site
  • igrigorik/autoperf – replay nginx logs against your site
  • Recommended we look at MySQL proxy – awesome dashboard.
  • Nginx does really good things with compression (gzip, ETAGS etc).
  • Mailtrap is a fake SMTP server gem for testing sending email from your Rails app.
  • Defensio is a smap filter for blogs. API you can send comments to and it will tell you if it is spam or not. Returns a ‘spam index’.
  • Beanstalk is an in-memory distributed message queue. Despite frequent requests, they have not implemented persistence, which is what motivated Ilya to work around them with this proxy server.

Comments
Post a Comment

Your Information (Name required. Email address will not be displayed with comment.)

* Copy This Password *

* Type Or Paste Password Here *