存档

文章标签 ‘Performance’

高性能MySQL(第二版)

2009年12月11日 没有评论

High Performance MySQL

很不错的一本书,影印版的,英语不好读起来好吃力。昨天从卓越上订了一本,没想到今天上午就到货了,比以前从当当订书快好多呀。喜欢的话,到卓越订购吧,打七折。

内容简介

《高性能MYSQL》教你如何使用MySQL构建快速、可靠的系统。本书的作者都是知名专家,具有多年构建大型系统的实际经验。本书第二版涵盖了MySQL性能细节并且专注于健壮性、安全性和数据完整性。

《高性能MySQL》深入讲解高级技巧从而让你能够受益于MySQL的全部威力。你将学到如何设计模板、索引、查询和令性能最大化的高级MySQL特性。另外,你将获得详细的指导来为你的MySQL服务器、操作系统和硬件进行性能调优以便发挥它们的全部潜能。同时还包括运用实用、安全和高性能的方法来扩展你的应用,使其具有副本保存、负载均衡、高可用和失败自动切换的功能。

本书第二版进行了全面修改以及很大程度地扩展,对所有专题都进行了更有深度的覆盖。主要的新增内容包括:
* 强调性能和可靠性的每一方面
* 详细涵盖搜索引擎,包括深度调优和InnoDB存储引擎的优化
* MySQL5.0和5.1新功能的效用,包括存储过程、数据库分区、触发器和视图
* 对如何使用MySQL构建大型、高可扩展系统进行了详细的讨论
* 备份和副本的新选项
* 高级查询功能的优化,例如全文检索
* 四个全新的附录
本书的内容还包括基准分析、评测报告、备份、安全性以及帮你测量、监控并管理所安装的MySQL的工具和技巧。

分类: 读书 标签: , ,

网站性能优化之Google管理员工具

2009年12月10日 没有评论

google webmaster tools关于网站性能

网站性能是网站管理员工具研究室的实验性功能,会提供网站的延迟资讯给您(如果您要检视网站性能资料,必须先在网站管理员工具新增及验证您的网站)。它会显示您网站的平均网页载入时间,以及过去几个月的网页载入时间趋势,与您网站中载入速度最快跟最慢的网页。

Google网站管理工具–>实验室–>网站性能

labs-site-performance

此网页会显示您网站的性能统计数据

Page Speed 建议

页面下方会给出Page Speed 建议,这个是很值得我们关注的一点。Google会帮我们分析,哪里做的不够好,哪里需要改进的。

如:视野博客在未优化前给出如下建议

/optimizer/structures-using-iis-on-wap-site.html

详细信息:最多可减少 80.6 KB, 可减少 3 项请求, 可减少 3 次 DNS 查询

启用 gzip 压缩
使用 gzip 工具压缩下列资源,可以减少 80.6 KB 的传输量:

合并外部 JavaScript
www.fovweb.com 提供了 4 个 JavaScript 文件,应该将其合并以尽量减少文件数量:

尽量减少 DNS 查询次数

下列网址所在的域分别只提供一个资源。如有可能,请从现有的域提供这些资源,以避免进行额外的 DNS 查询:

此时我们可以发现,自己并不完善的地方,并加以改进。

Install the Page Speed browser add-on

如果你正在使用FireFox浏览器并安装有Firebug的话,加载此插件:

https://dl-ssl.google.com/page-speed/current/page-speed.xpi

运行条件:

使用Page Speed检测网站性能:

  1. 打开Firefox.
  2. 选择 Tools > Firebug > Open Firebug.
  3. 在Firebug窗口中 ,选择Page Speed 标签.
  4. 此时需要等待页面加载完成;
  5. 点击Analyze Performance,此时程序对页面进行分析,然后按重要级别进行排序。
    page-speed
  6. 此时我们需要对得到的结果进行分析,并按需求加以改进。

更多介绍:http://code.google.com/intl/zh-CN/speed/page-speed/docs/using.html

看看优化后的网站的评价:

总结

总的来说,Page Speed还是个很不错的工具。很简单就可以掌握,并很快的帮我们找到网站性能的盲区。期待每一个网站都能像飞一样的快。

MySql性能的检查和调优方法

2009年10月1日 没有评论

我一直是使用mysql这个数据库软件,它工作比较稳定,效率也很高。在遇到严重性能问题时,一般都有这么几种可能:

1、索引没有建好;
2、sql写法过于复杂;
3、配置错误;
4、机器实在负荷不了;

1、索引没有建好

如果看到mysql消耗的cpu很大,可以用mysql的client工具来检查。

在linux下执行

/usr/local/mysql/bin/mysql -hlocalhost -uroot -p

输入密码,如果没有密码,则不用-p参数就可以进到客户端界面中。

看看当前的运行情况

show full processlist

可以多运行几次

这个命令可以看到当前正在执行的sql语句,它会告知执行的sql、数据库名、执行的状态、来自的客户端ip、所使用的帐号、运行时间等信息

在我的cache后端,这里面大部分时间是看不到显示任何sql语句的,我认为这样才算比较正常。如果看到有很多sql语句,那么这台mysql就一定会有性能问题

如果出现了性能问题,则可以进行分析:

1、是不是有sql语句卡住了?

这是出现比较多的情况,如果数据库是采用myisam,那么有可能有一个写入的线程会把数据表给锁定了,如果这条语句不结束,则其它语句也无法运行。

查看processlist里的time这一项,看看有没有执行时间很长的语句,要留意这些语句。

2、大量相同的sql语句正在执行

如果出现这种情况,则有可能是该sql语句执行的效率低下,同样要留意这些语句。

然后把你所怀疑的语句统统集合一下,用desc(explain)来检查这些语句。

首先看看一个正常的desc输出:

