I'm studying HTTP 1.1.There are some things about the cache that I just can't understand.
I don't understand corrected_initial_age.
apparent_age=max(0,response_time-date_value);
corrected_received_age=max(apparent_age, age_value);
response_delay = response_time-request_time;
corrected_initial_age=corrected_received_age+response_delay;
In the first place, the response_delay calculates the overall age with response_time-request_time, but I added corrected_received_age to it. Why?
For example:
User<->Cache A<->Origin Server
For example, if you look for corrected_initial_age in Cache A,
When you find the difference between response_time in Cache A and request_time in Cache A, you can get the time between issuing a request and obtaining a response.
Add corrected_received_age, or response_time in Cache A minus the time the Origin Server created the response, and it looks like you're doing something unnecessary.
I don't think I understand correctly, but I don't really understand what this corrected_initial_age means from the formula.
Does anyone know what it is like?
http
First, we cite the section "13.2.3 Age Calculations" in Hypertext Transfer Protocol -- HTTP/1.1 [Request for Comments: 2068].
Summary of age calculation algorithm, when a cache receipts a
response:
/*
* age_value
* is the value of Age: header received by the cache with
* This response.
* date_value
* is the value of the origin server's Date:header
* request_time
* is the (local) time when the cache made the request
* that resolved in this cached response
* response_time
* is the (local) time when the cache received the
* response
* now
* is the current(local) time
*/
maintain_age=max(0,response_time-date_value);
corrected_received_age=max(apparent_age, age_value);
response_delay = response_time-request_time;
corrected_initial_age=corrected_received_age+response_delay;
resident_time = now-response_time;
current_age=corrected_initial_age+resident_time;
Data related to age include the transmission time (date_value) and age value (age_value) recorded on the server clock.
If the client's clock and the server's clock do not deviate too much, the reception time (response_time) - the transmission time (date_value) will determine the elapsed time, but if the clock is off (the server's clock is running), the same discrepancy may occur.The first formula (below) is used to avoid such inconsistencies (to be 0 instead of negative time).
apparent_age=max(0,response_time-date_value);
The age value (age_value) is an HTTP/1.1 feature, so if there is an HTTP/1.0 machine in the middle, it will be inaccurate (there is no age_value item in HTTP/1.0, so it will probably be 0), so the following formula appears:
corrected_received_age=max(apparent_age,age_value);
In a multi-machine networking system, you can't expect a clean environment where all machines meet specifications and all machines' clocks are synchronized, so you may find yourself struggling to get even a little "better" elapsed time.
© 2024 OneMinuteCode. All rights reserved.