当前位置:首页 > Web开发 > 正文

这20%时间叫做峰值时间 公式:( 总PV数 * 80% ) / ( 每天秒数 * 20% ) = 峰值时间每秒请求数(

2024-03-31 Web开发

每秒盘问率QPS是对一个特定的盘问处事器在规按时间内所措置惩罚惩罚流量几多的衡量标准,在因特网上,作为域名系统处事器的机器的性能经常用每秒盘问率来衡量。

道理:每天80%的访谒集中在20%的时间里,这20%时间叫做峰值时间
公式:( 总PV数 * 80% ) / ( 每天秒数 * 20% ) = 峰值时间每秒请求数(QPS)
机器:峰值时间每秒QPS / 单台机器的QPS = 需要的机器

问:每天300w PV 的在单台机器上,这台机器需要几多QPS?
答:( 3000000 * 0.8 ) / (86400 * 0.2 ) = 139 (QPS)

问:如果一台机器的QPS是58,需要几台机器来撑持?
答:139 / 58 = 3

 

 

1、观点:

UV(Unique Visitor):独立访客,,将每个独立上网电脑(以cookie为依据)视为一位访客,一天之内(00:00-24:00),访谒您网站的访客数量。一天之内不异cookie的访谒只被计算1次;

PV(Page View):访谒量,即页面浏览量或者点击量,用户每次对网站的访谒均被记录1次。用户对同一页面的多次访谒,访谒量值累计;

统计独立IP:00:00-24:00内不异IP地点只被计算一次,做网站优化的伴侣最关心这个;

2、日志输格外式:

172.16.0.70 - - [03/Jan/2019:23:57:20 +0800] "GET / HTTP/1.1" 302 0 "-" "Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; Trident/6.0)"
172.16.0.70 - - [03/Jan/2019:23:57:20 +0800] "GET /ljzx HTTP/1.1" 302 5 "-" "Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; Trident/6.0)"
172.16.0.70 - - [03/Jan/2019:23:57:20 +0800] "GET /ljzx/ HTTP/1.1" 302 0 "-" "Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; Trident/6.0)"
172.16.0.70 - - [03/Jan/2019:23:57:20 +0800] "GET /ljzx/logout HTTP/1.1" 200 9228 "-" "Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; Trident/6.0)"
172.16.0.70 - - [03/Jan/2019:23:58:20 +0800] "GET / HTTP/1.1" 302 0 "-" "Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; Trident/6.0)"
172.16.0.70 - - [03/Jan/2019:23:58:20 +0800] "GET /ljzx HTTP/1.1" 302 5 "-" "Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; Trident/6.0)"

...

3、统计

总PV量:

  [[email protected] logs]# awk ‘{print $6}‘ host.access.log | wc -l


独立IP:

  [[email protected] logs]# awk ‘{print $1}‘ host.access.log | sort -r |uniq -c | wc -l


UV统计:

  [[email protected] logs]# awk ‘{print $10}‘ host.access.log | sort -r |uniq -c |wc -l

 

摘自

https://www.cnblogs.com/cangqiongbingchen/p/6434509.html

https://www.cnblogs.com/weiyiming007/p/10272258.html

 

网站qps计算要领

温馨提示: 本文由Jm博客推荐,转载请保留链接: https://www.jmwww.net/file/web/30037.html