mysql> desc select * from imgs where imgid=1651768337;
+—-+————-+——-+——-+—————+———+———+——-+——+——-+
| id | select_type | table | type  | possible_keys | key     | key_len | ref   | rows | Extra |
+—-+————-+——-+——-+—————+———+———+——-+——+——-+
|  1 | SIMPLE      | imgs  | const | PRIMARY       | PRIMARY | 8       | const |    1 |       |
+—-+————-+——-+——-+—————+———+———+——-+——+——-+
1 row in set (0.00 sec)

注意key、rows和Extra这三项,这条语句返回的结果说明了该sql会使用PRIMARY主键索引来查询,结果集数量为1条,Extra没有显 示,证明没有用到排序或其他操作。由此结果可以推断,mysql会从索引中查询imgid=1651768337这条记录,然后再到真实表中取出所有字 段,是很简单的操作。

key是指明当前sql会使用的索引,mysql执行一条简单语句时只能使用到一条索引,注意这个限制;rows是返回的结果集大小,结果集就是使用该索引进行一次搜索的所有匹配结果;Extra一般会显示查询和排序的方式,。

如果没有使用到key,或者rows很大而用到了filesort排序,一般都会影响到效率,例如:

mysql> desc select * from imgs where userid=”7mini” order by clicks desc limit 10;
+—-+————-+——-+——+—————+——+———+——+——-+—————————–+
| id | select_type | table | type | possible_keys | key  | key_len | ref  | rows  | Extra                       |
+—-+————-+——-+——+—————+——+———+——+——-+—————————–+
|  1 | SIMPLE      | imgs  | ALL  | NULL          | NULL | NULL    | NULL | 12506 | Using where; Using filesort |
+—-+————-+——-+——+—————+——+———+——+——-+—————————–+
1 row in set (0.00 sec)

这条sql结果集会有12506条,用到了filesort,所以执行起来会非常消耗效率的。这时mysql执行时会把整个表扫描一遍,一条一条去找到匹 配userid=”7mini”的记录,然后还要对这些记录的clicks进行一次排序,效率可想而知。真实执行时如果发现还比较快的话,那是因为服务器 内存还足够将12506条比较短小的记录全部读入内存,所以还比较快,但是并发多起来或者表大起来的话,效率问题就严重了。

这时我把userid加入索引:

create index userid on imgs (userid);

然后再检查:

mysql> desc select * from imgs where userid=”7mini” order by clicks desc limit 10;
+—-+————-+——-+——+—————+——–+———+——-+——+—————————–+
| id | select_type | table | type | possible_keys | key    | key_len | ref   | rows | Extra                       |
+—-+————-+——-+——+—————+——–+———+——-+——+—————————–+
|  1 | SIMPLE      | imgs  | ref  | userid        | userid | 51      | const |    8 | Using where; Using filesort |
+—-+————-+——-+——+—————+——–+———+——-+——+—————————–+
1 row in set (0.00 sec)

嗯,这时可以看到mysql使用了userid这个索引搜索了,用userid索引一次搜索后,结果集有8条。然后虽然使用了filesort一条一条排序,但是因为结果集只有区区8条,效率问题得以缓解。

但是,如果我用别的userid查询,结果又会有所不同:

mysql> desc select * from imgs where userid=”admin” order by clicks desc limit 10;
+—-+————-+——-+——+—————+——–+———+——-+——+—————————–+
| id | select_type | table | type | possible_keys | key    | key_len | ref   | rows | Extra                       |
+—-+————-+——-+——+—————+——–+———+——-+——+—————————–+
|  1 | SIMPLE      | imgs  | ref  | userid        | userid | 51      | const | 2944 | Using where; Using filesort |
+—-+————-+——-+——+—————+——–+———+——-+——+—————————–+
1 row in set (0.00 sec)

这个结果和userid=”7mini”的结果基本相同,但是mysql用userid索引一次搜索后结果集的大小达到2944条,这2944条记录都会 加入内存进行filesort,效率比起7mini那次来说就差很多了。这时可以有两种办法可以解决,第一种办法是再加一个索引和判断条件,因为我只需要 根据点击量取最大的10条数据,所以有很多数据我根本不需要加进来排序,比如点击量小于10的,这些数据可能占了很大部分。

我对clicks加一个索引,然后加入一个where条件再查询:

create index clicks on imgs(clicks);

mysql> desc select * from imgs where userid=”admin” order by clicks desc limit 10;
+—-+————-+——-+——+—————+——–+———+——-+——+—————————–+
| id | select_type | table | type | possible_keys | key    | key_len | ref   | rows | Extra                       |
+—-+————-+——-+——+—————+——–+———+——-+——+—————————–+
|  1 | SIMPLE      | imgs  | ref  | userid,clicks | userid | 51      | const | 2944 | Using where; Using filesort |
+—-+————-+——-+——+—————+——–+———+——-+——+—————————–+
1 row in set (0.00 sec)

这时可以看到possible_keys变成了userid,clicks,possible_keys是可以匹配的所有索引,mysql会从 possible_keys中自己判断并取用其中一个索引来执行语句,值得注意的是,mysql取用的这个索引未必是最优化的。这次查询mysql还是使 用userid这个索引来查询的,并没有按照我的意愿,所以结果还是没有什么变化。改一下sql加上use index强制mysql使用clicks索引:

mysql> desc select * from imgs use index (clicks) where userid=’admin’ and clicks>10 order by clicks desc limit 10
+—-+————-+——-+——-+—————+——–+———+——+——+————-+
| id | select_type | table | type  | possible_keys | key    | key_len | ref  | rows | Extra       |
+—-+————-+——-+——-+—————+——–+———+——+——+————-+
|  1 | SIMPLE      | imgs  | range | clicks        | clicks | 4       | NULL | 5455 | Using where |
+—-+————-+——-+——-+—————+——–+———+——+——+————-+
1 row in set (0.00 sec)

这时mysql用到了clicks索引进行查询,但是结果集比userid还要大!看来还要再进行限制:

