3

I'd like to know how StackExchange works? Is it just one installation which is divided to different parts or they use a separated installation for each subject?

Askubuntu.com, tex.stackexchange.com, superuser.com, etc are integrated and authenticated well. Do they use their software categorizing system for it, Just think: Category=Forum and in this case rewriting URLs for subdomains, Or each of these websites are based on themselves?

migrated from stackoverflow.com Apr 11 '14 at 6:21

This question came from our site for professional and enthusiast programmers.

  • 3
    That sounds like a very different question than "How does StackExchange work?" – Nightfirecat Apr 13 '14 at 9:27
8

This answer is specifically for the Q&A sites, stackexchange.com, careers, etc. that are not Q&A have their own application pools.

Short version: We run everything in a multi-tenant architecture via a single application pool. We have 1 instance of that pool on multiple servers strictly for high availability (traffic load, rolling builds). To put it another way: if we bought a single web server with high-end processors today, we could probably run with just 1 web server. We can currently run with only 2 if we must.


We run the same application pool, one instance of it, on 11 IIS web servers.

Some are aware meta.stackoverflow.com (and soon meta.stackexchange.com instead) is special - it runs on ny-web10-11 where everything else runs on ny-web01-09. It has a few different settings (like no CDN) but really is just built out before the other 9 web servers are and that's where the load balancer sends the traffic for that host. This way we can test new code on a very informed and smaller audience before it goes to everyone.

As for the other sites, each site has it's own SQL & Redis database, static content folder, elastic index, and some rows in a global site database for things like site info, settings, user mappings, and a few other bits.

When a request comes to the application pool in IIS we look at the host header and determine what site you're hitting. From that we connect to the right DB, load the correct CSS, and things like that...it's not really complicated. We have a static accessor class called Current we use for this that hides all the logic, such as Current.Site, Current.DB, Current.User, etc.

Due to the way our load balancer setup prefers to sticky you to a site for Q&A, you're probably already hitting the same web server and the same app pool for any Stack Exchange Q&A website you're accessing.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .