|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
小试一下身手,大概是没问题了,那么交给你个任务,做个留言本吧,这和HELLOWORLD有一比啊!^_^,同是新手面临的第一道关。js出了个nodejs,我们手艺老迈前段工夫发了个手艺邮件说php撑持多线程,异步,非堵塞还打着旗帜说要灭失落nodejs,官方网站上说swoole的功能已起码也和nodejs能够媲美了,这个必要用数听说话,周末的时分有空就随手测试了一下这两个东东!上面是测试呈报哈。
起首我用127.0.0.1:8000端口测试swoole,用127.0.0.1:1337测试nodejs
有图有原形:(稍后传,不会用mac把截图保留!汗!列位看客有谁会的教教我哈!编程都变傻了)
测试情况:
处置器:2.7GHzi7
内存:16GB1600hzDDR3
体系MACOSX
先放测试了局:
1.PHPswoole的测试了局:- ~mysql?ab-n5000-c100http://127.0.0.1:8000/ThisisApacheBench,Version2.3Copyright1996AdamTwiss,ZeusTechnologyLtd,http://www.zeustech.net/LicensedtoTheApacheSoftwareFoundation,http://www.apache.org/Benchmarking127.0.0.1(bepatient)Completed500requestsCompleted1000requestsCompleted1500requestsCompleted2000requestsCompleted2500requestsCompleted3000requestsCompleted3500requestsCompleted4000requestsCompleted4500requestsCompleted5000requestsFinished5000requestsServerSoftware:ServerHostname:127.0.0.1ServerPort:8000DocumentPath:/DocumentLength:0bytesConcurrencyLevel:100Timetakenfortests:1.411secondsCompleterequests:5000Failedrequests:0Writeerrors:0Totaltransferred:55330bytesHTMLtransferred:0bytesRequestspersecond:3543.00[#/sec](mean)Timeperrequest:28.225[ms](mean)Timeperrequest:0.282[ms](mean,acrossallconcurrentrequests)Transferrate:38.29[Kbytes/sec]receivedConnectionTimes(ms)minmean[+/-sd]medianmaxConnect:031.237Processing:172516.723143Waiting:1912.97136Total:202816.626143Percentageoftherequestsservedwithinacertaintime(ms)50%2666%2775%2780%2790%2895%2998%14199%142100%143(longestrequest)
复制代码 2.nodejs的测试了局:- ~mysql?ab-n5000-c100http://127.0.0.1:1337/ThisisApacheBench,Version2.3Copyright1996AdamTwiss,ZeusTechnologyLtd,http://www.zeustech.net/LicensedtoTheApacheSoftwareFoundation,http://www.apache.org/Benchmarking127.0.0.1(bepatient)Completed500requestsCompleted1000requestsCompleted1500requestsCompleted2000requestsCompleted2500requestsCompleted3000requestsCompleted3500requestsCompleted4000requestsCompleted4500requestsCompleted5000requestsFinished5000requestsServerSoftware:ServerHostname:127.0.0.1ServerPort:1337DocumentPath:/DocumentLength:12bytesConcurrencyLevel:100Timetakenfortests:1.215secondsCompleterequests:5000Failedrequests:0Writeerrors:0Totaltransferred:565000bytesHTMLtransferred:60000bytesRequestspersecond:4116.49[#/sec](mean)Timeperrequest:24.293[ms](mean)Timeperrequest:0.243[ms](mean,acrossallconcurrentrequests)Transferrate:454.26[Kbytes/sec]receivedConnectionTimes(ms)minmean[+/-sd]medianmaxConnect:000.605Processing:22421.021175Waiting:22420.821174Total:62420.921175Percentageoftherequestsservedwithinacertaintime(ms)50%2166%2275%2380%2490%2695%3298%15999%170100%175(longestrequest)
复制代码 下面的ab测试中:每秒100的并发量共向接口哀求5000次。PHP和nodejs成就都还不错,关头是Swoole的情况我用了--debug招致有良多命令会输入,临时有不会改归去,(稍后在公司测试情况从头测试下)
Timetakenfortests:1.411seconds共耗时
Requestspersecond:3543.00[#/sec](mean)
nodeJS
Timetakenfortests:1.215seconds共耗时
Requestspersecond:4116.49[#/sec](mean)
从测试了局来看,固然swoole的测试数据略微减色了一点,可是这其实不影响我对swoole的意见(何况设置大概不是很好),我觉的关于一个C言语编写的PHP,这个已比我们今朝的情况要好的多了。
培训的第四阶段,就是应用PHP语言开发实际的程序。以结合实际的项目开发来进行学习,效果真的很好,在学习完之后就开始练习,能比较容易掌握所学的知识,这是学校的学习所没法比的。 |
|