M3- Static and dynamic content Flashcards

1
Q

What is static content?

A

Static content refers to files that are sent from the server to the browser exactly as they are stored. This includes files like HTML, images, videos, and stylesheets. Static content does not change based on user interactions or other factors.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

How is static content delivered?

A

When you request static content (e.g., clicking on a video), the web server sends the file directly to your browser without any modification.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is dynamic content?

A

Dynamic content is generated in real-time based on user input or other conditions. It changes depending on variables like user profiles or current date.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

How is dynamic content generated and delivered?

A

When you request dynamic content (e.g., personalized recommendations), the web server communicates with an application server to generate the content. The application server processes the request, creates the content, and sends it back to the web server, which then delivers it to your browser.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is the role of a web server?

A

The web server handles requests from the browser and serves static content directly. For dynamic content, it forwards requests to the application server.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is the role of an application server?

A

The application server generates dynamic content by executing application logic, querying databases, and performing complex tasks. It handles the processing required for user-specific data and interactions.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

How do web servers and application servers work together?

A

The web server serves static content directly to the browser. For dynamic content, it forwards the request to the application server, which generates the content. The application server then sends the content back to the web server, which delivers it to the browser.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Why can dynamic content take longer to generate than static content?

A

Dynamic content requires real-time processing, including running application logic and querying databases, which can be more time-consuming than serving static files.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is caching and how does it help with dynamic content?

A

Caching involves storing a copy of dynamically generated content. When the same content is requested again, the web server can quickly serve the cached version instead of regenerating it from scratch. This improves performance by reducing the load on the application server.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

How does caching work?

A

On the first request for dynamic content, the web server asks the application server to generate it. The content is then stored in the cache and sent to the browser. On subsequent requests, the web server serves the cached content, bypassing the application server.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

How Caching works (steps and alternatives)?

A

Step 1: User Makes a Request

  • Action: A user interacts with a website or application, requesting dynamic content (e.g., personalized recommendations, user-specific data).
  • Example: A user logs into their account to view their dashboard.

Step 2: Web Server Receives the Request

  • Action: The web server receives the request and determines that the content is dynamic and not stored as a static file.
  • Example: The web server recognizes that it needs to generate personalized content for the user’s dashboard.

Step 3: Check the Cache

  • Action: The web server checks if the requested content is already stored in the cache.
  • Example: The server looks up the cache to see if it has a recent copy of the user’s dashboard content.

Step 4: Cache Miss (Content Not Found)

  • If Cache Miss: The web server does not find the requested content in the cache.
  • Action: The server forwards the request to the application server to generate the content.
  • Example: The web server sends the request to the application server to generate the dashboard based on the user’s profile.

**Step 5: Application Server Generates Content
**
* Action: The application server processes the request, runs necessary logic, queries the database, and generates the dynamic content.
* Example: The application server creates the personalized dashboard content by retrieving data and applying logic.

Step 6: Store Content in Cache

  • Action: The web server receives the generated content from the application server and stores a copy of it in the cache.
  • Example: The dashboard content is saved in the cache so it can be quickly accessed for future requests.

Step 7: Send Content to User

  • Action: The web server sends the dynamically generated and cached content back to the user’s browser.
  • Example: The user’s dashboard is displayed on their screen.

Step 8: Cache Hit (Content Found)

  • If Cache Hit: The web server finds the requested content in the cache.
  • Action: The server directly sends the cached content to the user’s browser without querying the application server.
  • Example: If the user requests their dashboard again, the web server quickly serves the cached version.

Step 9: Cache Expiration and Update

  • Action: Cached content has a defined lifespan or may be updated periodically.
  • Expiration: The cache may expire after a set period, requiring regeneration of the content.
  • Update: New interactions or data changes may prompt an update to the cached content.
  • Example: If the user’s profile changes, the dashboard content in the cache will be updated to reflect the latest information.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

When is the cache updated?

A

The cache is updated periodically or when new interactions occur to ensure that the content remains current.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

How can I identify static and dynamic content on websites I visit?

A
  • Static Content: Images, videos, and downloadable files.
  • Dynamic Content: Personalized recommendations, news updates, and user-specific data.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly