Nginx缓存命中分析

Nginx缓存命中分析

1、缓存命中分析方式

(1)方式一

        通过设置Response头信息Nginx-Cache

        add_header Nginx-Cache “$upstream_cache_status”

 

(2)方式二

       通过设置log_format打印日志分析

 

2、$upstream_cache_status详解

Nginx缓存命中分析

3、缓存命中配置

Nginx缓存命中分析

4、验证缓存命中配置是否生效

(1)第一次请求访问,Nginx-Cache:MISS

Nginx缓存命中分析

(2)第二次请求访问,Nginx-Cache:HIT

Nginx缓存命中分析

(3)第三次请求访问(删除Cache文件),Nginx-Cache:MISS

Nginx缓存命中分析

Nginx缓存命中分析