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
150
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
バグを見つけた?それAppleに直してもらおう!
uetyo
0
180
コンテナをたくさん詰め込んだシステムとランタイムの変化
makihiro
1
120
tidymodelsによるtidyな生存時間解析 / Japan.R2024
dropout009
1
770
PHPで作るWebSocketサーバー ~リアクティブなアプリケーションを知るために~ / WebSocket Server in PHP - To know reactive applications
seike460
PRO
2
120
nekko cloudにおけるProxmox VE利用事例
irumaru
3
420
Mermaid x AST x 生成AI = コードとドキュメントの完全同期への道
shibuyamizuho
0
160
Webエンジニア主体のモバイルチームの 生産性を高く保つためにやったこと
igreenwood
0
330
LLM Supervised Fine-tuningの理論と実践
datanalyticslabo
4
1.1k
Jakarta EE meets AI
ivargrimstad
0
240
MCP with Cloudflare Workers
yusukebe
2
220
rails statsで大解剖 🔍 “B/43流” のRailsの育て方を歴史とともに振り返ります
shoheimitani
2
930
テストケースの名前はどうつけるべきか?
orgachem
PRO
0
130
Featured
See All Featured
GraphQLとの向き合い方2022年版
quramy
44
13k
Building an army of robots
kneath
302
44k
Mobile First: as difficult as doing things right
swwweet
222
9k
Making Projects Easy
brettharned
116
5.9k
The Power of CSS Pseudo Elements
geoffreycrofte
73
5.4k
GraphQLの誤解/rethinking-graphql
sonatard
67
10k
Building Applications with DynamoDB
mza
91
6.1k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
229
52k
Done Done
chrislema
181
16k
Documentation Writing (for coders)
carmenintech
66
4.5k
The Illustrated Children's Guide to Kubernetes
chrisshort
48
48k
Bash Introduction
62gerente
608
210k
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