mature optimization (carlos bueno, facebook)
DESCRIPTION
HighLoad++ 2013TRANSCRIPT
Mature Optimization
Carlos Bueno <[email protected]>
FACT: You are not clairvoyant.
Who cares?
Very obvious!
The Plan 1: Measure Carefully. 2: ???? 3: Profit!
The Plan (revised) 0: Define the Problem. 1: Measure Carefully. 2: ???? 3: Profit!
Define the Problem. “WidgetFactoryServer is too slow!”
Define the Problem. “WidgetFactoryServer is too slow!” Problem definitions must be specific enough to suggest a way forward, and testable. You need a falsifiable statement.
Define the Problem. • WidgetFactoryServer is CPU-bound
• Run a profiler
• Optimize the slow functions
• CPU time should decrease
FACT: People have a lot of advice about writing fast programs. Most of it is horseshit.
HipHop Virtual Machine (HHVM)
C++
JIT
CPU Time
The Plan 0: Define the Problem. 1: Measure Carefully. 2: ???? 3: Profit!
Measure continuously.
Daily & Weekly Cycles
Collect RAW data, not metrics.
Record lots of metadata.
Directly measure what you are optimizing.
Distrust numbers. Especially your own.
“I don’t believe in the Performance Fairy.” Jeff Rothschild
Monitoring & Investigation
• Crashing is cheap.
• No errors logged, but no data returned.
• Did you buy faster servers?
• Did you turn off slower servers?
• Did some servers just die?
Choose metrics carefully.
Questions? carlos.bueno.org/optimization