Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Making GitLab Faster
Search
Yorick Peterse
June 04, 2016
Programming
490
2
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Making GitLab Faster
Talk given at RubyC 2016
Yorick Peterse
June 04, 2016
Transcript
69 slides
Making GitLab Faster
@yorickpeterse
[email protected]
GitLab Code, test, and deploy together
GitLab.com Statistics Users 544 306 Projects 955 340 Requests per
minute ~60 000 Storage ~30 TB
Response Timings Mean 350 ms 95th Percentile 1.23 s 99th
Percentile 3.17 s (backend only)
GitLab is slow, GitLab.com even more so
None
GitLab Problems
Limited production monitoring New Relic only on 1 out of
40 servers
No good development tools Only a collection of random Gems
No performance guides No guides on good/bad patterns, snippets to
use, workflow, etc
Lack of specialists Nobody was specifically focusing on performance
Badly Performing Code N+1 queries, inefficient algorithms, loading lots of
data into memory, etc
Solutions According to HackerNews
“Gitlab is one project that absolutely needs to be rebuilt
using Java. Both from a performance and a deployment perspective” https://news.ycombinator.com/item?id=11049717
“gogs was designed from the start to be fast. Nothing
but a rewrite would make GitLab as fast as gogs for basic stuff on small self-hosted servers.” https://news.ycombinator.com/item?id=11431410
Problem Solved! Let’s Rewrite GitLab in Java/Go/Haskell
Production Monitoring
Production monitoring is the first step to solving performance problems
GitLab’s Requirements 1. FOSS 2. Easy to set up 3.
Easy to query, visualize and add metrics 4. Low overhead 5. Support for percentiles
N-th percentile: N% of values are up to a given
value
“The 90th percentile is 1.5 seconds” means 90% completes in
1.5 seconds
GitLab Performance Monitoring
InfluxDB Time series DB with SQL-like query syntax
Grafana Time series visualization
Custom Ruby Code Used for measuring data, built from scratch
Transaction Metrics Rails, Grape, and Sidekiq
Code Region Metrics For measuring custom regions of code
Background Sampler Object counts, memory usage, GC statistics
None
None
Development Tools
Sherlock Development-only performance analysis, re-using the GitLab UI
1. Request details (URL, timings, etc) 2. Query timings, backtraces,
and EXPLAIN ANALYZE output 3. Line profiling
None
None
None
Documentation
GitLab Performance Guide Documents patterns to use/avoid, workflow, etc
http://docs.gitlab.com/ce/development/performance.html or https://is.gd/gitlab_webscale
Application Code
The language is rarely the problem
The database is not a black box
Rampant abuse of “pluck”
users.where(id: projects.pluck(:user_id))
users.where(id: projects.select(:user_id))
Combining Query Results
user.projects + public_projects + internal_projects
user.projects UNION public_projects UNION internal_projects
UNION not properly supported in ActiveRecord/Arel :<
Lots of Git Operations
if repo.exists? ... end
if repo.master_branch? foo end
Git Tag Existence https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/3983
if all_tags.include?(ref_name) => if tag_exists?(ref_name)
Markdown References https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/3969
for text in texts for reference in text process(reference)
process(texts)
1. Grab all references in a single pass 2. Query
any rows using the references 3. Replace text using the queried data
Calling “url_helpers” https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/3486
include app.routes.url_helpers
include Gitlab::Routing.url_helpers
def self.url_helpers @url_helpers ||= Gitlab::Application. routes.url_helpers end
Recap
Language/framework is usually only a problem when the application is
already fully optimized.
Take advantage of your database’s features
There is no silver bullet to fixing performance problems, it
simply takes time, effort, and patience.
Keep an eye on GitLab 8.9 for many performance improvements
Questions?
More Decks by Yorick Peterse
See All by Yorick Peterse
Garbage Collection Crash Course
yorickpeterse
1
410
Rubinius & The Eternal Yak
yorickpeterse
1
290
Oga
yorickpeterse
3
220
Parsing for Humans
yorickpeterse
2
120
Other Decks in Programming
See All in Programming
flutter_test のその先へ — Flutter アプリの LLM 機能に「評価」という品質保証を
kosukesaigusa
0
210
Spec-driven Development with AI
simas
PRO
0
2.3k
Math.sumPreciseから学ぶ、ECMAScript仕様の数値の種類
syumai
0
1.6k
テストだけで見つかる? Rubyでつくるメソッド発掘器
izawa
0
180
テスト駆動開発から学ぶ 達人プログラマーの型 / TechRAMEN 2026 Conference
a_okui
0
3.2k
仕様駆動開発入門 (何を作るかを先に決めて渡す) | 目指せ Kiro マスター 05
inariku
PRO
3
270
コード生成時代のAPI定義を支えるRequest Spec移行
pvcresin
0
320
マルチプロダクトSaaSの アプリ一覧を速くする——複数プロダクトにまたがる「権限行脚」を減らすまで #techramen26conf
mktakuya
1
270
観測者から当事者へ、AI 時代にドメインへ深入りする知識と技術 / From Observer to Practitioner: Going Deep into Domains in the Age of AI
nrslib
1
110
どうしても Eloquent でリポジトリパターンをやりたいんだ #phpcon_niigata / phpcon-niigata-2026
shogogg
0
710
baseline으로 마이그레이션, 리팩토링 안전하게 맡기기
fornewid
1
1.1k
Enforcing Your Architecture with Unit Tests in the AI Era (Swift Connection X)
steliosf
PRO
1
200
Featured
See All Featured
The untapped power of vector embeddings
frankvandijk
2
2k
How People are Using Generative and Agentic AI to Supercharge Their Products, Projects, Services and Value Streams Today
helenjbeal
2
410
Discover your Explorer Soul
emna__ayadi
2
1.4k
Tips & Tricks on How to Get Your First Job In Tech
honzajavorek
1
850
New Earth Scene 8
popppiees
5
2.9k
Designing for Timeless Needs
cassininazir
1
570
What’s in a name? Adding method to the madness
productmarketing
PRO
24
4.3k
Design of three-dimensional binary manipulators for pick-and-place task avoiding obstacles (IECON2024)
konakalab
0
680
The innovator’s Mindset - Leading Through an Era of Exponential Change - McGill University 2025
jdejongh
PRO
1
410
How To Speak Unicorn (iThemes Webinar)
marktimemedia
1
650
Web Performance Is a Journey [PerfNow 2026]
tammyeverts
3
190
Connecting the Dots Between Site Speed, User Experience & Your Business [WebExpo 2025]
tammyeverts
11
1.1k