Performance - When, What and How

  • 812 views
Uploaded 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

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

More in: Technology
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
    Be the first to like this
No Downloads

Views

Total Views
812
On Slideshare
0
From Embeds
0
Number of Embeds
5

Actions

Shares
Downloads
1
Comments
0
Likes
0

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

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