r/programming • • Feb 17 '16

Stack Overflow: The Architecture - 2016 Edition

http://nickcraver.com/blog/2016/02/17/stack-overflow-the-architecture-2016-edition/
1.7k Upvotes

461 comments sorted by

View all comments

1

u/pdbatwork Feb 17 '16 edited Feb 17 '16

here’s a day of statistics from February 9th

and

607,073,066 (+48,848,481) ms (168 hours) spent running SQL queries

Am I reading this wrong or are you suggesting we had a 168 hours long day February 9th?

I can't really read anywhere what these 168 hours covers?

EDIT: OK, now I feel stupid. 4 minutes and 5 people suggests it CPUhours.

17

u/nickcraver Feb 17 '16 edited Feb 17 '16

To clarify: This is the total wall time spent in a category, summed up from all requests that day. It is not CPU hours (that's higher, but more expensive to measure) as some assume. And we're handling many simultaneous requests. If someone has a way to concisely make this much clearer, I'll happily update the post. I'm just not sure how to be convey this without being more confusing.

Example requests:

  1. 10ms spent waiting on SQL (wall time)
  2. 11ms spent waiting on SQL (wall time)
  3. 14ms spent waiting on SQL (wall time)

Total: 35 ms of wall time combined, possibly in the same 14ms window - does that make sense?

8

u/contrarian_barbarian Feb 17 '16

I was wondering if this was the explanation. So essentially it's the sum total of all time threads on the web servers spent waiting for responses from the SQL servers?

8

u/nickcraver Feb 17 '16

Yeah that's a good way to think about it - we're literally starting and stopping a high resolution timer around every SQL call we make inside the application, via MiniProfiler.

11

u/Rhoomba Feb 17 '16

Multiple threads/processes/machines.

3

u/contrarian_barbarian Feb 17 '16 edited Feb 17 '16

They have 4 dedicated SQL boxes. 2 have 2x12 cores, 2 have 2x8 cores. Total of 40 cores, so 168 hours is actually about 4 hours per core per day, or ~18% average utilization (although they probably have certain times that are peak usage, so the utilization is likely significantly higher during these periods, plus you want enough excess capacity to cover if 1 or even 2 of those boxes are down).

4

u/notunlikethewaves Feb 17 '16

That's 168 hours in total, across all machines and all queries, many of which will be happening in parallel.

If you, I and eight others go get some shovels and spend 6 hours digging a ditch, then we collectively spent 60 hours on ditch-digging in total.

1

u/m1around Feb 17 '16

Best guess would be 'hours of cpu time' so with multiple cpus you can get > 24 hours.

1

u/vatara420 Feb 17 '16

I assume that is the combined processing time for all their SQL servers for that day.

1

u/grunzl Feb 17 '16

They run multiple SQL server instances ... or their servers are on Mercury or Venus (but the response time seems to reject that hypothesis).