• QPS、PV和需要部署机器数量计算公式(转)


    术语说明:
    QPS = req/sec = 请求数/秒

    【QPS计算PV和机器的方式】

    QPS统计方式 [一般使用 http_load 进行统计]
    QPS = 总请求数 / ( 进程总数 *   请求时间 )
    QPS: 单个进程每秒请求服务器的成功次数

    单台服务器每天PV计算
    公式1:每天总PV = QPS * 3600 * 6
    公式2:每天总PV = QPS * 3600 * 8

    服务器计算
    服务器数量 =   ceil( 每天总PV / 单台服务器每天总PV )

    【峰值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


    http://blog.hummingbird-one.com/?tag=web-%E6%80%A7%E8%83%BD-qps-%E7%AD%89%E5%BE%85%E6%97%B6%E9%97%B4


    Mysql的Innodb是有TPS的,要是MyISM的话用下面的脚本:(来自网络)
    QPS (Query per second) (每秒查询量)
    TPS(Transaction per second) (每秒事务量,如果是InnoDB会显示,没有InnoDB就不会显示)

    计算方法
    ___________________________________________________________
    QPS
    Questions = SHOW GLOBAL STATUS LIKE 'Questions';
    Uptime = SHOW GLOBAL STATUS LIKE 'Uptime';
    QPS=Questions/Uptime
    TPS
    Com_commit = SHOW GLOBAL STATUS LIKE 'Com_commit';
    Com_rollback = SHOW GLOBAL STATUS LIKE 'Com_rollback';
    Uptime = SHOW GLOBAL STATUS LIKE 'Uptime';
    TPS=(Com_commit + Com_rollback)/Uptime 

    MySQL的QPS计算
    show global status where Variable_name in('com_select','com_insert','com_delete','com_update');
    等待10秒
    show global status where Variable_name in('com_select','com_insert','com_delete','com_update');
    计算差值
    MySQL的TPS计算
    show global status where Variable_name in('com_insert','com_delete','com_update');
    等待10秒
    show global status where Variable_name in('com_insert','com_delete','com_update');
    计算差值

    http://www.justwinit.cn/post/6218/

  • 相关阅读:
    Linux split分割xls或csv文件
    python安装mysql/mysqlclient 无法打开mysql.h问题解决(win10 64位 )
    Linux Centos 7 安装文件服务器MinIO
    RabbitMQ——Virtual Host
    vue中的for循环数组数据时,修改了数组中的值页面不重新渲染for循环节点数据的问题
    vue刷新数组 Y
    uniapp返回上一页并传参
    linux常用命令基础
    如何解压带密码的压缩包
    hive 视图的使用方法
  • 原文地址:https://www.cnblogs.com/jouny/p/4126556.html
Copyright © 2020-2023  润新知