Performance - When, What and How

1,213 views

Published on

Our presentation on Israel Rails Conference 2012. Vitaly talking about rails performance, how to measure, what to improve and just as much important - what not to improve

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
1,213
On SlideShare
0
From Embeds
0
Number of Embeds
707
Actions
Shares
0
Downloads
2
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Performance - When, What and How

  1. 1. Rails Performance When, What and How Vitaly Kushner @vkushner
  2. 2. Vitaly Kushnerprogramming since middle 80s professionally since early 90s Rails since 2005 founded Astrails in 2008
  3. 3. http://astrails.com/blog
  4. 4. performance
  5. 5. slowfor whatever reason
  6. 6. performance
  7. 7. performance• raw speed• throughput• scalability• end-user
  8. 8. No timeto dive into details
  9. 9. When to optimize? and when not to.
  10. 10. what to do with 1M users
  11. 11. Celebrate! you’ve made it.
  12. 12. why startups fail?
  13. 13. NOT because ofperformance problems
  14. 14. 1 million users
  15. 15. first 1000 users!
  16. 16. have scalability problem?
  17. 17. GREAT!because it means you grow fast
  18. 18. later
  19. 19. Scalability Plan• understand the limits• know your next step
  20. 20. performance does it matter?
  21. 21. YES!performance is very important
  22. 22. Is 1% a lot?yes, if you are Google.
  23. 23. Why not to optimize anyway?
  24. 24. time and budget usually limited
  25. 25. MeasureYou can not improve what you do not measure.
  26. 26. Tools• Yahoo Yslow http://developer.yahoo.com/yslow/• Google PageSpeed https://developers.google.com/speed/pagespeed• NewRelic - http://newrelic.com• httperf & ab• Blitz.io
  27. 27. limit number of records from the database
  28. 28. oinkhttps://github.com/noahd1/oink
  29. 29. Instantiation Breakdown: Total: 14 |User: 4 | Experience: 3 | Location: 3 |Interest: 3 | Admin: 1
  30. 30. limit number of queries prevent 1+N queries problem
  31. 31. bullethttps://github.com/flyerhzm/bullet
  32. 32. N+1 Query detectedExperience => [:interest]Add to your finder: :include => [:interest]
  33. 33. define indexes can be done later
  34. 34. query_reviewerhttps://github.com/nesquena/query_reviewer
  35. 35. limit number of http requests consolidate assets assets pipeline makes it easy
  36. 36. css at the topjs at the bottom improves perceived page speed
  37. 37. low level hacks• replace :include with :join• explicit :select
  38. 38. not recommened
  39. 39. Maintainability usually better then speed
  40. 40. low hanging fruits• compress and http cache assets• CDN libraries• image sprites• bundle images into CSS• CDN for all static assets
  41. 41. Caching much later
  42. 42. real performance problem?
  43. 43. next time...
  44. 44. Thank you!Slides and video will be published at http://astrails.com/blog Vitaly Kushner @vkushner

×