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
Go for speed
Search
Nick Bruun
September 18, 2014
Programming
0
130
Go for speed
A look at a use case for Go at Iconfinder, which shaved ~40 ms off asset load times.
Nick Bruun
September 18, 2014
Tweet
Share
More Decks by Nick Bruun
See All by Nick Bruun
The evolution of the Web stack
nickbruun
0
160
Getting to the post-industrial age of DevOps
nickbruun
2
120
At løbe med sakse (Danish)
nickbruun
1
190
Lessons learned defying Joel Spolsky with Django
nickbruun
145
35k
Other Decks in Programming
See All in Programming
Grafana Cloudとソラカメ
devoc
0
170
SwiftUIで単方向アーキテクチャを導入して得られた成果
takuyaosawa
0
270
Flutter × Firebase Genkit で加速する生成 AI アプリ開発
coborinai
0
160
苦しいTiDBへの移行を乗り越えて快適な運用を目指す
leveragestech
0
580
CDK開発におけるコーディング規約の運用
yamanashi_ren01
2
120
Grafana Loki によるサーバログのコスト削減
mot_techtalk
1
130
Pulsar2 を雰囲気で使ってみよう
anoken
0
240
Pythonでもちょっとリッチな見た目のアプリを設計してみる
ueponx
1
560
Boost Performance and Developer Productivity with Jakarta EE 11
ivargrimstad
0
250
富山発の個人開発サービスで日本中の学校の業務を改善した話
krpk1900
4
390
時計仕掛けのCompose
mkeeda
1
300
dbt Pythonモデルで実現するSnowflake活用術
trsnium
0
150
Featured
See All Featured
A better future with KSS
kneath
238
17k
Reflections from 52 weeks, 52 projects
jeffersonlam
348
20k
Thoughts on Productivity
jonyablonski
69
4.5k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
233
17k
Testing 201, or: Great Expectations
jmmastey
42
7.2k
VelocityConf: Rendering Performance Case Studies
addyosmani
328
24k
Product Roadmaps are Hard
iamctodd
PRO
50
11k
Building an army of robots
kneath
303
45k
Documentation Writing (for coders)
carmenintech
67
4.6k
Navigating Team Friction
lara
183
15k
Code Reviewing Like a Champion
maltzj
521
39k
A designer walks into a library…
pauljervisheath
205
24k
Transcript
Go for speed
Nick Bruun github.com/nickbruun @nickbruun bruun.co CTO @ Iconfinder Fairly carnivorous
None
None
None
Trouble in icon paradise
None
None
None
None
41 ms average response time from Django application during peak
hours
~2,000 ms wasted per search
Perceivably slower
The internals
None
Icon ID Icon version ID Raster size https://www.iconfinder.com/icons/298255/677266/128/raster https://cdn0.iconfinder.com/data/icons/seo-smart-pack/128/ grey_new_seo2-43-128.png
Public raster URL Protected raster URL
None
Constant
Signing requests
https://www.iconfinder.com/icons/298255/677266/128/raster?token=…
None
we know if the user has access right now When
returning the link,
we know if the user has access right now When
returning the link,
We’re okay with “right now” being an approximation
Time limited token
<token secret> = "<expiration timestamp>-<session ID>-<nonce>-<URL>"
<token secret> = "<expiration timestamp>-<session ID>-<nonce>-<URL>" <signature> = hmac_sha1(<token secret>,
<shared secret>)
<token secret> = "<expiration timestamp>-<session ID>-<nonce>-<URL>" <signature> = hmac_sha1(<token secret>,
<shared secret>) <token> = "<expiration timestamp>-<nonce>-base64(<signature>)"
But, who checks the token?
Enter Go The World’s least Google-able language… from Google
None
Why Go?
Networked service
Highly concurrent ~3,000 requests/second from 100 connections/core
Low memory footprint 14.09 MiB after 21 days
Low CPU usage
Static binary Cross-compilation = deployment heaven
Less decisions to make
Caveats
Structured logging
DIY
Mature runtime != Mature language
Conciseness 608 lines of code
The end result
1.2 ms average response time at peak hours
0.1 % CPU usage at peak hours
Go is awesome
Go is awesome for simple services
Go is a trade-off
Go is a trade-off – choose wisely
return