Performance Tips For 
Apps
About Me 
clairettran
Performance Is Important 
Oops! 
● Myer Boxing Day 2013 
● Click Frenzy 2012
Some Common Problems 
Note: not an exhaustive list
What I’ll Cover 
● Monitoring 
● Asynchronous Tasks 
● Caching 
● Scaling 
● Database +
Monitoring 
How to know there is a performance problem? 
+ Response time, rpm, memory usage, CPU usage, error 
rates
Monitoring 
What else can I do? 
● Logs 
● Memory Usage 
● Performance tests 
● Health Checks 
● More call centre phone calls
Asynchronous Tasks
Caching 
How? 
● Cache store 
● Fragment caching 
● SQL caching 
Removed in Rails4: Action Caching & Fragment Caching
Caching 
Problem: Page making long running/many external 
requests 
Before: No Caching 
After: With Caching!
Scaling
Scaling
Database 
● Add an index 
● Profiling 
● Batch queries 
● Eager fetching 
● Denormalisation 
● Sharding
Other Techniques 
● Queuing/Background Jobs 
● Caching tech (e.g. 
Elasticache) 
● Dedicated services 
● Rails engines 
● C-extensions (gems) 
● Sprites 
● Asset pipeline 
● Cache control headers 
● Gzip assets* 
● Less HTTP requests 
● Dedicated Search Service 
● Remove unused assets 
● Static cluster 
● AWS Auto-scaling 
● Akamai, Cloudfront (edge 
caching) 
● YSlow 
● Local Storage 
● Smaller Responses 
● Async JS 
● Chrome DevTools 
● Ruby Flavours e.g. JRuby
Further Reading 
https://github.com/ianheggie/health_check 
http://guides.rubyonrails.org/caching_with_rails.html 
http://railscasts.com/episodes/380-memcached-dalli 
https://developers.google.com/events/io/sessions/324511365 
http://railscasts.com/episodes/366-sidekiq 
http://www.slideshare.net/derekmbrown/netflix-strategic-performance- 
analysis 
http://blog.jphpsf.com/2012/04/28/front-end-performance-case-study- 
github
Questions

Ruby On Rails Sydney Meetup - Performance Tips For Apps

  • 1.
  • 2.
  • 3.
    Performance Is Important Oops! ● Myer Boxing Day 2013 ● Click Frenzy 2012
  • 4.
    Some Common Problems Note: not an exhaustive list
  • 5.
    What I’ll Cover ● Monitoring ● Asynchronous Tasks ● Caching ● Scaling ● Database +
  • 6.
    Monitoring How toknow there is a performance problem? + Response time, rpm, memory usage, CPU usage, error rates
  • 7.
    Monitoring What elsecan I do? ● Logs ● Memory Usage ● Performance tests ● Health Checks ● More call centre phone calls
  • 8.
  • 9.
    Caching How? ●Cache store ● Fragment caching ● SQL caching Removed in Rails4: Action Caching & Fragment Caching
  • 10.
    Caching Problem: Pagemaking long running/many external requests Before: No Caching After: With Caching!
  • 11.
  • 12.
  • 13.
    Database ● Addan index ● Profiling ● Batch queries ● Eager fetching ● Denormalisation ● Sharding
  • 14.
    Other Techniques ●Queuing/Background Jobs ● Caching tech (e.g. Elasticache) ● Dedicated services ● Rails engines ● C-extensions (gems) ● Sprites ● Asset pipeline ● Cache control headers ● Gzip assets* ● Less HTTP requests ● Dedicated Search Service ● Remove unused assets ● Static cluster ● AWS Auto-scaling ● Akamai, Cloudfront (edge caching) ● YSlow ● Local Storage ● Smaller Responses ● Async JS ● Chrome DevTools ● Ruby Flavours e.g. JRuby
  • 15.
    Further Reading https://github.com/ianheggie/health_check http://guides.rubyonrails.org/caching_with_rails.html http://railscasts.com/episodes/380-memcached-dalli https://developers.google.com/events/io/sessions/324511365 http://railscasts.com/episodes/366-sidekiq http://www.slideshare.net/derekmbrown/netflix-strategic-performance- analysis http://blog.jphpsf.com/2012/04/28/front-end-performance-case-study- github
  • 17.