分类目录归档:Linux

你见过TTL这么低的vps么?

当时我就震惊了,居然有vps可以在24跳之后

ping -c 10 69.194.193.10
PING 69.194.193.10 (69.194.193.10): 56 data bytes
64 bytes from 69.194.193.10: icmp_seq=0 ttl=39 time=346.678 ms
64 bytes from 69.194.193.10: icmp_seq=1 ttl=39 time=347.852 ms
Request timeout for icmp_seq 2
64 bytes from 69.194.193.10: icmp_seq=3 ttl=39 time=346.919 ms
64 bytes from 69.194.193.10: icmp_seq=4 ttl=39 time=347.288 ms
64 bytes from 69.194.193.10: icmp_seq=5 ttl=39 time=347.643 ms
64 bytes from 69.194.193.10: icmp_seq=6 ttl=39 time=347.530 ms
64 bytes from 69.194.193.10: icmp_seq=7 ttl=39 time=347.325 ms
64 bytes from 69.194.193.10: icmp_seq=8 ttl=39 time=350.973 ms

— 69.194.193.10 ping statistics —
10 packets transmitted, 8 packets received, 20.0% packet loss
round-trip min/avg/max/stddev = 346.678/347.776/350.973/1.259 ms

traceroute 69.194.193.10
traceroute to 69.194.193.10 (69.194.193.10), 64 hops max, 52 byte packets
1  router (192.168.1.1)  2.081 ms  0.780 ms  0.745 ms
2  reverse.gdsz.cncnet.net (220.249.240.1)  159.016 ms  14.006 ms  30.284 ms
3  120.80.199.209 (120.80.199.209)  7.601 ms  8.884 ms  8.398 ms
4  120.80.198.161 (120.80.198.161)  9.629 ms  8.127 ms  9.853 ms
5  120.80.0.177 (120.80.0.177)  14.498 ms  13.422 ms  13.361 ms
6  219.158.19.77 (219.158.19.77)  15.434 ms  13.862 ms  14.777 ms
7  219.158.4.89 (219.158.4.89)  84.508 ms  67.957 ms  67.473 ms
8  219.158.4.162 (219.158.4.162)  68.866 ms  68.720 ms  69.484 ms
9  sl-st20-sj-15-0-1.sprintlink.net (144.223.242.81)  271.461 ms  273.240 ms  277.230 ms
10  sl-st30-sj-0-0-2-0.sprintlink.net (144.232.0.208)  272.401 ms  273.826 ms  277.634 ms
11  sl-st31-sj-0-8-0-0.sprintlink.net (144.232.3.29)  242.735 ms
sl-st31-sj-0-8-2-0.sprintlink.net (144.232.3.30)  225.602 ms
sl-st31-sj-0-12-0-3.sprintlink.net (144.232.3.33)  229.353 ms
12  * sl-xocomm-337432-0.sprintlink.net (144.223.1.2)  375.140 ms  471.434 ms
13  vb2000d1.rar3.sanjose-ca.us.xo.net (207.88.13.98)  408.976 ms  412.283 ms  407.439 ms
14  te-2-0-0.rar3.washington-dc.us.xo.net (207.88.12.70)  439.822 ms  441.770 ms  444.518 ms
15  ae0d0.mcr1.newark-nj.us.xo.net (216.156.0.22)  476.545 ms  473.820 ms  473.274 ms
16  ae1d0.mcr1.nyc-ny.us.xo.net (216.156.1.9)  463.897 ms  464.069 ms  461.836 ms
17  207.239.51.86 (207.239.51.86)  303.557 ms  304.349 ms  305.248 ms
18  edge-09-teb1.us.as19318.net (66.45.224.183)  305.153 ms  305.844 ms  304.002 ms
19  209.250.226.70 (209.250.226.70)  305.978 ms  307.005 ms  306.427 ms
20  66.45.226.114 (66.45.226.114)  306.943 ms  304.059 ms  304.846 ms
21  testipnj.vpscolo.com (69.194.193.10)  304.967 ms  305.429 ms  304.949 ms