mysql> desc select * from imgs use index (clicks) where userid=’admin’ and clicks>1000 order by clicks desc limit 10
+—-+————-+——-+——-+—————+——–+———+——+——+————-+
| id | select_type | table | type  | possible_keys | key    | key_len | ref  | rows | Extra       |
+—-+————-+——-+——-+—————+——–+———+——+——+————-+
|  1 | SIMPLE      | imgs  | range | clicks        | clicks | 4       | NULL |  312 | Using where |
+—-+————-+——-+——-+—————+——–+———+——+——+————-+
1 row in set (0.00 sec)

加到1000的时候结果集变成了312条,排序效率应该是可以接受。

不过,采用换索引这种优化方式需要取一个采样点,比如这个例子中的1000这个数字,这样,对userid的每个数值,都要去找一个采样点,这样对程序来 说是很难办的。如果按1000取样的话,那么userid=’7mini’这个例子中,取到的结果将不会是8条,而是2条,给用户造成了困惑。

当然还有另一种办法,加入双索引:

create index userid_clicks on imgs (userid, clicks)

mysql> desc select * from imgs where userid=”admin” order by clicks desc limit 10;
+—-+————-+——-+——+———————-+—————+———+——-+——+————-+
| id | select_type | table | type | possible_keys        | key           | key_len | ref   | rows | Extra       |
+—-+————-+——-+——+———————-+—————+———+——-+——+————-+
|  1 | SIMPLE      | imgs  | ref  | userid,userid_clicks | userid_clicks | 51      | const | 2944 | Using where |
+—-+————-+——-+——+———————-+—————+———+——-+——+————-+
1 row in set (0.00 sec)

这时可以看到,结果集还是2944条,但是Extra中的filesort不见了。这时mysql使用userid_clicks这个索引去查询,这不但 能快速查询到userid=”admin”的所有记录,并且结果是根据clicks排好序的!所以不用再把这个结果集读入内存一条一条排序了,效率上会高 很多。

但是用多字段索引这种方式有个问题,如果查询的sql种类很多的话,就得好好规划一下了,否则索引会建得非常多,不但会影响到数据insert和update的效率,而且数据表也容易损坏。

以上是对索引优化的办法,因为原因可能会比较复杂,所以写得比较的长,一般好好优化了索引之后,mysql的效率会提升n个档次,从而也不需要考虑增加机器来解决问题了。

但是,mysql甚至所有数据库,可能都不好解决limit的问题。在mysql中,limit 0,10只要索引合适,是没有问题的,但是limit 100000,10就会很慢了,因为mysql会扫描排好序的结果,然后找到100000这个点,取出10条返回。要找到100000这个点,就要扫描 100000条记录,这个循环是比较耗时的。不知道会不会有什么好的算法可以优化这个扫描引擎,我冥思苦想也想不出有什么好办法。对于limit,目前直 至比较久远的将来,我想只能通过业务、程序和数据表的规划来优化,我想到的这些优化办法也都还没有一个是万全之策,往后再讨论。

2、sql写法过于复杂

sql写法假如用到一些特殊的功能,比如groupby、或者多表联合查询的话,mysql用到什么方式来查询也可以用desc来分析,我这边用复杂sql的情况还不算多,所以不常分析,暂时就没有好的建议。

3、配置错误

配置里主要参数是key_buffer、sort_buffer_size/myisam_sort_buffer_size,这两个参数意思是:

key_buffer=128M:全部表的索引都会尽可能放在这块内存区域内,索引比较大的话就开稍大点都可以,我一般设为128M,有个好的建议是把很少用到并且比较大的表想办法移到别的地方去,这样可以显著减少mysql的内存占用。
sort_buffer_size=1M:单个线程使用的用于排序的内存,查询结果集都会放进这内存里,如果比较小,mysql会多放几次,所以稍微开大一点就可以了,重要是优化好索引和查询语句,让他们不要生成太大的结果集。

另外一些配置:
thread_concurrency=8:这个配置标配=cpu数量x2
interactive_timeout=30
wait_timeout=30:这两个配置使用10-30秒就可以了,这样会尽快地释放内存资源,注意:一直在使用的连接是不会断掉的,这个配置只是断掉了长时间不动的连接。
query_cache:这个功能不要使用,现在很多人看到cache这几个字母就像看到了宝贝,这是不唯物主义的。mysql的query_cache 在每次表数据有变化的时候都会重新清理连至该表的所有缓存,如果更新比较频繁,query_cache不但帮不上忙,而且还会对效率影响很大。这个参数只 适合只读型的数据库,如果非要用,也只能用query_cache_type=2自行用SQL_CACHE指定一些sql进行缓存。
max_connections:默认为100,一般情况下是足够用的,但是一般要开大一点,开到400-600就可以了,能超过600的话一般就有效率问题,得另找对策,光靠增加这个数字不是办法。

其它配置可以按默认就可以了,个人觉得问题还不是那么的大,提醒一下:1、配置虽然很重要,但是在绝大部分情况下都不是效率问题的罪魁祸首。2、mysql是一个数据库,对于数据库最重要考究的不应是效率,而是稳定性和数据准确性。

4、机器实在负荷不了

如果做了以上调整,服务器还是不能承受,那就只能通过架构级调整来优化了。

1、mysql同步。

通过mysql同步功能将数据同步到数台从数据库,由主数据库写入,从数据库提供读取。

我个人不是那么乐意使用mysql同步,因为这个办法会增加程序的复杂性,并常常会引起数据方面的错误。在高负荷的服务中,死机了还可以快速重启,但数据错误的话要恢复就比较麻烦。

2、加入缓存

加入缓存之后,就可以解决并发的问题,效果很明显。如果是实时系统,可以考虑用刷新缓存方式使缓存保持最新。

在前端加入squid的架构比较提倡使用,在命中率比较高的应用中,基本上可以解决问题。

