3

I’ve been wondering about this for a little bit, but I couldn’t find much info on Google.

What do big websites like YouTube do to manage all the traffic they get without their website slowing down? How are their servers different than a home web server? Do their servers run off of one network from an ISP or something else?

Here’s an example: HQ Trivia. How do they get enough bandwidth to broadcast video to over a million people at once and not have too many issues?

Sorry if these are stupid questions-I’m pretty new to this.

user295021
  • 41
  • 2
  • 8
    These are not stupid questions, since it is quite complex to build a system which support so many users. But I also think the subject is too broad for a single question since it involves a lot of issues - server parks, distributed architecture, specialized hardware and so on. – JacquesB Feb 02 '18 at 08:31
  • This is an excellent resource for that question: https://www.amazon.com/High-Performance-Web-Sites-Essential/dp/0596529309/ref=sr_1_1 – Paul Feb 02 '18 at 21:05

1 Answers1

6

Application scalability is an enormous topic and not one that can really be addressed in a single post. However I'll have a crack at a basic explanation.

As you've implied most complex websites are scripts or programs which are executed on a server somewhere and HTML/Javascript (and others) are sent to a browser to interpret and render. Websites like amazon and facebook have millions of unique visitors each day.

To start off with yes, google's servers are no doubt considerably more powerful than your PC at home. However even they are not powerful enough to serve up so many http responses at once.

That's where server farms come in. If ten thousand users want to load the same website then a load balancer splits the traffic onto a number of different servers each of which can run the website.

To make things even more interesting these server farms do not have to all be located in one place, many huge organisations have their physical servers located around the globe allowing them to store and serve content from the one physically closest to the consuming computer (thanks for the suggestion amon).

There are a couple of challenges to overcome, if a user accesses server 462 on their first visit they may not necessarily hit the same server on their next request. Applications can either be designed to accommodate this (by avoiding things like session variables) or the load balancer can be configured to send returning users to the same server for the next page.

If all these servers access the same database under the covers then all the server farm may be doing is shifting the performance bottleneck from the web servers to the database. This is where microservice architecture (building a "website" from many tiny websites) can help as can distributed databases like MongoDB.

Many hosting providers nowadays (azure/AWS for example) prefer you deploy web applications to them rather than creating a website on a VM like you would if your company has it's own hosting. This is to allow them to scale up their infrastructure in demand to requirements - however these scale ups often come with cost implications.

TLDR

Many techniques are employed - load balancing, software architecture, and hosting considerations all play a part in building a robust system.

Liath
  • 3,406
  • 1
  • 21
  • 33
  • 1
    Good answer. One thing that's missing: content delivery networks. Youtube doesn't have a single data center that streams to all users, but streams from servers closer to the user. Here's a great and thorough discussion on [how Netflix does it](http://highscalability.com/blog/2017/12/11/netflix-what-happens-when-you-press-play.html). – amon Feb 03 '18 at 16:55
  • Google either has a single Data Center. Just for giving an idea of the size of some Data Centers, for instance, Google had (I don't know if they still have) a dedicated power plant. Definitively, this is not as simple as having a PC as these we have at home. – Laiv Feb 05 '18 at 09:53