install php zend optimizer with yum on centos

Contents: atomic.repo

# Name: Atomic Rocket Turtle RPM Repository for CentOS / Red Hat Enterprise Linux 5 –
# URL: http://www.atomicrocketturtle.com/
[atomic]
name = CentOS / Red Hat Enterprise Linux $releasever – atomicrocketturtle.com
mirrorlist = http://www.atomicorp.com/mirrorlist/atomic/centos-5-$basearch
#mirrorlist = http://www.atomicorp.com/channels/atomic/centos/5/mirrors-atomic
enabled = 1
priority = 1
protect = 0
gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY.art.txt
gpgcheck = 1

# Almost Stable, release candidates for [atomic]
[atomic-testing]
name = CentOS / Red Hat Enterprise Linux $releasever – atomicrocketturtle.com – (Testing)
mirrorlist = http://www.atomicorp.com/mirrorlist/atomic-testing/centos-5-$basearch
enabled = 0
priority = 1
protect = 0
gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY.art.txt
gpgcheck = 1

# Untested, Unstable, known buggy, and incomplete packages.
#[atomic-bleeding]
#name = CentOS / Red Hat Enterprise Linux $releasever – atomicrocketturtle.com – (Bleeding)
#baseurl = http://www.atomicorp.com/channels/atomic-bleeding/centos/5/$basearch/
#enabled = 0
#priority = 1
#protect = 0
#gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY.art.txt
#gpgcheck = 1

yum install php-zend-optimizer

解决Apache的Mod_Security和svn模块冲突

今天svn突然不能提交了,给777都没用,一直报错

Command: Commit
Error: Commit failed (details follow):
Error: access to ‘/!svn/vcc/default’ forbidden
Finished!:

Google了好一阵子,解决方案如下:

在svn对应的虚拟主机的</VirtualHost>之前插入这样一段

<IfModule mod_security2.c>
SecRuleRemoveByID 960032
SecRuleRemoveByID 960015
SecRuleRemoveByID 960904
SecRuleRemoveByID 960010
SecRuleRemoveByID 960035
SecRule REQUEST_METHOD “^(PROPFIND|PROPPATCH)$” allow
SecRule REQUEST_METHOD “^(REPORT|OPTIONS)$” allow
SecRule REQUEST_METHOD “^(MKACTIVITY|CHECKOUT)$” allow
SecRule REQUEST_METHOD “^(PUT|DELETE|MERGE)$” allow
SecRule REQUEST_METHOD “^(MKCOL)$” allow
</IfModule>

完成后重启apache就可以了。

原因:mod_security过于严格=。-

多级缓存架构相当的给力

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)

几只VPS的Unix Benchmark跑分结果

最近在选择vps上折腾的很惨,还遇到莫名其妙的数据丢失,幸好有backup,只丢失了不到3天的数据,今天有点时间,就把自己能控制的5只vps拖出来遛遛,跑了下分。

unix benchmark download here: http://members.dslextreme.com/users/andylee/unixbench-4.1.0-wht.tar.gz

排名不分先后- –

1.PhotonVps的 warp.5, Xen,128内存,2G/150G,equal share CPU*2,5.96 USD/M

BYTE UNIX Benchmarks (Version 4.1-wht.2)
System — Linux xx 2.6.18-164.10.1.el5xen #1 SMP Thu Jan 7 20:28:30 EST 2010 x86_64 x86_64 x86_64 GNU/Linux
/dev/sda1              2064208   1402560    556792  72% /

Start Benchmark Run: Wed Dec  8 17:09:26 CST 2010
17:09:26 up 18:28,  1 user,  load average: 0.76, 0.38, 0.15

End Benchmark Run: Wed Dec  8 17:20:11 CST 2010
17:20:12 up 18:39,  1 user,  load average: 15.18, 6.62, 2.98

