Slide 1

Slide 1 text

The Architecture Of Marco Cecconi @sklivvz http://sklivvz.com

Slide 2

Slide 2 text

Sizing up the problem

Slide 3

Slide 3 text

No content

Slide 4

Slide 4 text

No content

Slide 5

Slide 5 text

*source: Quantcast, Alexa #56 network for traffic*

Slide 6

Slide 6 text

#56 network for traffic* …and #8 in Sweden!? *source: Quantcast, Alexa much successful very traffic TACK

Slide 7

Slide 7 text

520,523,008 pageviews in the last 30 days* *source: Quantcast

Slide 8

Slide 8 text

520,523,008 pageviews in the last 30 days* *source: Quantcast

Slide 9

Slide 9 text

So, how big is our datacenter?

Slide 10

Slide 10 text

No content

Slide 11

Slide 11 text

web servers load balancers redis search database http(s) http rest http protobuf sql sql protobuf tag engine

Slide 12

Slide 12 text

No content

Slide 13

Slide 13 text

We are still scaling up!

Slide 14

Slide 14 text

Our development cycle

Slide 15

Slide 15 text

BATCAVE Code-build-test cycle running on home machine feature requests

Slide 16

Slide 16 text

BATCAVE DEV.SO Test on the real servers git push

Slide 17

Slide 17 text

BATCAVE DEV.SO META.SE 1-click deploy Users test on meta.stackexchange.com (“baking”) git push

Slide 18

Slide 18 text

BATCAVE DEV.SO META.SE 1-click deploy HALP! git revert git push

Slide 19

Slide 19 text

BATCAVE DEV.SO NETWORK META.SE 1-click deploy git push 1-click deploy It’s live! Tons of users use it…

Slide 20

Slide 20 text

BATCAVE DEV.SO NETWORK META.SE 1-click deploy git push 1-click deploy …and provide new feature requests

Slide 21

Slide 21 text

Move fast and break things* * Not the home page or question page :-)

Slide 22

Slide 22 text

Move fast and break things* * Not the home page or question page :-)

Slide 23

Slide 23 text

Caching

Slide 24

Slide 24 text

Network Level Caches (CDN, etc.) Server Level Cache (HttpRuntime.Cache) Site Level Cache (Redis) SQL Server Database Cache (384 gigs of RAM!) Solid State Disk

Slide 25

Slide 25 text

No content

Slide 26

Slide 26 text

No content

Slide 27

Slide 27 text

No content

Slide 28

Slide 28 text

No content

Slide 29

Slide 29 text

Too Many Allocations This is really the most basic thing that can go wrong. Too Many Pointers If you create a data structure that is a large mesh of pointers you'll have two problems. First, there will be a lot of object writes […] and, secondly, when it comes time to collect that data structure, you will make the garbage collector follow all those pointers and if necessary change them all as things move around. […] But if you create such a structure on a transitory basis, […], then you will pay the cost much more often. http://msdn.microsoft.com/en-us/library/ms973837.aspx#dotnetgcbasics_topic2

Slide 30

Slide 30 text

Too Many Allocations This is really the most basic thing that can go wrong. Too Many Pointers If you create a data structure that is a large mesh of pointers you'll have two problems. First, there will be a lot of object writes […] and, secondly, when it comes time to collect that data structure, you will make the garbage collector follow all those pointers and if necessary change them all as things move around. […] But if you create such a structure on a transitory basis, […], then you will pay the cost much more often. http://msdn.microsoft.com/en-us/library/ms973837.aspx#dotnetgcbasics_topic2

Slide 31

Slide 31 text

No content

Slide 32

Slide 32 text

No content

Slide 33

Slide 33 text

No content

Slide 34

Slide 34 text

No content

Slide 35

Slide 35 text

Abuse caching for GC performance

Slide 36

Slide 36 text

Too Many Allocations This is really the most basic thing that can go wrong. Too Many Pointers If you create a data structure that is a large mesh of pointers you'll have two problems. First, there will be a lot of object writes […] and, secondly, when it comes time to collect that data structure, you will make the garbage collector follow all those pointers and if necessary change them all as things move around. […] But if you create such a structure on a transitory basis, […], then you will pay the cost much more often. http://msdn.microsoft.com/en-us/library/ms973837.aspx#dotnetgcbasics_topic2

Slide 37

Slide 37 text

Too Many Allocations This is really the most basic thing that can go wrong. Too Many Pointers If you create a data structure that is a large mesh of pointers you'll have two problems. First, there will be a lot of object writes […] and, secondly, when it comes time to collect that data structure, you will make the garbage collector follow all those pointers and if necessary change them all as things move around. […] But if you create such a structure on a transitory basis, […], then you will pay the cost much more often. http://msdn.microsoft.com/en-us/library/ms973837.aspx#dotnetgcbasics_topic2

Slide 38

Slide 38 text

No content

Slide 39

Slide 39 text

No content

Slide 40

Slide 40 text

IRepository orderRepository = container.Resolve>(); Order order = orderRepository.Get(35); This is what you think you are doing…

Slide 41

Slide 41 text

…but if you think about it a bit more…

Slide 42

Slide 42 text

...this is what you are actually doing! IRepository repository = new ValidatingOrderRepository ( new SecurityRepository ( new LoggingRepository ( new CachingRepository ( new NHibernateRepository () ) ) ) ); Order order = repository.Get(35);

Slide 43

Slide 43 text

We don’t use dependency- injection or IoC containers

Slide 44

Slide 44 text

Our source code

Slide 45

Slide 45 text

Few projects :-)

Slide 46

Slide 46 text

Few projects :-) Few lines of code :-)

Slide 47

Slide 47 text

Few projects :-) Few lines of code :-) Eeek! very few tests :-S

Slide 48

Slide 48 text

Few projects :-) Few lines of code :-) Awesome community to help :-D Eeek! very few tests :-S

Slide 49

Slide 49 text

YAGNI* * You Ain’t Gonna Need It!

Slide 50

Slide 50 text

Libraries and open source

Slide 51

Slide 51 text

* Source http://bit.ly/1eSLr8Z

Slide 52

Slide 52 text

No content

Slide 53

Slide 53 text

No content

Slide 54

Slide 54 text

No content

Slide 55

Slide 55 text

Wrap code in libraries and open source it

Slide 56

Slide 56 text

No content

Slide 57

Slide 57 text

No content

Slide 58

Slide 58 text

No content

Slide 59

Slide 59 text

DEEP DIVES

Slide 60

Slide 60 text

HIRE “A” PLAYERS

Slide 61

Slide 61 text

TOOLS LEVEL: NINJA

Slide 62

Slide 62 text

• Performance is a feature • Always. Be. Shipping. • Use your circumstances. • Open source your libraries • 3 obscenely big monitors. KEY TAKEAWAYS

Slide 63

Slide 63 text

No content

Slide 64

Slide 64 text

$_='Qgul=ar=ftq=pmk:=ftq=mooagzfmzf=puxqyym.=Guhqz=m=eqcgqzoq=ar= bduoqe,=IEzgyqdmnxq=ar=uzf=ruzp=ftq=rudef=N=ftmf=egy=fa=lqda,=itq dq=N=ue=m=bmdmy.=Ttq=xuef=yustf=zaf=nq=ruzufq=uz=eulq.=Sqzp=kagd= eaxgfuaz=fa=ewxuhhl&efmowahqdrxai.oay1';tr/=1m-za-l@&Z/ !a- zP@\n/&print; Marco Cecconi @sklivvz http://sklivvz.com