CentOS+Nginx+PHP+MySQL标准生产环境配置方法

2019-10-15 20:26:50丽君

    php-xml x86_64 5.3.1-2.el5 21Andy.com 115 k
    php-xmlrpc x86_64 5.3.1-2.el5 21Andy.com 48 k
    Installing for dependencies:
    gmp x86_64 4.1.4-10.el5 base 201 k
    libXaw x86_64 1.0.2-8.1 base 329 k
    libXmu x86_64 1.0.2-5 base 63 k
    libXpm x86_64 3.5.5-3 base 44 k
    libedit x86_64 2.11-2.20080712cvs.el5 epel 80 k
    libmcrypt x86_64 2.5.8-4.el5.centos extras 105 k
    libtidy x86_64 0.99.0-14.20070615.el5 epel 140 k
    php-common x86_64 5.3.1-2.el5 21Andy.com 554 k
    sqlite2 x86_64 2.8.17-5.el5 21Andy.com 165 k
    t1lib x86_64 5.1.1-7.el5 epel 208 k
    Updating for dependencies:
    libevent x86_64 1.4.12-1.el5 21Andy.com 129 k

    Transaction Summary
    ==========================================================
    Install 26 Package(s)
    Update 1 Package(s)
    Remove 0 Package(s)

以下分别测试我本地的虚拟机和 VPS 上 Nginx + php-fpm 的性能

我的本机虚拟机测试,配置为PD930 双核3.0G,2G内存,给虚拟机分配的是 1G 内存,安装的系统为 CentOS 5.4 64bit

测试内容为

<?php phpinfo();?>

500 并发测试,CPU使用率到了30%,系统负载在10左右,页面打开还是飞快

[root@localhost ~]# webbench -c 500 -t 30 http://127.0.0.1/
Webbench - Simple Web Benchmark 1.5
Copyright (c) Radim Kolar 1997-2004, GPL Open Source Software.

Benchmarking: GET http://127.0.0.1/
500 clients, running 30 sec.

Speed=223504 pages/min, 21806556 bytes/sec.
Requests: 111752 susceed, 0 failed.

2000 并发测试,CPU使用率35%,系统负载在18左右,页面打开还是飞快

[root@localhost ~]# webbench -c 2000 -t 30 http://127.0.0.1/
Webbench - Simple Web Benchmark 1.5
Copyright (c) Radim Kolar 1997-2004, GPL Open Source Software.

Benchmarking: GET http://127.0.0.1/
2000 clients, running 30 sec.

Speed=429494 pages/min, 39004788 bytes/sec.
Requests: 214747 susceed, 0 failed.

5000 并发测试,CPU使用率30%,系统负载到了35,页面打还速度还不错,看了这数据,前些天说的那个1500万PHP请求也没啥了

[root@localhost ~]# webbench -c 5000 -t 30 http://127.0.0.1/
Webbench - Simple Web Benchmark 1.5
Copyright (c) Radim Kolar 1997-2004, GPL Open Source Software.

Benchmarking: GET http://127.0.0.1/
5000 clients, running 30 sec.

Speed=788986 pages/min, 66952700 bytes/sec.
Requests: 394493 susceed, 0 failed.

还不过瘾,变态一下,10000并发

10000 并发,CPU使用还是不到30%,系统负载从60左右一直升到1000左右,晕死!居然还能打开!只是有点卡!负载到600多的时候居然不卡!疯了,我这还是虚拟机,webbench 还是在自己机上开的,汗,太强了