如果是在程序逻辑层里面进行缓存,会增加很多复杂性,问题会比较多而且难解决,不建议在这一层面进行调整。

3、程序架构调整,支持同时连接多个数据库

如果web加入缓存后问题还是比较严重,只能通过程序架构调整,把应用拆散,用多台的机器同时提供服务。

如果拆散的话,对业务是有少许影响,如果业务当中有部分功能必须使用所有的数据,可以用一个完整库+n个分散库这样的架构,每次修改都在完整库和分散库各操作一次,或定期整理完整库。

当然,还有一种最笨的,把数据库整个完完整整的做拷贝,然后程序每次都把完整的sql在这些库执行一遍,访问时轮询访问,我认为这样要比mysql同步的方式安全。

4、使用 mysql proxy 代理

mysql proxy 可以通过代理把数据库中的各个表分散到数台服务器,但是它的问题是没有能解决热门表的问题,如果热门内容散在多个表中,用这个办法是比较轻松就能解决问题。

我没有用过这个软件也没有认真查过,不过我对它的功能有一点点怀疑,就是它怎么实现多个表之间的联合查询?如果能实现,那么效率如何呢?

5、使用memcachedb

数据库换用支持mysql的memcachedb,是可以一试的想法,从memcachedb的实现方式和层面来看对数据没有什么影响,不会对用户有什么困扰。

为我现在因为数据库方面问题不多,没有试验过这个玩意。不过,只要它支持mysql的大部分主要的语法,而且本身稳定,可用性是无需置疑的。

FROM:http://www.sudone.com/linux/mysql_debug.html

Siege:压力模拟/测试工具

2009年5月1日 没有评论

JoedogSiege是一个压力测试和评测工具,设计用于WEB开发这评估应用在压力下的承受能力:可以根据配置对一个WEB站点进行多用户的并发访问,记录每个用户所有请求过程的相应时间,并在一定数量的并发访问下重复进行。

最早使用的压力测试工具是apache的ab(apache benchmark),apache ab做重复压力测试不错,但是每次只能测试一个链接,如何测试一组链接(比如从日志中导出的1个小时的日志,做真实压力测试),后来找到了这个:

SIEGE is an http regressive testing and benchmarking utility. It was designed to let web developers measure the performance of their code under duress, to see how it will stand up to load on the internet. It lets the user hit a webserver with a configurable number of concurrent simulated users. Those users place the webserver “under siege.” The duration of the siege is measured in transactions, the sum of simulated users and the number of times each simulated user repeats the process of hitting the server. Thus 20 concurrent users 50 times is 1000 transactions, the length of the test.

下载/安装
Siege时一个开放源代码项目:http://www.joedog.org

下载:
wget ftp://sid.joedog.org/pub/siege/siege-latest.tar.gz

安装:
%./configure ; make
#make install

siege包含了一组压力测试工具:
SIEGE (1) Siege是一个HTTP压力测试和评测工具.
使用样例:
任务列表:www.chedong.com.url文件

http://www.chedong.com/tech/

http://www.chedong.com/tech/acdsee.html

http://www.chedong.com/tech/ant.html

http://www.chedong.com/tech/apache_install.html

http://www.chedong.com/tech/awstats.html

http://www.chedong.com/tech/cache.html

http://www.chedong.com/tech/click.html

http://www.chedong.com/tech/cms.html

http://www.chedong.com/tech/compress.html

http://www.chedong.com/tech/cvs_card.html

http://www.chedong.com/tech/default.html

http://www.chedong.com/tech/dev.html

http://www.chedong.com/tech/gnu.html

….

siege -c 20 -r 2 -f www.chedong.com.url
参数说明:
-c 20 并发20个用户
-r 2 重复循环2次
-f www.chedong.com.url 任务列表:URL列表

输出样例:

** Siege 2.59
** Preparing 20 concurrent users for battle. 这次“战斗”准备了20个并发用户
The server is now under siege.. done. 服务在“围攻”测试中:
Transactions: 40 hits 完成40次处理
Availability: 100.00 % 成功率
Elapsed time: 7.67 secs 总共用时
Data transferred: 877340 bytes 共数据传输:877340字节
Response time: 1.65 secs 相应用时1.65秒:显示网络连接的速度
Transaction rate: 5.22 trans/sec 平均每秒完成5.22次处理:表示服务器后台处理的速度
Throughput: 114385.92 bytes/sec 平均每秒传送数据:114385.92字节
Concurrency: 8.59 最高并发数 8.59
Successful transactions: 40 成功处理次数
Failed transactions: 0 失败处理次数

注意:由于速度很快,可能会达不到并发速度很高就已经完成。Response time显示的是测试机器和被测试服务器之间网络链接状况。Transaction rate则表示服务器端任务处理的完成速度。

辅助工具:
增量压力测试:
为了方便增量压力测试,siege还包含了一些辅助工具:
bombardment (1)
是一个辅助工具:用于按照增量用户压力测试:
使用样例:
bombardment urlfile.txt 5 3 4 1
初始化URL列表:urlfile.txt
初始化为:5个用户
每次增加:3个用户
运行:4次
每个客户端之间的延迟为:1秒

输出成CSV格式:
siege2csv.pl (1)
siege2csv.pl将bombardment的输出变成CSV格式:
Time Data Transferred Response Time Transaction Rate Throughput Concurrency Code 200 (note that this is horribly broken.)
242 60.22 603064 0.02 4.02 10014.35 0.08
605 59.98 1507660 0.01 10.09 25136.05 0.12
938 59.98 2337496 0.02 15.64 38971.26 0.26
1157 60 2883244 0.04 19.28 48054.07 0.78

参考:
开源测试工具:http://www.opensourcetesting.org/performance.php

压力测试工具:HammerHead 正在试用中

作者:车东

http://www.chedong.com/blog/archives/000033.html

