java缓存http请求,一次HTTP请求会遇到哪些缓存

1,HTTP请求生命周期

68e95466d2571a550e9e8bca9589e5b5.png

The primary phases of the request lifecycle are:

Redirect

Immediately begins startTime.

If a redirect is happening, redirectStart begins as well.

If a redirect is occurring at the end of this phase then redirectEnd will be taken.

App Cache

If it’s application cache fulfilling the request, a fetchStart time will be taken.

DNS

domainLookupStart time is taken at the beginning of the DNS request.

domainLookupEnd time is taken at the end of the DNS request.

TCP

connectStart is taken when initially connecting to the server.

If TLS or SSL are in use then secureConnectionStart will start when the handshake begins for securing the connection.

connectEnd is taken when the connection to the server is complete.

Request

requestStart is taken once the request for a resource has been sent to the server.

Response

responseStart is the time when the server initially responds to the request.

responseEnd is the time when the request ends and the data is retrieved.

2,遇到的缓存

2.1, 应用的本地缓存,如 local storage, session_storage, cookie等;

2.2, DNS查找时的DNS缓存;

2.3, 请求到了服务器端,经过web server, 以nginx为例,有nginx的缓存;

2.4, 当nginx将请求交给项目进程时,进程管理工具cgi, fast-cgi, fpm(fast process manager),例如php-fpm,在执行PHP文件时,会进行语法分析,词法分析,语义分析,将文件转换成操作码opcode,如果开启了opcache,则直接使用opcache;

2.5, 请求到了项目时,框架自带的cache,如 Laravel的路由缓存, route cache等;

2.6, 框架处理请求,内部的NoSQL缓存;

2.7, DB操作,以MySQL默认的InnoDB存储引擎为例,它会对查询语句做缓存,所以我们经常会遇到,两条相同的SQL语句,第一次执行时稍微有点慢,第二次就比第一次快,是因为第一次执行完了后,InnoDB将查询结果缓存起来了。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值