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
55
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
130
Other Decks in Programming
See All in Programming
SymfonyCon Vienna 2025: Twig, still relevant in 2025?
fabpot
3
1.2k
Cloudflare MCP ServerでClaude Desktop からWeb APIを構築
kutakutat
1
530
Symfony Mapper Component
soyuka
2
730
プロダクトの品質に コミットする / Commit to Product Quality
pekepek
2
770
ソフトウェアの振る舞いに着目し 複雑な要件の開発に立ち向かう
rickyban
0
890
As an Engineers, let's build the CRM system via LINE Official Account 2.0
clonn
1
670
あれやってみてー駆動から成長を加速させる / areyattemite-driven
nashiusagi
1
200
CSC305 Lecture 25
javiergs
PRO
0
130
わたしの星のままで一番星になる ~ 出産を機にSIerからEC事業会社に転職した話 ~
kimura_m_29
0
180
今からはじめるAndroidアプリ開発 2024 / DevFest 2024
star_zero
0
1k
htmxって知っていますか?次世代のHTML
hiro_ghap1
0
330
create_tableをしただけなのに〜囚われのuuid編〜
daisukeshinoku
0
240
Featured
See All Featured
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
5
440
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
191
16k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
132
33k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
47
5.1k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
26
1.9k
Producing Creativity
orderedlist
PRO
341
39k
Typedesign – Prime Four
hannesfritz
40
2.4k
What’s in a name? Adding method to the madness
productmarketing
PRO
22
3.2k
Learning to Love Humans: Emotional Interface Design
aarron
273
40k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
507
140k
Docker and Python
trallard
42
3.1k
The Invisible Side of Design
smashingmag
298
50k
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