What happens after entering an URL
In general, there are following steps.
- TCP connection
- HTTP transaction
- TCP disconnection
In details,
-
Browser gets the IP address and port from URL.
DNS not only returns the server's IP address, but also the CDN's address where the static files are cached.
-
Browser establishs TCP connection by 3-ways handshake.
-
Browser sends http requests to the server.
-
Server receives the requests and sends the responses back.
- Once the server receive the requests. It will sends them the correct machine if a website has several machines.
- The host machine will first check the cache, such as Redis (memory-level), Varnish (disk-level). If the cache is found, return it.
- If the cache isn't found, the web application, such as Django, Tomcat, etc, takes cares of the requests. It may visit the database to get some data.
- The responses are sended back, and the caches in CDN are updated, too
-
Browser diconnects the server by 4-ways handshake.
-
Browser renders the responses.