Skip to content

{ Tag Archives } Internet

Web 开发人员速查卡

FROM: Web开发人员速查卡

无论你是多牛的程序员,你都无法记住所有的东西。而很多时候,查找某些知识又比较费事。所以,网上有很多Cheat Sheets,翻译成小抄也好 ,速查卡也好,总之就是帮你节省 时间的。之前给大家介绍过Web设计的速查卡25个jQuery的编程小抄,还有程序员小抄大全,今天转一篇开发人员的速查卡,源文在这里。下面的文章我就不翻译了。

HTML Cheat Sheet

CSS Cheat Sheets

Adobe Flash Cheat Sheets

ASP Cheat Sheets

PHP Cheat Sheets

MySQL Cheat Sheets

JavaScript Cheat Sheets

jQuery Cheat Sheets

Unicode Cheat Sheets

XML Cheat Sheets

mod_rewrite and .htaccess Cheat Sheets

Also tagged

网站压力测试工具webbench

FROM: 找到一款不错的网站压力测试工具webbench

webbench是 *nix 系统下一网站负载能力测试工具,它最多可以模拟 3 万个并发连接。

安装

[root@localhost tmp]# wget http://home.tiscali.cz/~cz210552/distfiles/webbench-1.5.tar.gz
[root@localhost tmp]# tar xvzf webbench-1.5.tar.gz
[root@localhost tmp]# cd webbench-1.5
[root@localhost webbench-1.5]# make
[root@localhost webbench-1.5]# make install

通过webbench --help可获得各选项:

  • -f|--force 不等待请求返回。
  • -r|--reload 发送重新载入请求: Pragma: no-cache
  • -t|--time 测试时间,单位;s, 默认 30。
  • -p|--proxy server:port 使用 proxy 发送请求。
  • -c|--clients N 一次发送的请求数, 默认 1。
  • -9|--http09 使用 HTTP/0.9 协议发送请求。
  • -1|--http10 使用 HTTP/1.0 协议发送请求。
  • -2|--http11 使用 HTTP/1.1 协议发送请求。
  • --get 使用 GET 方式发送请求。

使用

[root@localhost webbench-1.5]# webbench -c 500 -t 30 http://172.10.7.228/test/hs.php

测试结果:

Webbench - Simple Web Benchmark 1.5
Copyright (c) Radim Kolar 1997-2004, GPL Open Source Software.

Benchmarking: GET http://172.10.7.228/test/hs.php
500 clients, running 30 sec.

Speed=452878 pages/min, 174517 bytes/sec.
Requests: 10857 susceed, 215582 failed.

从请求结果中可看出,该服务器 500 个并发承受不住。

Also tagged

http_load

FROM: http_load的使用

http_load,以并行的形式向 WEB 服务器发起请求来测试网站的吞吐量。因为运行时只有一个进程,所以不会对客户端产生压力。而且通过配置后,它还可以对 HTTPS 进行测试.

安装

[root@localhost tmp]# wget http://www.acme.com/software/http_load/http_load-12mar2006.tar.gz
[root@localhost tmp]# tar xvzf http_load-12mar2006.tar.gz
[root@localhost tmp]# cd http_load-12mar2006
[root@localhost http_load-12mar2006]# make

使用

1 测试网站是否能承受住预期的访问压力

[root@localhost http_load-12mar2006]# ./http_load -parallel 500 -fetches 1000 urls

同时发起 500 个请求,随机访问 urls 中的网址列表,总共访问 1000 次。运行结果:

1000 fetches, 30 max parallel, 339000 bytes, in 2.16711 seconds
339 mean bytes/connection
461.443 fetches/sec, 156429 bytes/sec
msecs/connect: 2.50347 mean, 25.948 max, 0.089 min
msecs/first-response: 21.6581 mean, 25.948 max, 20.699 min
HTTP response codes:
  code 200 -- 1000

从上面的运行结果来看,目标网站能够承受每秒 461 次访问。

2 测试网站每秒所能承受的平均访问量

[root@localhost http_load-12mar2006]# ./http_load -rate 5 -seconds 100 urls

在 100 秒 内保持 一定的频率(5) 随机访问 urls 中的网址列表。

499 fetches, 1 max parallel, 169161 bytes, in 100 seconds
339 mean bytes/connection
4.99 fetches/sec, 1691.61 bytes/sec
msecs/connect: 0.118295 mean, 1.058 max, 0.077 min
msecs/first-response: 2.25691 mean, 4.619 max, 1.958 min
HTTP response codes:
  code 200 -- 499

urls 文件中为测试网站的地址列表,每行只能一个。

Also tagged