The primary phases of the request lifecycle are:php
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.nginx
2.1, 应用的本地缓存,如 local storage, session_storage, cookie等;web
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;cookie
2.5, 请求到了项目时,框架自带的cache,如 Laravel的路由缓存, route cache等;session
2.6, 框架处理请求,内部的NoSQL缓存;app
2.7, DB操做,以MySQL默认的InnoDB存储引擎为例,它会对查询语句作缓存,因此咱们常常会遇到,两条相同的SQL语句,第一次执行时稍微有点慢,第二次就比第一次快,是由于第一次执行完了后,InnoDB将查询结果缓存起来了。框架