INDEX VALUES
TEST                                        BASELINE     RESULT      INDEX

Dhrystone 2 using register variables        376783.7 11209023.1      297.5
Double-Precision Whetstone                      83.1     1232.6      148.3
Execl Throughput                               188.3     2877.5      152.8
File Copy 1024 bufsize 2000 maxblocks         2672.0    71659.0      268.2
File Copy 256 bufsize 500 maxblocks           1077.0    20144.0      187.0
File Read 4096 bufsize 8000 maxblocks        15382.0   646709.0      420.4
Pipe Throughput                             111814.6   418053.8       37.4
Pipe-based Context Switching                 15448.6   135425.6       87.7
Process Creation                               569.3     6445.8      113.2
Shell Scripts (8 concurrent)                    44.8      807.1      180.2
System Call Overhead                        114433.5   487160.8       42.6
=========
FINAL SCORE                                                     140.0

2.AlienVPS的UFO1,OpenVZ,256内存,25G/250G,633.352Mhz CPU*4,4USD/M
BYTE UNIX Benchmarks (Version 4.1-wht.2)
System — Linux xxxx 2.6.18-194.26.1.el5.028stab070.14 #1 SMP Thu Nov 18 16:34:01 MSK 2010 i686 i686 i386 GNU/Linux
/dev/simfs            26214400    826760  25387640   4% /

Start Benchmark Run: Wed Dec  8 12:09:39 MSK 2010
12:09:39 up 17:59,  1 user,  load average: 0.31, 0.17, 0.06

End Benchmark Run: Wed Dec  8 12:23:33 MSK 2010
12:23:33 up 18:13,  1 user,  load average: 11.43, 5.49, 2.73

INDEX VALUES
TEST                                        BASELINE     RESULT      INDEX

Dhrystone 2 using register variables        376783.7  4801749.6      127.4
Double-Precision Whetstone                      83.1     1265.4      152.3
Execl Throughput                               188.3     3901.9      207.2
File Copy 1024 bufsize 2000 maxblocks         2672.0   110789.0      414.6
File Copy 256 bufsize 500 maxblocks           1077.0    57634.0      535.1
File Read 4096 bufsize 8000 maxblocks        15382.0   864323.0      561.9
Pipe-based Context Switching                 15448.6   230704.3      149.3
Pipe Throughput                             111814.6   745289.8       66.7
Process Creation                               569.3    11623.7      204.2
Shell Scripts (8 concurrent)                    44.8      566.3      126.4
System Call Overhead                        114433.5   617815.2       54.0
=========
FINAL SCORE                                                     181.3

3.PhotonVPS的WARP 2,XEN,1024内存,50G/900G,equal share CPU*8,26USD/M

BYTE UNIX Benchmarks (Version 4.1-wht.2)
System — Linux xxxxxx 2.6.18-194.11.3.el5xen #1 SMP Mon Aug 30 16:55:32                                                                                                             EDT 2010 x86_64 GNU/Linux
/dev/sda1             51606140   2336820  46647880   5% /

Start Benchmark Run: Wed Dec  8 17:14:26 CST 2010
17:14:26 up 21:14,  4 users,  load average: 0.08, 0.02, 0.01

End Benchmark Run: Wed Dec  8 17:24:46 CST 2010
17:24:46 up 21:25,  4 users,  load average: 15.14, 6.49, 2.84

INDEX VALUES
TEST                                        BASELINE     RESULT      INDEX

Dhrystone 2 using register variables        376783.7 16047095.6      425.9
Double-Precision Whetstone                      83.1     1227.7      147.7
Execl Throughput                               188.3     4436.1      235.6
File Copy 1024 bufsize 2000 maxblocks         2672.0   142113.0      531.9
File Copy 256 bufsize 500 maxblocks           1077.0    41767.0      387.8
File Read 4096 bufsize 8000 maxblocks        15382.0  1397184.0      908.3
Pipe Throughput                             111814.6  1011631.5       90.5
Pipe-based Context Switching                 15448.6   248391.6      160.8
Process Creation                               569.3    12219.2      214.6
Shell Scripts (8 concurrent)                    44.8     2136.9      477.0
System Call Overhead                        114433.5   965631.9       84.4
=========
FINAL SCORE                                                     258.8

