This was a lightning talk presented at Women Who Code Sydney May 2014.
A look into some techniques that can be applied to RoR apps (and most apps in general) on how to improve performance. We'll be looking into scaling, caching and other methods to grow from a single server database app to bigger apps :)
3. Performance Is Important
Yay!
● AirBnb, Netflix, Twitter*, Facebook, Zynga
* Used to have outages, but fixed their performance issues
● Jetstar ticket sales
Oops!
● Myer Boxing Day 2013
● Click Frenzy 2012
4. Example Stats for SMH
At Peak: 28K requests per minute
14th May: 4,000,000 hits to the site
5. Some Common Problems
● Memory leaks
● Long running API call(s)
● Slow synchronous processes
(e.g. Emails, PayPal)
● Slow database queries
● Network issues
Note: not an exhaustive list
7. Monitoring
How to know there is a performance problem?
+ Response time, rpm, memory usage, CPU usage, error
rates
8. Monitoring
What else can I do?
● Logs (e.g. file server, splunk, loggly, logstash)
● Memory Usage (e.g. unix top command)
● Performance tests (e.g. Apache bench, JMeter, Neoloader)
● Health Checks (e.g. health_check gem, Nagios, Sitescope)
● More calls to the call centre
9. Caching
How?
● Cache store (key-value store)
● Fragment caching (part of
the page)
● SQL caching (cache query
results)
Removed in Rails4: Action Caching & Fragment Caching