Post on 07-Jul-2015
description
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
Before: No Caching
After: With Caching!
Problem: Page making long running/many external requests
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