Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
All you need is Performance
Search
Sadiksha
April 13, 2016
Programming
1
60
All you need is Performance
This presentation is about how I used small techniques to improve speed of my rails application.
Sadiksha
April 13, 2016
Tweet
Share
More Decks by Sadiksha
See All by Sadiksha
Rails Conf 2016 - Lightening Talk
sadiksha
1
140
Other Decks in Programming
See All in Programming
Amazon ECS Managed Instances が リリースされた!キャッチアップしよう!! / Let's catch up Amazon ECS Managed Instances
cocoeyes02
0
120
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
170
ドメイン駆動設計のエッセンス
masuda220
PRO
15
7.3k
SidekiqでAIに商品説明を生成させてみた
akinko_0915
0
110
エンジニアに事業やプロダクトを理解してもらうためにやってること
murabayashi
0
110
Pythonに漸進的に型をつける
nealle
1
150
AsyncSequenceとAsyncStreamのプロポーザルを全部読む!!
s_shimotori
1
220
外接に惑わされない自システムの処理時間SLIをOpenTelemetryで実現した話
kotaro7750
0
150
Designing Repeatable Edits: The Architecture of . in Vim
satorunooshie
0
220
ネストしたdata classの面倒な更新にさようなら!Lensを作って理解するArrowのOpticsの世界
shiita0903
1
230
MCPサーバー「モディフィウス」で変更容易性の向上をスケールする / modifius
minodriven
4
320
スキーマ駆動で、Zod OpenAPI Honoによる、API開発するために、Hono Takibiというライブラリを作っている
nakita628
0
330
Featured
See All Featured
Speed Design
sergeychernyshev
32
1.2k
GitHub's CSS Performance
jonrohan
1032
470k
Music & Morning Musume
bryan
46
6.9k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
234
17k
Learning to Love Humans: Emotional Interface Design
aarron
274
41k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
231
22k
BBQ
matthewcrist
89
9.9k
Typedesign – Prime Four
hannesfritz
42
2.8k
Large-scale JavaScript Application Architecture
addyosmani
514
110k
Product Roadmaps are Hard
iamctodd
PRO
55
11k
Building Applications with DynamoDB
mza
96
6.7k
VelocityConf: Rendering Performance Case Studies
addyosmani
333
24k
Transcript
All you need is Performance Sadiksha Gautam Software Developer @
EnerNOC, Munich www.sadiksha.com @sadikshagautam (twitter)
[email protected]
11/05/16
Performance Issues ¡ Its all about users ¡ Blamed? ¡
Happy? ¡ Temporary or permanent solutions 2
Temporary Solutions [Source: https://memegenerator.net] [Source: http://imgur.com/iWKad22] 3
Permanent Solutions ¡ Use your experience ¡ Avoid premature optimization
¡ Profiling ¡ Optimize server and client side performance 4
Server and Client side ¡ Server side ¡ Upgrade Ruby
¡ Pagination ¡ Optimize database queries ¡ Client side ¡ Turbolinks ¡ Pjax 5
Upgrade Ruby ¡ Rails Request Per Second ¡ Ruby 1.9.3
~ 86 rps ¡ Ruby 2.1.1 ~ 110 rps [Source: http://www.isrubyfastyet.com/] 6
Upgrade Ruby ¡ Rails startup time ¡ Ruby 1.9.3 ~
4.90 seconds ¡ Ruby 2.1.1 ~ 2.35 seconds [Source: http://www.isrubyfastyet.com/] 7
Pagination ¡ Gem: will_paginate ¡ Limited data ¡ My application:
¡ 450 data rows initially ¡ 25 data after pagination ¡ Before: 5355ms ¡ After: 2488ms 8
Profiling ¡ Gem – rack-mini-profiler ¡ Information about database queries
[Source: http://railscasts.com/static/episodes/asciicasts/E368I01.png] 9
Optimize Database Queries ¡ Add indexes – (gem lol_dba) ¡
From 1.35s to 1.08s ¡ Use select and pluck ¡ Only required columns from database tables ¡ Pluck: array of data ¡ Includes and joins ¡ From 14,219 to 11,254 queries 10
Turbolinks ¡ Built in for rails 4 ¡ For rails
3: ¡ gem ‘turbolinks’ ¡ Speeds up application by two times ¡ Does not load all the unchanged assets 11
Pjax ¡ Pjax = pushState + ajax ¡ Jquery plugin
¡ jquery_pjax (gem) ¡ Less automatic 12
Further Improvements ¡ Browser caching ¡ Counter caching ¡ Bullet
gem ¡ Performance testing (gem rails-perftest) 13
Most Important ¡ Fast application ¡ Happy Users ¡ Happy
you ¡ Happy world ¡ Feel proud 14
Lets Discuss 15 [Source: http://i1.wp.com/teachinginkoreanuniversity.com/wp-content/uploads/2015/06/team.jpg]
References ¡ www.railscasts.com ¡ www.pluralsight.com ¡ https://github.com/plentz/lol_dba ¡ https://github.com/MiniProfiler/rack-mini-profiler ¡
https://github.com/SamSaffron/flamegraph ¡ https://github.com/mislav/will_paginate ¡ https://github.com/rails/cache_digests ¡ http://railscasts.com/episodes/387-cachedigests?view=comments ¡ https://github.com/rails/jquery-rails ¡ https://github.com/kossnocorp/jquery.turbolinks ¡ https://github.com/defunkt/jquery-pjax ¡ https://github.com/flyerhzm/bullet 16