美文网首页
2019-11-01

2019-11-01

作者: hell0_98a8 | 来源:发表于2019-11-01 00:09 被阅读0次

压测环境

机器 sim08 passenger
cpu:
mem:

PHP

  • 用的是phpbench,9k+条key,17种语言,一共10w+条文案

  • 压测结果
    迭代10次,每次迭代请求1w次,平均请求时间为3230ns

|---|---|---|
|revs|请求次数|10000|
|its|迭代次数|10|
|mem_peak|内存峰值|37,521,616b|
|cpu_peak|cpu峰值|61.5%|
|best|最短时间|2.608μs|
|mean|平均时间|3.230μs|
|mode|最频繁的时间|2.965μs|
|worst|最差时间|4.434μs|


```shell
1 subjects, 10 iterations, 10,000 revs, 0 rejects, 0 failures, 0 warnings

(best [mean mode] worst) = 2.608 [3.230 2.965] 4.434 (μs)

⅀T: 32.297μs μSD/r 0.532μs μRSD/r: 16.472%

suite: 1341737daa00882869b7c9270b9fbbb33683d31e, date: 2019-10-31, stime: 20:00:15

+-----------------+-------------------+--------+--------+-------+-----+-------------+---------+---------+---------+---------+---------+--------+-------+

| benchmark       | subject           | groups | params | revs  | its | mem_peak    | best    | mean    | mode    | worst   | stdev   | rstdev | diff  |

+-----------------+-------------------+--------+--------+-------+-----+-------------+---------+---------+---------+---------+---------+--------+-------+

| CopyWriterBench | benchGetPlainText |        | []     | 10000 | 10  | 37,521,616b | 2.608μs | 3.230μs | 2.965μs | 4.434μs | 0.532μs | 16.47% | 1.00x |

+-----------------+-------------------+--------+--------+-------+-----+-------------+---------+---------+---------+---------+---------+--------+-------+

```
  • 压测代码 benchMark
    /**
    * Class CopyWriterBench
    * @Iterations(10)
    * @Revs(10000)
    * @BeforeMethods({"init"})
    *
    */
    class CopyWriterBench
    {
        private $copyWriter;
    
        private $cases;
    
        private $keys;
    
        private $randomInts;
    
        private $langs;
    
        public function init() {
            $this->copyWriter = Copywriter::getCopywriterInstance(__DIR__.'/conf');
            $json_string = file_get_contents(__DIR__.'/cases.json');
            $this->cases = json_decode($json_string, true);
            $this->randomInts = array();
            for( $i=0; $i<count($this->cases); $i++) {
                array_push($this->randomInts, random_int(0, count($this->cases)));
            }
            $this->langs = array("es_pe","es_cr","en_br","es_ar","es_pa","ts_nl","en_au","pt_br","ja_jp","es_419","zh_tw",
            "zh_hk","en_us","es_mx","es_co","zh_cn","es_cl");
            $this->keys = array_keys($this->cases);
        }
    
        public function benchGetPlainText() {
            $aCase = 0;
            try
            {
                $aCase++;
                $randomInt = $this->randomInts[$aCase % count($this->cases)];
                $this->copyWriter->getPlainText($this->cases[$this->keys[$randomInt]], $this->langs[$randomInt%count($this->langs)]);
            } catch (Exception $e) {
                trigger_error("get copy writer error".$this->cases[$randomInt]);
                throwException($e);
            }
        }
    }
    

相关文章

  • 有关孩子的笔记和记录

    2019-11-01

  • 【SQL】

    插入一些内容 修改时间格式 int -> date 2019-11-01

  • hyperf| hyperf/metric 上手指南

    date: 2019-11-01 16:25:45title: hyperf| hyperf/metric 上手指...

  • 文先森的日常 -- 剩45天

    日精进打卡第447天 姓名:李文杰 (四爷); 公司:中国太平人寿; 日期:2019-11-01 【知~学习】 《...

  • Mixin 月报 — — 第 9 期

    2019-11-01 ~ 2019-11-30 Mixin 主网 主网高度 12,745,613(主网交易本月新增...

  • 上年度社平工资多少

    2019年洛阳市社保缴纳基数是多少 2019-11-01 浏览2531 2019年洛阳市社保缴纳基数是多少 ...

  • 找到习惯的切入点

    【成长日志】:2019-11-01 星期五 【学习方法】:系统读经第1084天。 雨宝:147累积法; 阳宝:1...

  • 买蟹记

    买蟹记 2019-11-01 23:01 上次做了些熟醉蟹,感觉没啥好吃,相反有些坏了醉蟹的名头。 今天买菜,看到...

  • 小米粒成长记 2019-11

    流水账似的记录,变成一颗颗珍珠,串成美丽的生活回忆。 ● 2019-11-01 学校的开放日活动,米粒穿着校服参加...

  • 《一帘水梦》

    《一 帘 水 梦》 文/闻禾 2019-11-01 把俏丽拿开, 请真实过来。 你以为你是谁? 雪啊 你以为你是谁...

网友评论

      本文标题:2019-11-01

      本文链接:https://www.haomeiwen.com/subject/mpvxbctx.html