工作,学习,生活,这里将会有一些记录. 备用域名:http://meisw.wdlinux.cn 注册 | 登陆
浏览模式: 标准 | 列表全部文章

一组ab测试的数据结果

[root@www ~]# ab -n 50000 -c 500 http://192.168.1.32/info.php
This is ApacheBench, Version 2.0.41-dev <$Revision: 1.121.2.12 $> apache-2.0
Copyright (c) 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Copyright (c) 1998-2002 The Apache Software Foundation, http://www.apache.org/

Benchmarking 192.168.1.32 (be patient)
Completed 5000 requests
Completed 10000 requests
Completed 15000 requests
Completed 20000 requests
Completed 25000 requests
Completed 30000 requests
Completed 35000 requests
Completed 40000 requests
Completed 45000 requests
Finished 50000 requests


Server Software:        Apache/2.0.55
Server Hostname:        192.168.1.32
Server Port:            80

Document Path:          /info.php
Document Length:        26397 bytes

Concurrency Level:      500
Time taken for tests:   159.25877 seconds
Complete requests:      50000
Failed requests:        213
   (Connect: 0, Length: 213, Exceptions: 0)
Write errors:           0
Total transferred:      1328293693 bytes
HTML transferred:       1320041878 bytes
Requests per second:    314.41 [#/sec] (mean)
Time per request:       1590.259 [ms] (mean)
Time per request:       3.181 [ms] (mean, across all concurrent requests)
Transfer rate:          8156.92 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        1  567 2412.7      8   45014
Processing:    14  906 2940.3    416   52023
Waiting:        4  715 2777.0    386   51974
Total:         18 1474 4070.8    426   73025

Percentage of the requests served within a certain time (ms)
  50%    426
  66%    457
  75%    693
  80%   1042
  90%   3422
  95%   4742
  98%   9709
  99%  21422
 100%  73025 (longest request)

 

 

[root@www ~]# ab -n 50000 -c 500 http://192.168.1.30/info.php
This is ApacheBench, Version 2.0.41-dev <$Revision: 1.121.2.12 $> apache-2.0
Copyright (c) 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Copyright (c) 1998-2002 The Apache Software Foundation, http://www.apache.org/

Benchmarking 192.168.1.30 (be patient)
Completed 5000 requests
Completed 10000 requests
Completed 15000 requests
Completed 20000 requests
Completed 25000 requests
Completed 30000 requests
Completed 35000 requests
Completed 40000 requests
Completed 45000 requests
Finished 50000 requests


Server Software:        Apache/2.0.55
Server Hostname:        192.168.1.30
Server Port:            80

Document Path:          /info.php
Document Length:        26397 bytes

Concurrency Level:      500
Time taken for tests:   231.351912 seconds
Complete requests:      50000
Failed requests:        30322
   (Connect: 0, Length: 30322, Exceptions: 0)
Write errors:           0
Total transferred:      1329951482 bytes
HTML transferred:       1321653137 bytes
Requests per second:    216.12 [#/sec] (mean)
Time per request:       2313.519 [ms] (mean)
Time per request:       4.627 [ms] (mean, across all concurrent requests)
Transfer rate:          5613.87 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        1  390 1154.3      4   21000
Processing:    10 1675 6393.1    201  197589
Waiting:      -16  527 1989.6      5   85574
Total:         12 2065 6579.0    209  197673

Percentage of the requests served within a certain time (ms)
  50%    209
  66%    642
  75%   1863
  80%   3022
  90%   4899
  95%   8765
  98%  19135
  99%  23680
 100%  197673 (longest request)

 

 

[root@www ~]# ab -n 10000 -c 1000 http://192.168.1.30/info.php
This is ApacheBench, Version 2.0.41-dev <$Revision: 1.121.2.12 $> apache-2.0
Copyright (c) 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Copyright (c) 1998-2002 The Apache Software Foundation, http://www.apache.org/

Benchmarking 192.168.1.30 (be patient)
Completed 1000 requests
Completed 2000 requests
Completed 3000 requests
Completed 4000 requests
Completed 5000 requests
Completed 6000 requests
Completed 7000 requests
Completed 8000 requests
Completed 9000 requests
Finished 10000 requests


Server Software:        Apache/2.0.55
Server Hostname:        192.168.1.30
Server Port:            80

Document Path:          /info.php
Document Length:        26395 bytes

Concurrency Level:      1000
Time taken for tests:   28.618709 seconds
Complete requests:      10000
Failed requests:        8597
   (Connect: 0, Length: 8595, Exceptions: 2)
Write errors:           0
Total transferred:      270178276 bytes
HTML transferred:       268480921 bytes
Requests per second:    349.42 [#/sec] (mean)
Time per request:       2861.871 [ms] (mean)
Time per request:       2.862 [ms] (mean, across all concurrent requests)
Transfer rate:          9219.32 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        5  986 2390.4     73   21075
Processing:    33 1265 1842.8    644   18738
Waiting:       10  685 1315.4    402   18453
Total:         85 2251 3016.6    973   24678

Percentage of the requests served within a certain time (ms)
  50%    973
  66%   1587
  75%   3447
  80%   3569
  90%   4976
  95%   9462
  98%  10595
  99%  12878
 100%  24678 (longest request)

 

 


[root@www ~]# ab -n 10000 -c 1000 http://192.168.1.32/info.php
This is ApacheBench, Version 2.0.41-dev <$Revision: 1.121.2.12 $> apache-2.0
Copyright (c) 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Copyright (c) 1998-2002 The Apache Software Foundation, http://www.apache.org/

Benchmarking 192.168.1.32 (be patient)
Completed 1000 requests
Completed 2000 requests
Completed 3000 requests
Completed 4000 requests
Completed 5000 requests
Completed 6000 requests
Completed 7000 requests
Completed 8000 requests
Completed 9000 requests
Finished 10000 requests


Server Software:        Apache/2.0.55
Server Hostname:        192.168.1.32
Server Port:            80

Document Path:          /info.php
Document Length:        26397 bytes

Concurrency Level:      1000
Time taken for tests:   33.452000 seconds
Complete requests:      10000
Failed requests:        6
   (Connect: 0, Length: 6, Exceptions: 0)
Write errors:           0
Total transferred:      265957580 bytes
HTML transferred:       264304610 bytes
Requests per second:    298.94 [#/sec] (mean)
Time per request:       3345.200 [ms] (mean)
Time per request:       3.345 [ms] (mean, across all concurrent requests)
Transfer rate:          7764.08 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        3  885 2212.4     19   21019
Processing:   158  777 1613.7    437   18516
Waiting:      112  699 1607.6    383   18469
Total:        298 1662 3192.1    458   21752

Percentage of the requests served within a certain time (ms)
  50%    458
  66%    517
  75%    856
  80%   2376
  90%   3477
  95%   9080
  98%   9525
  99%  21177
 100%  21752 (longest request)

用ha,lvs构建的高可用负载均衡系统

//////////////////////////////////////////////////
此文档为半年多前做的测试笔记了.采用HeatBeat+lvs构建的高可用负载均衡系统.当时测试算是比较成功的.也上了项目使用.但没用多久就撒了.在实时要求比较高的环境下,问题比较多.要解决的问题也多.但用在静态上的话,感觉还是很不错的说.现在整理一下,发布上来.可惜后期的文档没怎么记录.如各位看观有什么不明或疑问,欢迎指出或和我联系:QQ5846690.mail/man:mymail#3126.com
同时转截请注册来自 http://meisw.cn/show-34-1.html
///////////////////////////////////////////////////

 

环境:机器5台,均采用rhel4,使用DR方式.

结构:两台做双机热备,串口线一条.两台做real server,一台做数据库.同时,双机里的备机也可以做real server.我测试的时候,有用过三台,四台,加上虚拟机的话有5台.开始单测试lvs,用了三台.

LVS分流,三台机.

图表
director
dip:192.168.1.10  (eth0)
vip:192.168.1.9 (eth0:0)

realserver1
rip:192.168.1.11 (eth0)
vip:192.168.1.9 (lo:0)

realserver2
rip:192.168.1.12 (eth0)
vip:192.168.1.9 (lo:0)

 

一 director(调度器)
1 修改内核参数 (/etc/sysctl.conf)
net.ipv4.ip_forward = 0
net.ipv4.conf.all.send_redirects = 1
net.ipv4.conf.default.send_redirects = 1
net.ipv4.conf.eth0.send_redirects = 1

sysctl -p 使之生效

2 配置VIP地址
ifconfig eth0:0 192.168.1.9 broadcast 192.168.1.9 netmask 255.255.255.255 up
route add -host 192.168.1.9 dev eth0:0

3 清除ipvsadm表
ipvsadm -C

4 使用ipvsadm安装LVS服务
ipvsadm -A -t 192.168.1.9:http -s rr

5 增加readserver
#forward http to realserver using direct routing with weight 1
ipvsadm -a -t 192.168.1.9:http -r 192.168.1.11 -g -w 1
ipvsadm -a -t 192.168.1.9:Http -r 192.168.1.12 -g -w 1


系统启动后要确认内核是否支持ipvs,只需要执行下面的命令即可:grep ip_vs_init /boot/System.map

二 配置realserver
1 修改内核参数(/etc/sysctl.conf)
net.ipv4.ip_forward = 0
net.ipv4.conf.lo.arp_ignore = 1
net.ipv4.conf.lo.arp_announce = 2
net.ipv4.conf.all.arp_ignore = 1
net.ipv4.conf.all.arp_announce = 2

sysctl -p 使之生效

2 配置VIP地址
ifconfig lo:0 192.168.1.9 broadcast 192.168.1.9 netmask 255.255.255.255 up
route add -host 192.168.1.9 dev lo:0

测试

用IE打开http://192.168.1.10访问看看结果是否正确. 可以在两台real server服务器放置两个不同的页面.如是real server1/real server2.这样就可以看出有没分流到两台real server上了.或者用一些软件来测试一下性能.

 

ha+lvs高可用负载分流


#######################################
# HeatBeat
#######################################

HeartBeat是Linux-HA的高可用性集群软件,它的主要作用是:
安装在Load Balancer和Backup上,运行于active/standby模式。
当Load Balancer失效时,Backup自动激活,成为实际的Load Balancer。
切换到active模式时,按顺序启动Virtual IP、IPVS和Ldirectord。
切换到standby模式时,按顺序关闭Ldirectord、IPVS和Virtual IP。

HeartBeat串口线连接测试方法:
在Load Balancer上:cat < /dev/ttyS0
在Backup上:echo hello >; /dev/ttyS0
在VMWare上设置串口的时候一端做server,一端做client即可

1 修改主机名(/etc/hosts):

127.0.0.1         localhost.localdomain localhost
192.168.136.11    loadbalancer
192.168.136.12    backup

2 安装
groupadd -g 694 haclient
useradd -u 694 -g haclient hacluster

wget http://www.packetfactory.net/libnet/dist/libnet.tar.gz
tar zxf libnet.tar.gz
cd libnet
./configure
make
make install

wget http://www.linux-ha.org/download/heartbeat-1.99.4-tar.gz
tar zxf heartbeat-1.99.4.tar.gz
cd heartbeat-1.99.4
./ConfigureMe configure --disable-swig --disable-snmp-subagent
make
make install
cp doc/ha.cf doc/haresources doc/authkeys /etc/ha.d/
cp ldirectord/ldirectord.cf /etc/ha.d/

chkconfig --add heartbeat
chkconfig --del ldirectord 

 

相关配置文件
haresources
#
rhel4u2 IPaddr::192.168.1.9/24/192.168.1.255 ipvsadm ldirectord

ha.cf

vip
/sbin/ifconfig lo:0 192.168.1.9 broadcast 192.168.1.9 netmask 255.255.255.255 up
/sbin/route add -host 192.168.1.9 dev lo:0
echo 1 > /proc/sys/net/ipv4/conf/all/arp_announce
echo 0 >/proc/sys/net/ipv4/ip_forward
echo 1 > /proc/sys/net/ipv4/conf/all/arp_ignore
echo 1 > /proc/sys/net/ipv4/conf/lo/arp_announce
echo 1 > /proc/sys/net/ipv4/conf/lo/arp_ignore

 

#失效无用连接
echo 1 > /proc/sys/net/ipv4/vs/expire_nodest_conn


FAQ
1 cookie时间,即在线问题 加-p选项

an:

-p选项,是设置保持cookie的一个持续时间.
也就是 客户机 > 转发器 > real server 持续的时间.
这个时间内,某台机所有连接,都是指向前一个已建立过的连接上.

但在设置了-p选项后,在
转发器>real server间还有一个持续时间(为1分钟)

也就是说,在设置了-p选项后
转发器 > real server 的连接时间为 1分钟加上-p设置的时间


在这个时间内,假如某real server挂了,ld是能检测出问题,并且在转发规则里把它的权值改为0
但在上面的前提下,所有之前与这台real servel有连接过的客户机,在这个时间内(1分钟+P设置的时间),仍然会继续往这台机上转发
问题也就出现了.


如果倘若不设置-p选项,在转发器上,会维护着客户机与每一个real server 的连接状态

 

 

ha的一些资料

多个节点,只要还有一个节点,服务就能继续...
而且增加了资源监控,如IP失效了会自动恢复...

如果是2.0,简单的可以这样配,以三个节点为例
1.三个节点都装上heartbeat 2.0.0.0.
2.把三个节点都加到ha.cf里,然后在ha.cf里加上"crm 1"
3.然后用/usr/lib/heartbeat/cts/haresources2cib.py 把原来的/etc/ha.d/haresources 转换成 /var/lib/heartbeat/crm/cib.xml.
"/usr/lib/heartbeat/cts/haresources2cib.py haresources >;/var/lib/heartbeat/crm/cib.xml"
4.把haresources清空
5.启动三台计算机的heartbeat.

2.0用cib替代了haresources.
http://www.linux-ha.org/ClusterInformationBase_2fUserGuide

2.0里面没有工作节点和备份节点之分,资源在哪里个节点运行,失效后可以在哪些另外的节点运行等的都是cib.xml(资源配置文件)里规定的.

2.0里面基本没有活动-备份的概念,换句话说,cib.xml中你可以指定一个服务在不同机器上跑的权重,甚至禁止某个服务在某个机器上跑,等等。各个节点都是平等的。运行时,heartbeat2会根据当前的情况,计算出那里是运行服务的最佳机器。如果你把所有服务的最佳运行节点都设到一台机器,那就相当于一个跑服务,两个备份,如果你把服务配到两个节点,留一个节点空着,那就相当于两个跑服务,一个备份。
CRM, Cluster Resouce Manager, 用于在cluster计算管理资源。开启了它,就开启了2.0的新功能

HA的概念和1.x的配置:
http://www-128.ibm.com/developerworks/cn/linux/l-halinux/index.html
2.x的概念和基本配置:
http://www.linux-ha.org/GettingStartedV2
2.x的资源配置的详细介绍:
http://www.linux-ha.org/ClusterInformationBase_2fUserGuide

这个中文的介绍挺好的,不过是1.x的,不过概念都一样。
http://www-128.ibm.com/developerworks/cn/linux/l-halinux/index.html

 

LVS的官方网站

http://www.linuxvirtualserver.org/zh/lvs1.html

http://zh.linuxvirtualserver.org/ 论坛讨论区

 

注:本文档是06年底作测试时的笔记.但测试完后,没作整理.现在才发觉,所以,有一些是现在加上的,如有错误或不足之处,请指出或提出意见.谢谢

 

Tags: lvs负载均衡

解读HTTP状态码

一般而言,如果代码是在200到299代表成功。常见的200状态码代表符合客户端的要求。300到399代表必须由客户端采取动作才能满足所提出的要求。400到499和500到599代表客户端和服务器有问题。最常见的状态代码有两个,一个是404,代表客户端要求的资源不在服务器上,403代表的是所要求的资源拒绝服务。W3C在HTTP状态代码这个网页上对状态代码有更完整的讨论。

http://www.w3.org/Protocols/HTTP/HTRESP.html

磁盘配额

首先,你要修改你的/etc/fstab文件:
LABEL=/     /      ext3    defaults      1 1
改为:
LABEL=/     /      ext3    defaults,usrquota      1 1
或者改为:
LABEL=/     /      ext3    defaults,grpquota      1 1
usrquota是基于用户的磁盘配额,grpquota是基于组的磁盘配额,怎么改就看你需要了。
之后你或者重新启动一下,或者remount一下(mount -o remount / )。

第二,在 / 中建立aquota.user或aquota.grup,这两个文件要建立在你要实现配额的顶级目录,所谓定级目录,就是 ̄ ̄咋解释呢?就是比如你要在 / 上实现配额,就要在 / 下建立aquota.user或者aquota.grup;如果你要在/home上实现配额(当然你的/home应该是一个独立的磁盘分区),就在/home下建立这两个文件中的一个。用touch命令建立就可以了,touch aquota.user或aquota.srup。但这时建立好的文件是空的,不符和系统的需要。所以执行下一步。

第三,用quotacheck -mc /  将这两个文件(aquota.user或aquota.grup)格式化。
        注意一下,除非是/分区,一般不用加-m参数,比如你要在/home上实现配额(当然你的/home应该是一个独立的磁盘分区)就:quotacheck -c /home  就可以了。
-m的意思是强迫在“读、写”模式下检查硬盘的配额。

第四,quotaon /        启动磁盘配额。

第五,edquota 用户名/组名       设置用户/组的配额
        例如:edquota user_name
              edquota -g group_name (对于用户组)
        执行后会打开一个vi编辑窗口。可以设置磁盘空间和节点数目的配额。其中soft只是起到警告的作用,并不会真正的限制用户/组。hard就会强制限制用户/组的磁盘空间和节点数目了。

第六,设定soft quota和hard quota之间的时间:
        edquota -t
出现一个 vi 窗口:
Grace period before enforcing soft limits for users:
Time units may be: days, hours, minutes, or seconds
Filesystem Block grace period Inode grace period
/dev/hda7 7days 7days
按照自己的需要修改吧。重新启动就可以了。磁盘限额就生效了。

第七,如果要成批的复制相同的磁盘配额给不通用户:
        edquota -p user user1 user2 user3
        edquota -g -p group group1 group2 group3

第八,取消磁盘限额:
        quotaoff /

转自CU

关于Illegal mix of collations错误的解决方法_mysql

在网上搜索了下,有同样问题的挺多,但似乎没一个解决方法.

我觉得是字符集原因,才会出现这个错误.

如你建库时选用了GBK,在程序里没有设置GBK的话,就会出现这个错误.

设置方法如下:

SET character_set_connection=$dbcharset, character_set_results=$dbcharset, character_set_client=binary

$dbcharset为你的字符集,如上面的GBK.$dbcharset='gbk';这样设置后,就正常了.

如是用默认的话,应该是不会有这个错误的.

如有任何问题, 欢迎在此讨论

IBM开放多项互操作性规范专利助力开源

来自:infoq
 IBM宣布永久性地开放其下多项知识产权的专利,其中包括SCA和SDO等这些专门为软件间互操作而设计的标准,其数目超过150个。如新闻中所讲:



  这次给商业和开源社区带来的好处是让处理设备之间、软件之间的兼容性进一步提升。IBM相信,这一举措最大的意义在于刺激行业的创新,且减少专利诉讼。

  IBM开源与标准化部门的副主席Bob Sutor补充道:

  “IBM传递给我们一个这样的信息:在开放与协作的氛围下才行业的发展与创新才会发生。如果某种新技术能在各相互竞争的厂商中都得到兼容,并且可以互换,那用户就会去选用它。我们相信客户对于他们一直以来所依赖的开放标准会更为信任。”

  在这之前,所有这些规范和协议的使用者都必须遵循IBM和其合作成员所定下的专利费豁免条款。而这次澄清并且统一了知识产权使用规则,鼓励人们更多地去使用这些公开标准。IBM希望其它公司和知识产权所有者也能作出类似的承诺。

  IBM为这次承诺开放的互操作性专利建立了一组网页, 并且在其首页中声明道:

  IBM提供了一份专利权“不主张”承诺(non-assert pledge),包括了下面清单中的那些规范。IBM计划在这份保证书中包含的软件互操作性规范,在此前都已在使用许可中包含专利费豁免条款。这些规范的使用者将自动获得专利权“不主张”承诺,无需采取任何行动。

  该规范的清单列表中,包括了具有相当影响力的SCA/SDO、XACML 1.0/1.1、XML 1.0/1.1、MTOM、WS-MTOMPolicy 1.0、OpenDocument 1.0/1.1、OGSA、OWL、SAML 2.0、SOAP 1.2、UDDI、WS-RM、WS-Security、WS-Addressing、WS-AtomicTransaction、WS- BusinessActivity、WSDL 等规范。

SGI转向安腾Linux平台放弃MIPS-Irix产品

来自:CNET科技资讯网
SGI公司计划在年底淘汰其Irix操作系统和MIPS计算机系统。
 SGI在其网站上宣布,在保持近二十年的在创新和多功能方面的领先地位后,MIPS-Irix产品将在2006年12月29日退出历史舞台。此后,SGI将只通过一些特殊协议销售MIPS-Irix系统,对MIPS-Irix系统的支持则将至少持续到2013年。



  这一举措并不令人感到意外,最近数年来,SGI一直在将自己的产品线向安腾芯片和Linux操作系统迁移。SGI的兴起得益于高端计算系统,尤其是高端图形系统。但是,随着主流计算产品的处理功能越来越强大,Sun、惠普、戴尔、IBM等原来面向企业的厂商将注意力转向了高性能计算,SGI遇到了困难。

40年影响最深的10款IT产品 IBM PC Linux上榜

来自:中新浙江网

7月16日电 7月16日消息,据国外媒体报道,《Computerworld》网站日前评出了过去40年间影响最深的10款IT产品。结果,IBM PC、苹果Macintosh,以及Linux纷纷上榜。



  40年来,成千上万的IT产品都给人们留下了深刻印象,但是,只有一小部分是真正改变了IT生活。以下就是对IT市场影响最深的10款IT产品:

  1 IBM System/370(1964)

  2以太网(1980)

  3 IBM PC(1981)

  4苹果Macintosh(1984)

  5 SAP R/3(1992)

  6 Salesforce.com(1999)

  7 Linux(1991)

  8 Netscape Navigator浏览器(1994)

  9 Dynamic RAM(动态随机存取存取器)(1970)

  10 BlackBerry智能手机(1999)(友亚)