<Directory />
AllowOverride All
</Directory>
就这么简单,塞到httpd.conf里最后,完事
tnnd。。折腾了我n久。。最后一行一行的看httpd,才发现问题
<Directory />
AllowOverride All
</Directory>
就这么简单,塞到httpd.conf里最后,完事
tnnd。。折腾了我n久。。最后一行一行的看httpd,才发现问题
如此高压之下,nginx依旧表示蛋定,不得不服气- –
有空了研究下详细的参数,继续优化
测试环境:两个相距5跳的vps,ping下来1.2ms
被测试vps:512M内存,1024M的burst,openvz,跑完3000个测试load接近2
网页是博客首页,已经用w3 total cache静态化
[root@vps ~]#ab -c 100 -n 3000 http://johnliu.info/
This is ApacheBench, Version 2.0.40-dev <$Revision: 1.146 $> apache-2.0
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Copyright 2006 The Apache Software Foundation, http://www.apache.org/
Benchmarking johnliu.info (be patient)
Completed 300 requests
Completed 600 requests
Completed 900 requests
Completed 1200 requests
Completed 1500 requests
Completed 1800 requests
Completed 2100 requests
Completed 2400 requests
Completed 2700 requests
Finished 3000 requests
Server Software: nginx/0.8.53
Server Hostname: johnliu.info
Server Port: 80
Document Path: /
Document Length: 32170 bytes
Concurrency Level: 100
Time taken for tests: 10.576416 seconds
Complete requests: 3000
Failed requests: 0
Write errors: 0
Total transferred: 97896000 bytes
HTML transferred: 96510000 bytes
Requests per second: 283.65 [#/sec] (mean)
Time per request: 352.547 [ms] (mean)
Time per request: 3.525 [ms] (mean, across all concurrent requests)
Transfer rate: 9039.07 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 60 395.1 7 3012
Processing: 49 268 85.3 268 2438
Waiting: 21 228 75.8 225 2415
Total: 51 328 404.6 275 3981
Percentage of the requests served within a certain time (ms)
50% 275
66% 293
75% 302
80% 308
90% 334
95% 362
98% 783
99% 3273
100% 3981 (longest request)
Mon.itor.us的检测结果表明,我的烂博客首页加载速度已经稳定在100ms左右的- –
目前博客逻辑架构是这样的:
前端:squid,跑在直连网通的xeex网络后,硬件是个小vps,128内存,xen架构,2G/150G,6刀一个月
后端:nginx反代httpd,同时nginx做部分静态文件服务器,硬件同样是个小vps,256内存,openvz架构,25G/250G,4刀一个月
数据库:mysqld,跑在上面那个256内存的vps上。
整个架构:squid>nginx>httpd>mysqld
用ab跑100个并发测试打开1000次首页,10多秒钟就搞定,服务器负载最多时候到了1- –
monitorus检测结果:
Test HTTP johnliu.info_http
12:23 676 OK US
12:53 105 OK US
13:23 116 OK US
13:53 1052 OK US
14:23 766 OK US
14:53 98 OK US
15:23 89 OK US
参考:
www.google.com_http 29
ab结果:
Server Software: nginx/0.8.53
Server Hostname: johnliu.info
Server Port: 80
Document Path: /others/kuai_fan_yuan_quakkfan_chong_xin_fa_bu/
Document Length: 15534 bytes
Concurrency Level: 100
Time taken for tests: 19.676012 seconds
Complete requests: 1000
Failed requests: 980
(Connect: 0, Length: 980, Exceptions: 0)
Write errors: 0
Total transferred: 16043778 bytes
HTML transferred: 15577247 bytes
Requests per second: 50.82 [#/sec] (mean)
Time per request: 1967.601 [ms] (mean)
Time per request: 19.676 [ms] (mean, across all concurrent requests)
Transfer rate: 796.25 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 11 90 98.4 96 3011
Processing: 32 1787 1663.1 1327 9043
Waiting: 11 252 340.5 110 1906
Total: 62 1878 1642.5 1420 9060
Percentage of the requests served within a certain time (ms)
50% 1420
66% 1565
75% 1663
80% 1791
90% 5181
95% 6338
98% 7419
99% 7650
100% 9060 (longest request)
嗯,今天实在不知道的写什么,就只有把老本拿出来了:自己折腾了N台vps后整理出的快速配置centos的脚本,只要打开terminal一行行的粘进去回车就完事。
正常情况下是可以在5分钟内完成一台新vps的配置的,如果遇到非正常情况。。就。。。。。。
跑poptopd的前提是你的vps是xen架构,否则免谈
#安装epel+rpmforge
rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-4.noarch.rpm
wget http://dag.wieers.com/rpm/packages/RPM-GPG-KEY.dag.txt http://quattor.web.lal.in2p3.fr/packages/os/sl520-x86_64/base/RPM-GPG-KEYs/RPM-GPG-KEY-CentOS-5 http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.1-1.el5.rf.i386.rpm
rpm –import RPM-GPG-KEY.dag.txt
rpm –import RPM-GPG-KEY-CentOS-5
rpm -Uhv rpmforge-release-0.5.1-1.el5.rf.i386.rpm
#更新系统
yum -y update
yum -y upgrade
#install php 5.2+ on centos5
vim /etc/yum.repos.d/CentOS-Testing.repo
[c5-testing]
name=CentOS-5Testing
baseurl=http://dev.centos.org/centos/$releasever/testing/$basearch/
enabled=1
gpgcheck=1
gpgkey=http://dev.centos.org/centos/RPM-GPG-KEY-CentOS-testing
includepkgs=php*
#安装lamp和subversion+其他一些东西
yum -y install perl-Net-SSLeay gcc-c++ patch zlib-devel openssl-devel readline-devel mysql-devel mysql-server httpd-devel apr-devel iptables php-common php-gd php-mcrypt php-pear php-mhash php-mysql php-xml php-mbstring traceroute bind-utils setuptool mod_dav_svn subversion sqlite-devel ntp
#poptopd pptp vpn server
rpm -Uvh http://poptop.sourceforge.net/yum/stable/fc7/pptp-release-current.noarch.rpm
yum -y –enablerepo=poptop-stable install pptpd
vim /etc/pptpd.conf (修改localip、remoteip)
vim /etc/ppp/options (修改ms-dns),
vim /etc/ppp/chap-secrets (创建用户名、密码,指定ip)
vim /etc/sysctl.conf
#修改
net.ipv4.ip_forward = 1
echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -t nat -A POSTROUTING -s 内网ip段(eg. 192.168.100.0/24) -j SNAT –to 服务器的任意ip(eg. 1.2.3.4)
/etc/init.d/iptables save
/etc/init.d/iptables restart
#webmin图形化的web管理界面,减少命令行的折腾程度
wget http://prdownloads.sourceforge.net/webadmin/webmin-1.520-1.noarch.rpm
rpm -i webmin-1.520-1.noarch.rpm
#subversion
svnadmin create /path/to/repo
chmod 777 -R /path/to/repo
htpasswd -c /path/to/svn/password username#下面这段丢给httpd.conf
DocumentRoot /path/to/svn/repo
ServerName svn.yourname.com
DAV svn
SVNPath /data/svn
AuthType Basic
AuthName “Subversion”
AuthUserFile /path/to/svn/password
Require valid-user
#大功告成^_^