News for hackers. Stuff that matters.
Re:You Are Not Google (2017) by chadash on Thursday April 04, 2019 @03:49PM (#19576396)
> As of 2016, Stack Exchange served 200 million requests per day, backed by just four SQL servers: a primary for Stack Overflow, a primary for everything else, and two replicas.

This was the most enlightening piece of the article for me. Their alexa rank today is 48 (globally, 38 in U.S.), so whatever your site is, you are probably not dealing with as heavy a load as them. What techniques do you have to employ to serve this many requests from a single database server?

Re:You Are Not Google (2017) by viraptor on Thursday April 04, 2019 @03:57PM (#19576466)
https://stackexchange.com/performance

https://nickcraver.com/blog/2016/02/17/stack-overflow-the-ar...

Lots of caching (redis, CloudFlare) and trying not to use the database unless absolutely necessary, I would expect.

Re:You Are Not Google (2017) by Just_Smith on Thursday April 04, 2019 @04:26PM (#19576748)
That's the beauty of serving mostly read-only data - you can just cache the most frequented pages. I can't think of a time that I clicked on a link for Stack Exchange that wasn't served via a search engine. I've never purposefully clicked a link from within Stack Exchange, and I've never posted any answers. I can thank those who do for enabling my success in my career, but I'm willing to bet that most Stack Exchange users are just like me.
Re:You Are Not Google (2017) by prawn on Thursday April 04, 2019 @07:15PM (#19578065)
"I've never purposefully clicked a link from within Stack Exchange..."

How do you resist those crazy unrelated questions in the sidebar? Currently shown for me:

  Did Shadowfax go to Valinor?
  Is it legal for company to use my work email to pretend I still work there?
  Why can't we play rap on piano?
  Can a virus destroy the BIOS of a modern computer?
Re:You Are Not Google (2017) by antipaul on Thursday April 04, 2019 @09:26PM (#19578820)
These became so distracting that I applied an Adblock filter to hide the “Hot Network Questions” div, lol!
Re:You Are Not Google (2017) by powvans on Friday April 05, 2019 @09:24PM (#19588554)
Ha! I do this too. Just the other day I was pair programming with someone who asked "why don't you have those super stupid questions on the right nav bar?"
Re:You Are Not Google (2017) by baroffoos on Friday April 05, 2019 @01:19AM (#19579920)
That sidebar is my biggest time waster in the day.
Re:You Are Not Google (2017) by kkarakk on Friday April 05, 2019 @02:45AM (#19580287)
They changed it so you can hide hot network questions(without any karma requirement)
Re:You Are Not Google (2017) by crayonixel on Friday April 05, 2019 @05:38AM (#19581022)
Thanks for pointing that out! Direct link for anyone else looking for it: https://stackoverflow.com/users/preferences
Re:You Are Not Google (2017) by borgel on Friday April 05, 2019 @12:42PM (#19584367)
I guess it's finally time to create an account!
Re:You Are Not Google (2017) by golergka on Friday April 05, 2019 @06:00AM (#19581116)
Well, thanks a lot, now I have no other choice but to google at least two of those.
Re:You Are Not Google (2017) by tinco on Thursday April 04, 2019 @08:12PM (#19578417)
That shadowfax one, quora is horrible that way too. You're interested in one bit of canon triva one time, and the site immediately assumes that particular story is all you want to read about, every day for months.

I bet gwaihir carried shadowfax to valinor.

Re:You Are Not Google (2017) by viraptor on Thursday April 04, 2019 @11:18PM (#19579369)
I don't think hot questions are tailored at all, are they? I often get questions from boards I never visited, so I assumed it's a global collection.
Re:You Are Not Google (2017) by flukus on Thursday April 04, 2019 @07:29PM (#19578170)
Also, caching at the correct granularity. I've seen too many systems that cache on a fine grained level and performance drops because because there are so many cache lookups, even with an in memory cache.
Re:You Are Not Google (2017) by oldprogrammer2 on Thursday April 04, 2019 @04:01PM (#19576498)
They have details here: https://nickcraver.com/blog/2016/02/17/stack-overflow-the-ar...

Lots of caching, lots of RAM, SSD storage, and a low-level ORM for SQL.

Re:You Are Not Google (2017) by merb on Thursday April 04, 2019 @04:36PM (#19576840)
well the "orm" is more like a database driver that can serialize to models than an orm.

but consider their stack there are better "starting" alternatives (they also used them before dapper), like Linq2Sql, EF Core, etc...

Also compared to other languages Linq and EF Core are way better than most alternatives (besides that some things are just not working, like lateral joins)

Re:You Are Not Google (2017) by bradlys on Thursday April 04, 2019 @03:59PM (#19576482)
Caching and a whole lot of it. Most of their pages could be served by a CDN.

How much do you think stack overflow is reading vs writing? How often do you even click a link from a stack overflow page once there?

Re:You Are Not Google (2017) by quickthrower2 on Thursday April 04, 2019 @04:19PM (#19576665)
Upvotes are clicked a lot but I guess they are just an api call and can be tuned to be high performance.
Re:You Are Not Google (2017) by bradlys on Thursday April 04, 2019 @04:30PM (#19576779)
I rarely click anything on stack overflow and neither do most people I know. The only ones I know who do that are stack overflow evangelists. I'd guess very few people have an account and use it.
Re:You Are Not Google (2017) by guelo on Thursday April 04, 2019 @05:00PM (#19577051)
I've taken to using upvotes for bookmarking, that way when I inevitably look the same question up again six months from now I'll know which of the answers I thought was most useful last time.
Re:You Are Not Google (2017) by quickthrower2 on Thursday April 04, 2019 @04:32PM (#19576798)
I’m in between. I have an SO score of just 1000, but I vote a lot. Mainly because I’m logged in via oauth anyway so it’s no hassle to do so.
Re:You Are Not Google (2017) by why-el on Thursday April 04, 2019 @07:38PM (#19578224)
Upvotes are actually ideal for an in-memory service like Redis that fsyncs less frequently. Even if you lose the last few reads (highly unlikely, with some care), it's not the end of the world.
Re:You Are Not Google (2017) by luckydata on Thursday April 04, 2019 @04:24PM (#19576720)
it's also not super critical to show correct numbers in real time for that so there's that.
Re:You Are Not Google (2017) by lossolo on Thursday April 04, 2019 @05:45PM (#19577413)
Well it's easier than you think (if you know what you are doing). I am serving around 90-100 mil requests per day from one 4-core xeon machine with most of the CPU idle. With around 2500 queries/s to redis and ~2k queries per second to postgres. App is written mostly in Go. A lot of those requests are updates.
Re:You Are Not Google (2017) by 72deluxe on Thursday April 04, 2019 @06:02PM (#19577548)
Where did you look for tuning Postgres? I am interested.
Re:You Are Not Google (2017) by Trisell on Thursday April 04, 2019 @07:45PM (#19578268)
I would love to know as well.
Re:You Are Not Google (2017) by qaq on Thursday April 04, 2019 @05:08PM (#19577130)
Well you have to remember that outside of cloud unknown blac kbox vcpus, generic networking setups and extremely underpowered storage options exist a different world where you can have a box with 200+ physical cores few TBS of RAM and extremely high performance storage
Re:You Are Not Google (2017) by altmind on Thursday April 04, 2019 @07:17PM (#19578078)
Well, regardless of caching and special ORM, doing 11K peak sql qps on 15% cpu load, is remarkable. They did a great job optimizing the database and access.

They probably also save a lot on ops team - running a single sql server with a failover is well-understood, error-resistant and covered in vendor's guides/best practices.

Re:You Are Not Google (2017) by Thaxll on Thursday April 04, 2019 @07:11PM (#19578030)
Except that Stack Exchange is a very static site so caching and read ratio is probably very high, I guess 99% of the people just type a question on Google land on SE and that's it.
Re:You Are Not Google (2017) by nerfhammer on Thursday April 04, 2019 @05:07PM (#19577124)
Simple: don't hit the database with every request. SO is mostly hosting static text content that updates infrequently and can be very heavily cached. You don't need to read the database to generate every pageview, quite the opposite.
Re:You Are Not Google (2017) by sparkling on Friday April 05, 2019 @05:50AM (#19581076)
While the 2 servers for StackOverflow is true, if i remember correctly those were two very, very, very beefy machines. Im talking 64 cores and 256GB RAM beefy bare metal, not your average random 4core/4gb VPS.
Re:You Are Not Google (2017) by wnevets on Thursday April 04, 2019 @04:33PM (#19576811)
and they're using that very un-hip microsoft .net
Re:You Are Not Google (2017) by freehunter on Thursday April 04, 2019 @04:45PM (#19576926)
Which goes to show that the answer to "what technology should I use to start my startup in [current year]" is always "the one you know best" since Joel was a former Microsoft employee before starting Stack Overflow and his other projects.
Re:You Are Not Google (2017) by hansflying on Thursday April 04, 2019 @06:24PM (#19577701)
C# is great. It's a high level programming language and it's also super-fast handling ~7.000.000 requests per second on a single server according to the following benchmark:

https://www.ageofascent.com/2019/02/04/asp-net-core-saturati...

Re:You Are Not Google (2017) by pradn on Thursday April 04, 2019 @05:13PM (#19577183)
C#/.NET can be super fun and productive. Use what you know.
Re:You Are Not Google (2017) by sergiotapia on Thursday April 04, 2019 @09:12PM (#19578726)
C# was great in 2008, then it got kind of enterprisey and closed - not it's ridiculous and getting steam into all avenues of software engineering. It's arguably the most powerful language in the world.
Re:You Are Not Google (2017) by manigandham on Thursday April 04, 2019 @10:39PM (#19579180)
How is it closed? It's now better than ever with the new cross-platform .NET Core with all kinds of runtime and language advancements.
Re:You Are Not Google (2017) by sergiotapia on Thursday April 04, 2019 @11:07PM (#19579321)
s/not/now
Re:You Are Not Google (2017) by gameswithgo on Friday April 05, 2019 @09:57AM (#19582504)
in the past two years .NET has become (normally/probably) the best performing GC runtime out there. With some nice features as well, and a better cross platform story.

hipness has increased

Re:You Are Not Google (2017) by manigandham on Thursday April 04, 2019 @10:29PM (#19579121)
It's the outcome of good architecture, application code, and the fact that single row lookups are already just as fast as a cache, especially in SQL Server running on highend hardware.

By the way, 200M is less than 2500 requests/second which is not much at all. In terms of actual throughput, they are not that big.

Re:You Are Not Google (2017) by arbuge on Thursday April 04, 2019 @10:37PM (#19579166)
> By the way, 200M is less than 2500 requests/second which is easily doable.

They are probably not spready uniformly throughout the day...

Re:You Are Not Google (2017) by manigandham on Thursday April 04, 2019 @10:43PM (#19579200)
They're also not all full page loads either. Their stats show only 66M of those 200M are pageviews.
Re:You Are Not Google (2017) by franzwong on Friday April 05, 2019 @02:21AM (#19580168)
It is difficult to make a conclusion. We can have a simple architecture but we spend 200% effort on tuning every part of the system.