>  기사  >  웹 프론트엔드  >  MixPHP, Yii 및 CodeIgniter에 대한 동시성 스트레스 테스트 요약 공유 예

MixPHP, Yii 및 CodeIgniter에 대한 동시성 스트레스 테스트 요약 공유 예

小云云
小云云원래의
2018-01-16 13:28:531489검색

MixPHP는 Swoole 기반의 고성능 프레임워크이고, CodeIgniter는 베테랑 경량 프레임워크이며, Yii는 매우 인기 있는 프레임워크입니다. 이번 글에서는 MixPHP, Yii, CodeIgniter의 동시성 스트레스 테스트에 대한 관련 정보를 주로 소개합니다. 이 글은 예제 코드를 통해 자세히 소개하고 있으며, 이를 필요로 하는 모든 사람의 학습이나 작업에 도움이 됩니다. 소규모로 함께 배워봅시다.

머리말

Yii/CodeIgniter는 Apache/PHP-FPM을 기반으로 하는 전통적인 프레임워크이기 때문에 MixPHP의 일반적인 Swoole 배포 방법을 사용하여 비교하는 것은 약간 불공평합니다. MixPHP도 Apache/PHP-FPM에서 실행을 지원하므로, 그래서 이번에 테스트한 MixPHP는 Apache에 배포되었습니다.

환경

가상 머신: 4코어, 1G

스트레스 테스트에 ab 도구를 사용하세요. 명령: ab -n 5000 -c 100 URL

Yii

Yii 디버그를 끄고 프로 환경으로 설정하세요.

기본 컨트롤러 코드는 다음과 같으며 Hello World를 출력합니다.

