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
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
290
What's new in Spring Modulith?
olivergierke
1
140
チームの境界をブチ抜いていけ
tokai235
0
160
SpecKitでどこまでできる? コストはどれくらい?
leveragestech
0
670
GitHub Actions × AWS OIDC連携の仕組みと経緯を理解する
ota1022
0
250
タスクの特性や不確実性に応じた最適な作業スタイルの選択(ペアプロ・モブプロ・ソロプロ)と実践 / Optimal Work Style Selection: Pair, Mob, or Solo Programming.
honyanya
3
160
なぜあの開発者はDevRelに伴走し続けるのか / Why Does That Developer Keep Running Alongside DevRel?
nrslib
3
390
GraphQL×Railsアプリのデータベース負荷分散 - 月間3,000万人利用サービスを無停止で
koxya
1
1.2k
Writing Better Go: Lessons from 10 Code Reviews
konradreiche
0
220
止められない医療アプリ、そっと Swift 6 へ
medley
1
150
Go言語の特性を活かした公式MCP SDKの設計
hond0413
1
230
アメ車でサンノゼを走ってきたよ!
s_shimotori
0
220
Featured
See All Featured
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
285
14k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
26
3.1k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
32
2.3k
The Invisible Side of Design
smashingmag
301
51k
Optimising Largest Contentful Paint
csswizardry
37
3.4k
Site-Speed That Sticks
csswizardry
11
890
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
9
970
Building an army of robots
kneath
306
46k
Building Applications with DynamoDB
mza
96
6.7k
Git: the NoSQL Database
bkeepers
PRO
431
66k
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.5k
Statistics for Hackers
jakevdp
799
220k
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