How I scaled a website to 10 million users (web-servers & databases, high load, and performance)

  1. Fronted -> Load balancer -> Web server (your main web server) -> a caching layer which is on the web server usually -> if data not in cache then calls database server

  2. Front end will receive where to get content -> calls Content delivery networks for content

Apache issue

For images on a server

You may run out of space on the server. You can use symbolic links to remote mount a file system such as your upload server. This allows for basically infinite disk space because you can keep mounting additional remote points that keep connecting to additional file systems.

Primary concern for scaling would be database server

Database server is most likely to collapse.

Data sharding

For real time chat

For realtime chat you have to hold onto database connection longer. Use some language optimized for handling multiple concurrent connections at the same time.:

Load Balancer

Caching layer

memcache on web server

Content delivery network

Amazon Web services and Google Services