<?php public function actionIndex() { return &#39;Hello World&#39;; }

CodeIgniter

기본 컨트롤러 코드는 다음과 같으며 Hello World를 출력합니다.

<?php public function index() { echo &#39;Hello World&#39;; }

MixPHP

기본 컨트롤러 코드는 다음과 같으며 Hello World를 출력합니다.

public function actionIndex() { return &#39;Hello World&#39;; }

테스트 시작

1. 테스트 Yii, QPS: 56.40

C:/Server/apache24vc11/bin>ab -n 5000 -c 100 http://www.b.com/ This is ApacheBench, Version 2.3 <$Revision: 1757674 $> Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ Licensed to The Apache Software Foundation, http://www.apache.org/ Benchmarking www.b.com (be patient) Completed 500 requests Completed 1000 requests Completed 1500 requests Completed 2000 requests Completed 2500 requests Completed 3000 requests Completed 3500 requests Completed 4000 requests Completed 4500 requests Completed 5000 requests Finished 5000 requests Server Software: Apache/2.2.32 Server Hostname: www.b.com Server Port:  80 Document Path:  / Document Length: 9 bytes Concurrency Level: 100 Time taken for tests: 88.659 seconds Complete requests: 5000 Failed requests: 0 Total transferred: 1080000 bytes HTML transferred: 45000 bytes Requests per second: 56.40 [#/sec] (mean) Time per request: 1773.170 [ms] (mean) Time per request: 17.732 [ms] (mean, across all concurrent requests) Transfer rate:  11.90 [Kbytes/sec] received Connection Times (ms)  min mean[+/-sd] median max Connect: 0 0 1.0 1 29 Processing: 14 1765 4200.5 688 48084 Waiting: 14 1610 3741.9 682 46690 Total:  14 1766 4200.5 688 48084 WARNING: The median and mean for the initial connection time are not within a normal deviation  These results are probably not that reliable. Percentage of the requests served within a certain time (ms) 50% 688 66% 1087 75% 1400 80% 1657 90% 3029 95% 7665 98% 14760 99% 24300 100% 48084 (longest request)

2. 테스트 CodeIgniter, QPS: 144.42

C:/Server/apache24vc11/bin>ab -n 5000 -c 100 http://www.c.com/ This is ApacheBench, Version 2.3 <$Revision: 1757674 $> Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ Licensed to The Apache Software Foundation, http://www.apache.org/ Benchmarking www.c.com (be patient) Completed 500 requests Completed 1000 requests Completed 1500 requests Completed 2000 requests Completed 2500 requests Completed 3000 requests Completed 3500 requests Completed 4000 requests Completed 4500 requests Completed 5000 requests Finished 5000 requests Server Software: Apache/2.2.32 Server Hostname: www.c.com Server Port:  80 Document Path:  / Document Length: 8 bytes Concurrency Level: 100 Time taken for tests: 34.621 seconds Complete requests: 5000 Failed requests: 0 Total transferred: 1075000 bytes HTML transferred: 40000 bytes Requests per second: 144.42 [#/sec] (mean) Time per request: 692.419 [ms] (mean) Time per request: 6.924 [ms] (mean, across all concurrent requests) Transfer rate:  30.32 [Kbytes/sec] received Connection Times (ms)  min mean[+/-sd] median max Connect: 0 0 0.7 1 22 Processing: 8 689 1014.3 480 13324 Waiting: 8 686 1012.2 478 13324 Total:  9 689 1014.3 480 13325 WARNING: The median and mean for the initial connection time are not within a normal deviation  These results are probably not that reliable. Percentage of the requests served within a certain time (ms) 50% 480 66% 673 75% 810 80% 902 90% 1238 95% 1808 98% 3336 99% 6037 100% 13325 (longest request)

3 테스트 MixPHP, QPS: 440.48

C:/Server/apache24vc11/bin>ab -n 5000 -c 100 http://www.a.com/ This is ApacheBench, Version 2.3 <$Revision: 1757674 $> Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ Licensed to The Apache Software Foundation, http://www.apache.org/ Benchmarking www.a.com (be patient) Completed 500 requests Completed 1000 requests Completed 1500 requests Completed 2000 requests Completed 2500 requests Completed 3000 requests Completed 3500 requests Completed 4000 requests Completed 4500 requests Completed 5000 requests Finished 5000 requests Server Software: Apache/2.2.32 Server Hostname: www.a.com Server Port:  80 Document Path:  / Document Length: 12 bytes Concurrency Level: 100 Time taken for tests: 11.351 seconds Complete requests: 5000 Failed requests: 0 Total transferred: 1025000 bytes HTML transferred: 60000 bytes Requests per second: 440.48 [#/sec] (mean) Time per request: 227.026 [ms] (mean) Time per request: 2.270 [ms] (mean, across all concurrent requests) Transfer rate:  88.18 [Kbytes/sec] received Connection Times (ms)  min mean[+/-sd] median max Connect: 0 1 0.9 1 25 Processing: 4 222 822.4 15 10376 Waiting: 4 221 822.4 14 10376 Total:  4 222 822.4 16 10376 Percentage of the requests served within a certain time (ms) 50% 16 66% 69 75% 214 80% 364 90% 561 95% 762 98% 978 99% 1829 100% 10376 (longest request)

결론

가상 머신 파일 IO 성능 300개 동시 실행 시 Yii가 응답하지 않아서 100개 동시 실행으로 줄여야 했던 것이 동일 아키텍처의 테스트 결과 MixPHP가 앞서는 것이었습니다.

테스트할 수도 있습니다. https://github.com/mixstart/mixPHP

ITEM DESC
Yii 56.40 QPS
CodeIgnit er 144.42 QPS
MixPHP 440.48 QPS

관련 권장 사항:

php + nginx 웹 사이트 동시성 스트레스 테스트 및 최적화

nginx-대형 동시성 스트레스 테스트 데이터를 안내해 주세요

PHP로 구현됨 서버 압력을 완화하기 위해 정적 파일을 생성하는 방법_PHP 튜토리얼

위 내용은 MixPHP, Yii 및 CodeIgniter에 대한 동시성 스트레스 테스트 요약 공유 예의 상세 내용입니다. 자세한 내용은 PHP 중국어 웹사이트의 기타 관련 기사를 참조하세요!

성명:
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.