开源网站压力测试工具

2009年5月1日 没有评论

互联网的普及,宽带的流行,使得越来越多的个人和单位都架设了自己的网站。而充当网站的服务器的大多是普通的PC或者低档服务器,这样访问者人数一多或者遭受DDos攻击,很容易造成瘫痪。因此我们需要网站在真正发布前对其进行压力测试,即让少量的客户端计算机或一台计算机仿真模拟出大量用户同时访问,以获得服务器的承受能力。

Apache JMeter

Description:

Apache JMeter is a 100% pure Java desktop application designed to load test functional behavior and measure performance. It was originally designed for testing Web Applications but has since expanded to other test functions. Apache JMeter may be used to test performance both on static and dynamic resources (files, Servlets, Perl scripts, Java Objects, Data Bases and Queries, FTP Servers and more). It can be used to simulate a heavy load on a server, network or object to test its strength or to analyze overall performance under different load types. You can use it to make a graphical analysis of performance or to test your server/script/object behavior under heavy concurrent load.

Requirement:

Solaris, Linux, Windows (98, NT, 2000). JDK1.4 (or higher).

Download data:

No data feed available

benerator

Description:

benerator is a framework for creating realistic and valid high-volume test data, used for (unit/integration/load) testing and showcase setup. Metadata constraints are imported from systems and/or configuration files. Data can be imported from and exported to files and systems, anonymized or generated from scratch. Domain packages provide reusable generators for creating domain-specific data as names and addresses internationalizable in language and region. It is strongly customizable with plugins and configuration options.

Requirement:

Platform Independent

Download data:

No data feed available

CLIF is a Load Injection Framework

Description:

CLIF is a modular and flexible distributed load testing platform. It may address any target system that is reachable from a Java program (HTTP, DNS, TCP/IP…) CLIF provides 3 user interfaces (Swing or Eclipse GUI, command line) to deploy, control and monitor a set of distributed load injectors and resource consumption probes (CPU, memory…) An Eclipse wizard helps programming support for new protocols. Load scenarios are defined through XML-editing, using a GUI, or using a capture tool. The scenario execution engine allows the execution of up to millions of virtual users per load injector.

Requirement:

Java 1.5 or greater, with enhanced support for Linux, Windows XP, MacOSX/PPC

Download data:

No data feed available

curl-loader

Description:

A C-written web application testing and load generating tool. The goal of the project is to provide a powerful open-source alternative to Spirent Avalanche and IXIA IxLoad. The loader uses real HTTP, FTP and TLS/SSL protocol stacks, simulating tens of thousand and hundred users/clients each with own IP-address. The tool supports user authentication, login and a range of statistics.

Requirement:

linux

Download data:

Downloadable files: 16208 total downloads to date

Database Opensource Test Suite

Description:

The Database Opensource Test Suite (DOTS) is a set of test cases designed for the purpose of stress-testing database server systems in order to measure database server performance and reliability.

Requirement:

Linux, POSIX

Download data:

Downloadable files: 168089 total downloads to date

DBMonster

Description:

DBMonster is an application to generate random data for testing SQL database driven applications under heavy load.

Requirement:

OS Independent

Download data:

Downloadable files: 20474 total downloads to date

Deluge

Description:

An open-source web site stress test tool. Simulates multiple user types and counts. Includes proxy server for recording playback scripts, and log evaluator for generating result statistics. Note: this tool is no longer under active development although it is still available on Sourceforge.

Requirement:

OS independent

Download data:

Downloadable files: 10702 total downloads to date

Dieseltest

Description:

Contains the high-end features common to packages costing $50,000 or more. Dieseltest is a Windows application that simulates hundreds or thousands of users hitting a website. To run a load test, you first create a test script using our script editor. The script contains all of the requests that a real-world user would make of a website. You then load the script and run the test. The system will show you real-time results while the script is running, and produce a report analyzing the results at the conclusion.

Requirement:

Windows

Download data:

Downloadable files: 21895 total downloads to date

Faban

Description:

Faban is a facility for developing and running benchmarks, developed by Sun. It has two major components, the Faban harness and the Faban driver framework. The Faban harness is a harness to automate running of server benchmarks as well as a container to host benchmarks allowing new benchmarks to be deployed in a rapid manner. Faban provides a web interface to launch & queue runs, and extensive functionality to view, compare and graph run outputs.

Requirement:

OS independent; JVM 1.5 or later.

Download data:

No data feed available

FunkLoad

Description:

FunkLoad is a functional and load web tester, written in Python, whose main use cases are functional and regression testing of web projects, performance testing by loading the web application and monitoring your servers, load testing to expose bugs that do not surface in cursory testing, and stress testing to overwhelm the web application resources and test the application recoverability, and writing web agents by scripting any web repetitive task, like checking if a site is alive.

Requirement:

OS independent – except for the monitoring which is Linux specific.

Download data:

No data feed available

FWPTT load testing web applications

Description:

fwptt is an open source Web application testing program for load testing web applications. It can record normal and AJAX requests. It has been tested on ASP.Net applications, but it should work with JSP, PHP or other.

Requirement:

windows

Download data:

Downloadable files: 4415 total downloads to date

Grinder

Description:

The Grinder is a Java load-testing framework making it easy to orchestrate the activities of a test script in many processes across many machines, using a graphical console application.

Requirement:

OS Independent

Download data:

Downloadable files: 201699 total downloads to date

Hammerhead 2 – Web Testing Tool

Description:

Hammerhead 2 is a stress testing tool designed to test out your web server and web site. It can initiate multiple connections from IP aliases and simulated numerous (256+) users at any given time. The rate at which Hammerhead 2 attempts to pound your site is fully configurable, there are numerous other options for trying to create problems with a web site (so you can fix them).

Requirement:

Hammerhead has been used with Linux, Solaris and FreeBSD.

Download data:

Downloadable files: 30148 total downloads to date

Hammerora

Description:

Hammerora is a load generation tool for the Oracle Database and Web Applications. Hammerora includes pre-built schema creation and load tests based on the industry standard TPC-C and TPC-H benchmarks to deploy against the Oracle database with multiple users. Hammerora also converts and replays Oracle trace files and enables Web-tier testing to build bespoke load tests for your entire Oracle application environment.

Requirement:

Platform Independent (Binaries for Linux and Windows)

Download data:

Downloadable files: 23588 total downloads to date

httperf

Description:

Httperf is a tool for measuring web server performance. It provides a flexible facility for generating various HTTP workloads and for measuring server performance. The focus is not on implementing one particular benchmark but on providing a robust, high-performance tool that facilitates the construction of both micro and macro level benchmarks. The three distinguishing characteristics of httperf are its robustness, which includes the ability to generate and sustain server overload, support for the HTTP/1.1 and SSL protocols, and its extensibility.

Requirement:

linux (Debian package available), HP-UX, perhaps other Unix

Download data:

No data feed available

http_load

Description:

http_load runs multiple HTTP fetches in parallel, to test the throughput of a Web server. However, unlike most such test clients, it runs in a single process, to avoid bogging the client machine down. It can also be configured to do HTTPS fetches.

Requirement:

tbc

Download data:

No data feed available

JChav

Description:

JChav is a way to see the change in performance of your web application over time, by running a benchmark test for each build you produce. JChav reads all the JMeter logs from each of your runs (one per build), and produces a set of charts for each test in each run.

Requirement:

JMeter

Download data:

No data feed available

JCrawler

Description:

Stress-Testing Tool for web-applications. It comes with the crawling/exploratory feature. You can give JCrawler a set of starting URLs and it will begin crawling from that point onwards, going through any URLs it can find on its way and generating load on the web application. The load parameters (hits/sec) are configurable.

Requirement:

OS Independent

Download data:

Downloadable files: 17500 total downloads to date

Lobo, Continuous Tuning

Description:

Lobo is a tool for performance testing and monitoring that allows you to monitor the evolution of performance along the time-line of the project. It was specially designed to be used in agile-iterative and evolutionary approaches.

Requirement:

Java

Download data:

No data feed available

MessAdmin

Description:

MessAdmin is a light-weight and non-intrusive notification system and HttpSession administration for J2EE Web Applications, giving detailed statistics and informations on the application. It installs as a plug-in to any Java EE WebApp, and requires zero-code modification.

Requirement:

OS Independant

Download data:

Downloadable files: 9489 total downloads to date

NTime

Description:

The NTime tool is very similar to NUnit tool to perform repeatable tasks that help managers, architects, developers and testers to test an application against its performance.

Requirement:

Windows 98 or above, .Net framework 1.1 or 2.0

Download data:

No data feed available

OpenSTA

Description:

A distributed software testing architecture based on CORBA. Using OpenSTA (Open System Testing Architecture) a user can generate realistic heavy loads simulating the activity of hundreds to thousands of virtual users. OpenSTA graphs both virtual user response times and resource utilization information from all Web Servers, Application Servers, Database Servers and Operating Platforms under test, so that precise performance measurements can be gathered during load tests and analysis on these measurements can be performed.

Requirement:

Windows 2000, NT4 and XP

Download data:

Downloadable files: 334364 total downloads to date

OpenWebLoad

Description:

OpenWebLoad is a tool for load testing web applications. It aims to be easy to use and providing near real-time performance measurements of the application under test.

Requirement:

Linux, Windows

Download data:

Downloadable files: 39663 total downloads to date

p-unit

Description:

An open source framework for unit test and performance benchmark, which was initiated by Andrew Zhang, under GPL license. p-unit supports to run the same tests with single thread or multi-threads, tracks memory and time consumption, and generates the result in the form of plain text, image or pdf file.

Requirement:

OS Independent

Download data:

Downloadable files: 3305 total downloads to date

PandoraFMS

Description:

Pandora FMS is a monitoring Open Source software. It watches your systems and applications, and allows you to know the status of any element of those systems. Pandora FMS could detect a network interface down, a defacement in your website, a memory leak in one of your server application, or the movement of any value of the NASDAQ new technology market. If you want, Pandora FMS could send out SMS message when your systems fails… or when Google’s value drop below US$ 500.

Requirement:

32-bit MS Windows (NT/2000/XP), All POSIX (Linux/BSD/UNIX-like OSes), Solaris, HP-UX, IBM AIX

Download data:

Downloadable files: 134584 total downloads to date

Pylot

Description:

Pylot is a free open source tool for testing performance and scalability of web services. It runs HTTP load tests, which are useful for capacity planning, benchmarking, analysis, and system tuning. Pylot generates concurrent load (HTTP Requests), verifies server responses, and produces reports with metrics. Tests suites are executed and monitored from a GUI.

Requirement:

Python 2.5+. required.Tested on Windows XP, Vista, Cygwin, Ubuntu, MacOS

Download data:

No data feed available

Seagull

Description:

Seagull is a multi-protocol traffic generator test tool. Primary aimed at IMS protocols, Seagull is a powerful traffic generator for functional, load, endurance, stress and performance tests for almost any kind of protocol. Currently supports Diameter, XCAP over HTTP, TCAP (GSM Camel, MAP, Win) protocols.

Requirement:

Linux/Unix/Win32-Cygwin

Download data:

Downloadable files: 23752 total downloads to date

Siege

Description:

SIEGE is an http regression testing and benchmarking utility. It was designed to let web developers measure the performance of their code under duress, to see how it will stand up to load on the internet. It lets the user hit a webserver with a configurable number of concurrent simulated users. Those users place the webserver “under siege.” SCOUT surveys a webserver and prepares the urls.txt file for a siege. In order to perform regression testing, siege loads URLs from a file and runs through them sequentially or randomly. Scout makes the process of populating that file easier. You should send out the scout, before you lay siege.

