Practical application example: After the homepage of is visited by one person, it doesn't matter where the person is, Shanghai, Beijing, Shenzhen, or the United States. The caching period within 3 hours, people from all countries in the world visit the homepage of the website again, and they only access the front-end Y server, while the data server X does not have any burden and the database is 0 pressure. After 3 hours, the first person to visit the homepage will go to data server X to read the real-time data and query the database once, and then within 3 hours, everyone else's access will be read from the front-end server Y. In other words, within 24 hours a day, the homepage should theoretically only have 8 access records in the data server X (24 divided by 3 equals 8), and all other accesses, whether it is thousands, tens of thousands, or millions of homepage visits, are the affairs of the front-end server Y. My profile, as follows:
Once we are set up, then look at the response header, as follows:
X-Cache-Status:MISS 这句话,表示,并没有从缓存里面读取数据,未命中的意思嘛。
Where does the problem arise? Is there a problem with the cache directory permissions that prevent writing to ???
Then, I modified the permissions of the cache directory, restarted nginx, and found that it still couldn't hit...
Finally, the solution is as follows:
Add the following sentence:
The complete configuration is as follows:
Attached is a screenshot of the hit:
|