Kaigai Blog living abroad in my twenties

Static and Dynamic Content

Infotech Networking

This is my note for studying “IT”. It’s basically made for myself.

Static and Dynamic Content

Static and Dynamic Content
When you open the website, a web server sends a website’s content to your browser. And this website’s content can be Static or Dynamic.

Contents

1. Static Content

Static Content
Static content is files that the server transfers just as they are stored on the web server, such as videos or images. 

Thus for instance, when you want to watch a video on a website and click the Play button, the request would be sent to the web server and the web server responds by sending the file to your browser.

2. Dynamic Content

Dynamic Content
Dynamic content is generated when the HTTP request is made. For example, the content may be generated based on input from a user, or when you visit a news website, it would be based on the current date. 

What actually happens, is that the web server communicates with another kind of server, called an application server or a back-end. 

The application server generates the dynamic content that the web server sends back to the user’s browser. 

Things you should know

  1. It typically takes longer to generate since dynamic content is generated while you use a website.
  2. Application servers perform more complex processing than web servers. For instance, they have to run the application logic, communicate with the database, and check permissions. To improve performance, different application servers have specific purposes.

3. Cache


Since dynamic content is slower to generate, It is a problem for big websites. Because Application servers typically have a limited capacity on how many requests they can process per second.

But fortunately, this is where the web server can help out. Web servers use a process called caching instead of generating content dynamically for every request. 

What is Caching?

Caching means the web server keeps a copy of dynamic content. If the content is requested again, the web server can immediately send this cached version instead of passing the request again to the application server. 

From this reason, before web server requests for dynamic content to the application server, they checks if the content exists in the cache. If it doesn’t exist, the content would be requested and stored in the cache after.

This reduces the amount of dynamic content that the application server has to generate. 

Then, after a period of time or with the next user interaction, the web server updates the cache with the latest content.