Requirement:

GNU/Linux, AIX, BSD, HP-UX and Solaris.

Download data:

Downloadable files: 744 total downloads to date

Sipp

Description:

SIPp is a performance testing tool for the SIP protocol. Its main features are basic SIPStone scenarios, TCP/UDP transport, customizable (xml based) scenarios, dynamic adjustement of call-rate and a comprehensive set of real-time statistics. It can also generate media (RTP) traffic for audio and video calls.

Requirement:

Linux/Unix/Win32-Cygwin

Download data:

Downloadable files: 178179 total downloads to date

SLAMD

Description:

SLAMD Distributed Load Generation Engine is a Java-based application designed for stress testing and performance analysis of network-based applications.

Requirement:

Any system with Java 1.4 or higher

Download data:

No data feed available

Soap-Stone

Description:

Network benchmark application which can put your network under load and conduct automatic benchmark and recording activities.

Requirement:

OS Independent

Download data:

Downloadable files: 6251 total downloads to date

stress_driver

Description:

General-purpose stress test tool.

Requirement:

Windows NT/2000, Linux

Download data:

Downloadable files: 6966 total downloads to date

TestMaker

Description:

TestMaker from PushToTest.com delivers a rich environment for building and running intelligent test agents that test Web-enabled applications for scalability, functionality, and performance. It comes with a friendly graphical user environment, an object-oriented scripting language (Jython) to build intelligent test agents, an extensible library of protocol handlers (HTTP, HTTPS, SOAP, XML-RPC, SMTP, POP3, IMAP), a new agent wizard featuring an Agent Recorder to write scripts for you, a library of fully-functional sample test agents, and shell scripts to run test agents from the command line and from unit test utilities.

Requirement:

Java 1.4 or higher virtual machine on Windows, Linux, Solaris, and Macintosh.

Download data:

No data feed available

TPTEST

Description:

The purpose with TPTEST is to allow users to measure the speed of their Internet connection in a simple way. TPTEST measures the throughput speed to and from various reference servers on the Internet. The use of TPTEST may help increase the consumer/end user knowledge of how Internet services work.

Requirement:

MacOS/Carbon and Win32

Download data:

Downloadable files: 147415 total downloads to date

Tsung

Description:

Tsung is a distributed load testing tool. It is protocol-independent and can currently be used to stress HTTP, SOAP and Jabber servers (SSL is supported). It simulates complex user’s behaviour using an XML description file, reports many measurements in real time (including response times, CPU and memory usage from servers, customized transactions, etc.). HTML reports (with graphics) can be generated during the load. For HTTP, it supports 1.0 and 1.1, has a proxy mode to record sessions, supports GET and POST methods, Cookies, and Basic WWW-authentication. It has already been used to simulate thousands of virtual users.

Requirement:

Tested on Linux, but should work on MacOSX and Windows.

Download data:

No data feed available

Valgrind

Description:

Valgrind is an award-winning suite of tools for debugging and profiling Linux programs. With the tools that come with Valgrind, you can automatically detect many memory management and threading bugs, avoiding hours of frustrating bug-hunting, making your programs more stable. You can also perform detailed profiling, to speed up and reduce memory use of your programs.

Requirement:

Linux

Download data:

No data feed available

Web Application Load Simulator

Description:

LoadSim is a web application load simulator. It allows you to create simulations and have those simulations run against your webserver.

Requirement:

JDK 1.3 or above

Download data:

Downloadable files: 8983 total downloads to date

Web Polygraph

Description:

Benchmarking tool for caching proxies, origin server accelerators, L4/7 switches, content filters, and other Web intermediaries.

Requirement:

C++ compiler

Download data:

No data feed available

WebLOAD

Description:

WebLOAD Open Source is a fully functional, commercial-grade performance testing product based on WebLOAD, Radview’s flagship product that is already deployed at 1,600 sites. Available for free download and use, WebLOAD is a commercial-grade open source project with more than 250 engineering years of product development. Companies that require commercial support, additional productivity features and compatibility with third-party protocols have the option of purchasing WebLOAD Professional directly from RadView.

Requirement:

Windows NT/2000/XP

Download data:

Downloadable files: 107197 total downloads to date

MySQL优化之数据类型的使用

2009年3月16日 没有评论

有助于效率的类型选择

1、使你的数据尽可能小

最基本的优化之一是使你的数据(和索引)在磁盘上(并且在内存中)占据的空间尽可能小。这能给出巨大的改进,因为磁盘读入较快并且通常也用较少的主存储器。如果在更小的列上做索引,索引也占据较少的资源。

你能用下面的技术使表的性能更好并且使存储空间最小:

·尽可能地使用最有效(最小)的类型。MySQL有很多节省磁盘空间和内存的专业化类型。

·如果可能使表更小,使用较小的整数类型。例如,MEDIUMINT经常比INT好一些。

·如果可能,声明列为NOT NULL。它使任何事情更快而且你为每列节省一位。注意如果在你的应用程序中你确实需要NULL,你应该毫无疑问使用它,只是避免缺省地在所有列上有它。

2、使用定长列,不使用可变长列

这条准则对被经常修改,从而容易产生碎片的表来说特别重要。例如,应该选择 CHAR 列而不选择 VARCHAR 列。所要权衡的是使用定长列时,表所占用的空间更多,但如果能够承担这种空间的耗费,使用定长行将比使用可变长的行处理快得多。

3、将列定义为 NOT NULL

这样处理更快,所需空间更少。而且有时还能简化查询,因为不需要检查是否存在特例 NULL。

4、考虑使用 ENUM 列

如果有一个只含有限数目的特定值的列,那么应该考虑将其转换为 ENUM 列。ENUM 列的值可以更快地处理,因为它们在内部是以数值表示的。

有关BLOB和TEXT类型

