The investigation and analysis of the interface response data is constantly changing (within 5 minutes), and the root cause is the deployment problem of Varnish
1. Reference URL:https://www.shuijingwanwq.com/2021/11/10/5453/. A single data item in the list, after closing it in the background, should have been disappearing all the time. However, within a few minutes, it appears and disappears for a while. After about 5 minutes, it finally disappeared forever.
2. Search in the Rancher of K8s: Varnish, and find that there are 3 containers. as shown in Figure 1
3. Click to enter, make sure that there are 3 containers in running. as shown in Figure 2
4. Check the environment variables, app_checkinterval=10s. as shown in Figure 3
5. Varnish is a high-performance open source HTTP accelerator, which can effectively reduce the load of the web server and improve the access speed. According to the official statement, Varnish is a Cache-type HTTP reverse proxy. After deploying Varnish, the processing of the web request will be changed. The client’s request will be accepted by Varnish first. Varnish will analyze the received request and forward it to the backend web server. The web server at the backend performs the general processing of the request and returns the processing result to Varnish in turn. The core function of Varnish is to cache the results returned by the back-end web server. If the same request is found later, Varnish will not forward this request to the web server, but return the result in the cache. This will effectively reduce the load of the web server, increase the response speed, and can respond to more requests per second. Another main reason why Varnish is fast is that its cache is all in memory, which is much faster than on disk. The order of processing the cache: accepting the request —analyzing the request (analyzing your url, analyzing your header) — hash calculation — find cache — freshness detection — access source — cache — create response message – Respond and log the log.
6. If the request of a single URL passes through HA/F5 (load balancing) in the use of Varnish, the requested Varnish server is requested each time in a different Varnish server The server will be penetrated to the backend, and the same request will be cached on multiple servers, which will also cause the waste of Varnish cache resources and reduce performance. And because the cache in each Varnish server is different, the response data of the list interface is finally changed. Because each requested Varnish server is not the same. Therefore, if you want to cache the list interface at this stage, you need to configure it as a stand-alone deployment, because if the data in the list that should disappear, click to enter the details page and you will be prompted: The activity does not exist. If it is a cluster deployment, it is recommended to only support the details interface, etc.


