Marco Cecconi
@sklivvz
http://sklivvz.com
ARCHITECTURE?
WHAT THE HECK IS
THAT?
In the past 12 months
• The Stack Exchange network grew from 130 to
150 sites (+15%)
• US site rank for visitors of the whole network
improved from #44 to #19 (-25 ranks)
Tight, tight, code cycles
BATCAVE
Code-build-test cycle
running on home machine
feature requests
BATCAVE DEV.SO
Test on the real servers
git push
BATCAVE DEV.SO
META.SE
1-click deploy
Users test on
meta.stackexchange.com
(“baking”)
git push
BATCAVE DEV.SO
META.SE
1-click deploy
HALP!
git revert
git push
BATCAVE DEV.SO
NETWORK META.SE
1-click deploy
git push
1-click
deploy
It’s live! Tons of users use it…
BATCAVE DEV.SO
NETWORK META.SE
1-click deploy
git push
1-click
deploy
…and
provide new
feature requests
Move fast and break things*
* Not the home page or question page :-)
Move fast and break things*
* Not the home page or question page :-)
“Normal” caching
Our frienemy:
The Garbage Collector
Too many objects instantiated
Caching abuse
Compliler abuse
Framework abuse
Complex instance
graph
Avoiding common patterns
IRepository<Order> orderRepository =
container.Resolve<IRepository<Order>>();
Order order = orderRepository.Get(35);
Dependency injection pattern
IRepository<Order> repository =
new ValidatingOrderRepository (
new SecurityRepository<Order> (
new LoggingRepository<Order> (
new CachingRepository<Order> (
new NHibernateRepository<Order> ()
)
)
)
);
Order order = repository.Get(35);
A look at our source code
Automated TESTERS
What we do test:
Open Source and Libraries
BOSS MODE CODE
BOSS MODE TOOLS
• Performance is a feature
• Always. Be. Shipping.
• Use your circumstances.
• Open source your libraries
• 3 obscenely big monitors.
KEY TAKEAWAYS
Marco Cecconi
@sklivvz
http://sklivvz.com
perl -wlne'BEGIN{$b=rand$=}$a=qw/To
lzhk_kypam_yr_qryaimtcpdjmu_bmr_amk_enq_ghqhmf
Cnvm/[($_<=>int$b)+1];$a=~y/a-zA-Z/b-zaB-ZA/;print $a'

Stack Overflow - It's all about performance / Marco Cecconi (Stack Overflow)