1、使用BLOB和TEXT类型的优点

用 BLOB 存储应用程序中包装或未包装的数据,有可能使原来需要几个检索操作才能完成的数据检索得以在单个检索操作中完成。而且还对存储标准表结构不易表示的数据或随时间变化的数据有帮助。

2、使用BLOB和TEXT类型的可能弊端

另一方面,BLOB 值也有自己的固有问题,特别是在进行大量的 DELETE 或 UPDATE 操作时更是如此。删除 BLOB 会在表中留下一个大空白,在以后将需用一个记录或可能是不同大小的多个记录来填充。

除非有必要,否则应避免检索较大的 BLOB 或 TEXT 值。例如,除非肯定WHERE 子句能够将结果恰好限制在所想要的行上,否则 SELECT * 查询不是一个好办法。这样做可能会将非常大的 BLOB 值无目的地从网络上拖过来。这是存储在另一列中的 BLOB 标识信息很有用的另一种情形。可以搜索该列以确定想要的行,然后从限定的行中检索 BLOB 值。

3、必要的准则

对容易产生碎片的表使用 OPTIMIZE TABLE

大量进行修改的表,特别是那些含有可变长列的表,容易产生碎片。碎片不好,因为它在存储表的磁盘块中产生不使用的空间。随着时间的增长,必须读取更 多的块才能取到有效的行,从而降低了性能。任意具有可变长行的表都存在这个问题,但这个问题对 BLOB 列更为突出,因为它们尺寸的变化非常大。经常使用 OPTIMIZE TABLE 有助于保持性能不下降。

使用多列索引

多列索引列有时很有用。一种技术是根据其他列建立一个散列值,并将其存储在一个独立的列中,然后可通过搜索散列值找到行。这只对精确匹配的查询有 效。(散列值对具有诸如“<”或“>=”这样的操作符的范围搜索没有用处)。在MySQL 3.23版及以上版本中,散列值可利用 MD5( ) 函数产生。散列索引对 BLOB 列特别有用。有一事要注意,在 MySQL 3.23.2 以前的版本中,不能索引 BLOB 类型。甚至是在 3.23.2 或更新的版本中,利用散列值作为标识值来查找 BLOB 值也比搜索 BLOB 列本身更快。

将 BLOB 值隔离在一个独立的表中

在某些情况下,将 BLOB 列从表中移出放入另一个副表可能具有一定的意义,条件是移出 BLOB 列后可将表转换为定长行格式。这样会减少主表中的碎片,而且能利用定长行的性能优势。

使用ANALYSE过程检查表列

如果使用的是 MySQL 3.23 或更新的版本,应该执行 PROCEDURE ANALYSE( ),查看它所提供的关于表中列的信息

ANALYSE([max elements,[max memory]])

它检验来自你的查询的结果并返回结果的分析。

max elements(缺省256)是analyse将注意的每列不同值的最大数量。这被ANALYSE用来检查最佳的列类型是否应该是ENUM类型。

max memory(缺省8192)是在analyse尝试寻找所有不同值的时候应该分配给每列的最大内存量。

SELECT … FROM … WHERE … PROCEDURE ANALYSE([max elements,[max memory]])

例如:

mysql>SELECT * FROM student PROCEDURE ANALYSE();

mysql>SELECT * FROM student PROCEDURE ANALYSE(16,256);

相应输出中有一列是关于表中每列的最佳列类型的建议。第二个例子要求 PROCEDURE ANALYSE( ) 不要建议含有多于 16 个值或取多于 256 字节的 ENUM 类型(可根据需要更改这些值)。如果没有这样的限制,输出可能会很长;ENUM 的定义也会很难阅读。

根据 PROCEDURE ANALYSE( ) 的输出,会发现可以对表进行更改以利用更有效的类型。如果希望更改值类型,使用 ALTER TABLE 语句即可。

推荐阅读《高性能网站建设指南》

2009年2月20日 没有评论

高性能网站建设指南

又名: High Performance Web Sites

译者: 刘彦博
作者: (美)桑德斯(Sounders,S.)
副标题: 前端工程师技能精髓
ISBN: 9787121066191
页数: 146 页
定价: 35.0
出版社: 电子工业出版社
装帧: 平装

出版年: 2008年

简介   · · · · · ·
本书结合Web 2.0以来Web开发领域的最新形势和特点,介绍了网站性能问题的现状、产生的原因,以及改善或解决性能问题的原则、技术技巧和最佳实践。重点关注网页的行为特征,阐释优化Ajax、CSS、JavaScript、Flash和图片处理等要素的技术,全面涵盖浏览器端性能问题的方方面面。在《高性能网站建设指南》中,作者给出了14条具体的优化原则,每一条原则都配以范例佐证,并提供了在线支持。《高性能网站建设指南》内容丰富,主要包括减少HTTP请求、Edge Computing技术、Expires Header技术、Gzip组件、CSS和JavaScript最佳实践、主页内联、Domain最小化、JavaScript优化、避免重定向的技巧、删除重复JavaScript的技巧、关闭ETags的技巧、Ajax缓存技术和最小化技术等。《高性能网站建设指南》适合Web架构师、信息架构师、 Web开发人员及产品经理阅读和参考。
作者简介   · · · · · ·
Steve Souders在Yahoo!担任Chief Performance。他于2000年加盟Yahoo!,在该公司的很多平台和产品团队中工作过。在他到达今天这个位置之前,他就职于My Yahoo!开发团队。.
作为Chief Performance Yahoo!,他开发了一系列优秀软件,可以使网站访问速度变得更快。他构建了用于进行性能分析的工具,并将这些优秀软件和工具传播到Yahoo!的各个产品团队中。
在到Yahoo!之前,Steve就职于很多小型或中型公司,包括他和别人一起创办的两个公司——Helix Systems和CoolSync。

分类: 读书 标签: , ,