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
CSC509 Lecture 05
javiergs
PRO
0
180
テスト駆動開発✅️
akitoshiga
1
170
UnJSで簡単に始めるCLIツール開発 / cli-tool-development-with-unjs
aoseyuu
2
380
Modern Angular with Lightweight Stores: New Rules and Options
manfredsteyer
PRO
0
170
書籍『LangChainとLangGraphによるRAG・AIエージェント[実践]入門』の紹介
os1ma
2
120
Debugging: A Few Things You Should Know
jmatsu
1
130
モジュラモノリス、その前に / Modular monolith, before that
euglena1215
8
750
CSC509 Lecture 03
javiergs
PRO
0
150
20241004 モノタロウ式~ドメインモデリングとリアーキテクチャ
monotaro
PRO
2
660
Kotlin Multiplatform at Stable and Beyond (Kotlin Vienna, October 2024)
zsmb
2
410
ActiveRecordの力でDBのメタデータを迅速に解析する
lnit
5
2k
デバッグの話 / Debugging for Beginners
kaityo256
PRO
8
730
Featured
See All Featured
Designing for Performance
lara
604
68k
Code Review Best Practice
trishagee
63
17k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
26
2k
Bootstrapping a Software Product
garrettdimon
PRO
305
110k
Become a Pro
speakerdeck
PRO
24
4.9k
Learning to Love Humans: Emotional Interface Design
aarron
272
40k
Imperfection Machines: The Place of Print at Facebook
scottboms
264
13k
How to train your dragon (web standard)
notwaldorf
87
5.6k
Thoughts on Productivity
jonyablonski
67
4.3k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
26
1.4k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
364
22k
Happy Clients
brianwarren
97
6.7k
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