为了账号安全,请及时绑定邮箱和手机立即绑定

php yac简单压测

标签:
PHP

个人PC4G内存,双核CPU

1、即写又读压测

<?php

$yac= new Yac();

for($i = 0; $i<1000; $i++) {

$key= "xxx". $i;

$value= str_repeat("x", $i);

if(!$yac->set($key, $value)) {

var_dump("write" . $i);

}

if($value != ($new = $yac->get($key))) {

var_dump("read" . $i);

}

}

var_dump($i);

linuxmintyac-master # ab -n 10000 -c 50 http://localhost/yac.php

Thisis ApacheBench, Version 2.3 <$Revision: 655654 $>

Copyright1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/

Licensedto The Apache Software Foundation, http://www.apache.org/


Benchmarkinglocalhost (be patient)

Completed1000 requests

Completed2000 requests

Completed3000 requests

Completed4000 requests

Completed5000 requests

Completed6000 requests

Completed7000 requests

Completed8000 requests

Completed9000 requests

Completed10000 requests

Finished10000 requests



ServerSoftware:    Apache/2.2.22

ServerHostname:    localhost

ServerPort:      80


DocumentPath:     /yac.php

DocumentLength:    98 bytes


ConcurrencyLevel:   50

Timetaken for tests:  138.244 seconds

Completerequests:   10000

Failedrequests:    6897

(Connect:0, Receive: 0, Length: 6897, Exceptions: 0)

Writeerrors:      0

Totaltransferred:   4499492 bytes

HTMLtransferred:    2382595 bytes

Requestsper second:  72.34 [#/sec] (mean)

Timeper request:    691.222 [ms] (mean)

Timeper request:    13.824 [ms] (mean, across all concurrent requests)

Transferrate:     31.78 [Kbytes/sec] received


ConnectionTimes (ms)

min mean[+/-sd] median  max

Connect:    0  0  0.1   0    2

Processing:  25 691 150.3  694  1403

Waiting:   25 653 139.1  657  1343

Total:    25 691 150.2  694  1403


Percentageof the requests served within a certain time (ms)

50%  694

66%  753

75%  792

80%  813

90%  869

95%  919

98%  981

99% 1032

100% 1403 (longest request)


2、只写压测

<?php

$yac= new Yac();

for($i = 0; $i<1000; $i++) {

$key= "xxx". $i;

$value= str_repeat("x", $i);

var_dump($yac->set($key,$value));

}

var_dump($i);

linuxmintyac-master # ab -n 10000 -c 50 http://localhost/yac.php

Thisis ApacheBench, Version 2.3 <$Revision: 655654 $>

Copyright1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/

Licensedto The Apache Software Foundation, http://www.apache.org/


Benchmarkinglocalhost (be patient)

Completed1000 requests

Completed2000 requests

Completed3000 requests

Completed4000 requests

Completed5000 requests

Completed6000 requests

Completed7000 requests

Completed8000 requests

Completed9000 requests

Completed10000 requests

Finished10000 requests



ServerSoftware:    Apache/2.2.22

ServerHostname:    localhost

ServerPort:      80


DocumentPath:     /yac.php

DocumentLength:    102098 bytes


ConcurrencyLevel:   50

Timetaken for tests:  87.220 seconds

Completerequests:   10000

Failedrequests:    0

Writeerrors:      0

Totaltransferred:   1022890000 bytes

HTMLtransferred:    1020980000 bytes

Requestsper second:  114.65 [#/sec] (mean)

Timeper request:    436.100 [ms] (mean)

Timeper request:    8.722 [ms] (mean, across all concurrent requests)

Transferrate:     11452.82 [Kbytes/sec] received


ConnectionTimes (ms)

min mean[+/-sd] median  max

Connect:    0  0  0.1   0    2

Processing:  15 436 130.0  433   903

Waiting:    1  27 64.8   3   369

Total:    15 436 130.0  433   904


Percentageof the requests served within a certain time (ms)

50%  433

66%  490

75%  523

80%  544

90%  599

95%  651

98%  706

99%  741

100%  904 (longest request)


3、只读压测

<?php

$yac= new Yac();

for($i = 0; $i<1000; $i++) {

$key= "xxx". $i;

$value= str_repeat("x", $i);

var_dump($yac->get($key));

}

var_dump($i);


linuxmintyac-master # ab -n 10000 -c 50 http://localhost/yac.php

Thisis ApacheBench, Version 2.3 <$Revision: 655654 $>

Copyright1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/

Licensedto The Apache Software Foundation, http://www.apache.org/


Benchmarkinglocalhost (be patient)

Completed1000 requests

Completed2000 requests

Completed3000 requests

Completed4000 requests

Completed5000 requests

Completed6000 requests

Completed7000 requests

Completed8000 requests

Completed9000 requests

Completed10000 requests

Finished10000 requests



ServerSoftware:    Apache/2.2.22

ServerHostname:    localhost

ServerPort:      80


DocumentPath:     /yac.php

DocumentLength:    499742 bytes


ConcurrencyLevel:   50

Timetaken for tests:  126.988 seconds

Completerequests:   10000

Failedrequests:    0

Writeerrors:      0

Totaltransferred:   4999330000 bytes

HTMLtransferred:    4997420000 bytes

Requestsper second:  78.75 [#/sec] (mean)

Timeper request:    634.939 [ms] (mean)

Timeper request:    12.699 [ms] (mean, across all concurrent requests)

Transferrate:     38445.90 [Kbytes/sec] received


ConnectionTimes (ms)

min mean[+/-sd] median  max

Connect:    0  0  0.1   0    2

Processing:  23 634 197.1  634  1578

Waiting:    1  24 85.3   1   597

Total:    23 634 197.1  634  1578


Percentageof the requests served within a certain time (ms)

50%  634

66%  722

75%  771

80%  802

90%  882

95%  950

98% 1019

99% 1068

100% 1578 (longest request)


总结:

1、为什么写比读还快呢,性能还好呢?

21000KEY4KEY的失败,返回null


点击查看更多内容
TA 点赞

若觉得本文不错,就分享一下吧!

评论

作者其他优质文章

正在加载中
  • 推荐
  • 评论
  • 收藏
  • 共同学习,写下你的评论
感谢您的支持,我会继续努力的~
扫码打赏,你说多少就多少
赞赏金额会直接到老师账户
支付方式
打开微信扫一扫,即可进行扫码打赏哦
今天注册有机会得

100积分直接送

付费专栏免费学

大额优惠券免费领

立即参与 放弃机会
意见反馈 帮助中心 APP下载
官方微信

举报

0/150
提交
取消