4.TP的某VPS,未知架构,1024内存,60G/xxG,equal share CPU*8,50USD/M左右

跑分过程中掉线一次,restart再次掉线,第三次成功

BYTE UNIX Benchmarks (Version 4.1-wht.2)
System — Linux xxxxxxxxx 2.6.18-194.17.4.el5 #1 SMP Mon O                                                                                                            ct 25 15:51:07 EDT 2010 i686 i686 i386 GNU/Linux
/dev/hda3             59871508   2880884  53909124   6% /

Start Benchmark Run: Wed Dec  8 04:43:33 CST 2010
04:43:33 up 10 days,  1:38,  2 users,  load average: 0.83, 0.31, 0.75

End Benchmark Run: Wed Dec  8 04:54:18 CST 2010
04:54:18 up 10 days,  1:49,  1 user,  load average: 14.49, 6.31, 3.17

INDEX VALUES
TEST                                        BASELINE     RESULT      INDEX

Dhrystone 2 using register variables        376783.7 12468250.3      330.9
Double-Precision Whetstone                      83.1     1301.4      156.6
Execl Throughput                               188.3     6711.3      356.4
File Copy 1024 bufsize 2000 maxblocks         2672.0    95072.0      355.8
File Copy 256 bufsize 500 maxblocks           1077.0    36518.0      339.1
File Read 4096 bufsize 8000 maxblocks        15382.0  1170137.0      760.7
Pipe-based Context Switching                 15448.6   366710.1      237.4
Pipe Throughput                             111814.6   982225.3       87.8
Process Creation                               569.3    20016.5      351.6
Shell Scripts (8 concurrent)                    44.8     1408.5      314.4
System Call Overhead                        114433.5  1446043.0      126.4
=========
FINAL SCORE                                                     267.1

5.Amazon的EC2 Micro Instance,XEN,7864内存,50G/900G,equal share 2659.99Mhz *1,1USD/M左右(省省跑可以免费用的,就是到国内的网络太糟糕了)

BYTE UNIX Benchmarks (Version 4.1-wht.2)
System — Linux xxxxxx 2.6.16-xenU #1 SMP Mon May 28 03:41:49 SAST 2007                                                                                                             i686 i686 i386 GNU/Linux
/dev/sda1             10321208   5017136   4779784  52% /

Start Benchmark Run: Wed Dec  8 17:15:46 CST 2010
17:15:46 up 6 days, 19:10,  1 user,  load average: 0.08, 0.02, 0.01

End Benchmark Run: Wed Dec  8 17:37:16 CST 2010
17:37:16 up 6 days, 19:31,  1 user,  load average: 15.04, 7.11, 3.96

INDEX VALUES
TEST                                        BASELINE     RESULT      INDEX

Dhrystone 2 using register variables        376783.7  3913846.7      103.9
Double-Precision Whetstone                      83.1     1502.8      180.8
Execl Throughput                               188.3     1176.4       62.5
File Copy 1024 bufsize 2000 maxblocks         2672.0     2082.0        7.8
File Copy 256 bufsize 500 maxblocks           1077.0    10448.0       97.0
File Read 4096 bufsize 8000 maxblocks        15382.0    10464.0        6.8
Pipe Throughput                             111814.6   365033.6       32.6
Pipe-based Context Switching                 15448.6     3227.7        2.1
Process Creation                               569.3      105.6        1.9
Shell Scripts (8 concurrent)                    44.8       12.0        2.7
System Call Overhead                        114433.5   284563.4       24.9
=========
FINAL SCORE                                                      17.6
(不得不说便宜没好货,贵的不一定好)