Archive

httperf 一个高性能的压力测试工具

ttperf 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 of httperf 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 to new workload generators and performance measurements.

Httperf 是一个高效的 http 压力测试工具,使用它可以模拟出超过1千的并发访问,能充分测试出 web server 的性能。而之前使用的 siege 测试工具则未能突破 500 个并发测试(如果您知道如何可以实现,请告诉我)

使用 httperf 应该能了解到自己编写 yo2cache 软件性能极限如何了 :)

以下是 gzip 格式访问的测试数据(因缓存文件以 gzip 格式保存,所以性能是最高的)

oneoo@oneoo-pc:~/Desktop$ httperf --server oneoo.com --num-conns 2000 --add-header "accept-encoding: gzip"
httperf --client=0/1 --server=oneoo.com --port=80 --uri=/ --send-buffer=4096 --recv-buffer=16384 --add-header='accept-encoding: gzip' --num-conns=2000 --num-calls=1
Maximum connect burst length: 1

Total: connections 2000 requests 2000 replies 2000 test-duration 1.304 s

Connection rate: 1533.7 conn/s (0.7 ms/conn, <=1 concurrent connections)
Connection time [ms]: min 0.6 avg 0.7 max 6.3 median 0.5 stddev 0.2
Connection time [ms]: connect 0.0
Connection length [replies/conn]: 1.000

Request rate: 1533.7 req/s (0.7 ms/req)
Request size [B]: 81.0

Reply rate [replies/s]: min 0.0 avg 0.0 max 0.0 stddev 0.0 (0 samples)
Reply time [ms]: response 0.6 transfer 0.0
Reply size [B]: header 302.0 content 10482.0 footer 0.0 (total 10784.0)
Reply status: 1xx=0 2xx=2000 3xx=0 4xx=0 5xx=0

CPU time [s]: user 0.29 system 1.01 (user 22.4% system 77.6% total 100.0%)
Net I/O: 16273.4 KB/s (133.3*10^6 bps)

Errors: total 0 client-timo 0 socket-timo 0 connrefused 0 connreset 0
Errors: fd-unavail 0 addrunavail 0 ftab-full 0 other 0

以下是 deflate (2级压缩率)格式访问的统计数据(需要从 gzip 解压,再压缩为 deflate 的数据处理)

oneoo@oneoo-pc:~/Desktop$ httperf --server oneoo.com --num-conns 2000 --add-header "accept-encoding: deflate"
httperf --client=0/1 --server=oneoo.com --port=80 --uri=/ --send-buffer=4096 --recv-buffer=16384 --add-header='accept-encoding: deflate' --num-conns=2000 --num-calls=1
Maximum connect burst length: 1

Total: connections 2000 requests 2000 replies 2000 test-duration 4.113 s

Connection rate: 486.2 conn/s (2.1 ms/conn, <=1 concurrent connections)
Connection time [ms]: min 2.0 avg 2.1 max 11.8 median 2.5 stddev 0.3
Connection time [ms]: connect 0.0
Connection length [replies/conn]: 1.000

Request rate: 486.2 req/s (2.1 ms/req)
Request size [B]: 84.0

Reply rate [replies/s]: min 0.0 avg 0.0 max 0.0 stddev 0.0 (0 samples)
Reply time [ms]: response 0.6 transfer 1.5
Reply size [B]: header 305.0 content 11014.0 footer 0.0 (total 11319.0)
Reply status: 1xx=0 2xx=2000 3xx=0 4xx=0 5xx=0

CPU time [s]: user 0.91 system 3.20 (user 22.2% system 77.8% total 100.0%)
Net I/O: 5414.3 KB/s (44.4*10^6 bps)

Errors: total 0 client-timo 0 socket-timo 0 connrefused 0 connreset 0
Errors: fd-unavail 0 addrunavail 0 ftab-full 0 other 0

以下是 deflate (4级压缩率)格式访问的统计数据

oneoo@oneoo-pc:~/Desktop$ httperf --server oneoo.com --num-conns 2000 --add-header "accept-encoding: deflate"
httperf --client=0/1 --server=oneoo.com --port=80 --uri=/ --send-buffer=4096 --recv-buffer=16384 --add-header='accept-encoding: deflate' --num-conns=2000 --num-calls=1
Maximum connect burst length: 1

Total: connections 2000 requests 2000 replies 2000 test-duration 5.329 s

Connection rate: 375.3 conn/s (2.7 ms/conn, <=1 concurrent connections)
Connection time [ms]: min 2.6 avg 2.7 max 32.8 median 2.5 stddev 0.7
Connection time [ms]: connect 0.0
Connection length [replies/conn]: 1.000

Request rate: 375.3 req/s (2.7 ms/req)
Request size [B]: 84.0

Reply rate [replies/s]: min 374.8 avg 374.8 max 374.8 stddev 0.0 (1 samples)
Reply time [ms]: response 0.6 transfer 2.0
Reply size [B]: header 305.0 content 10457.0 footer 0.0 (total 10762.0)
Reply status: 1xx=0 2xx=2000 3xx=0 4xx=0 5xx=0

CPU time [s]: user 1.29 system 4.01 (user 24.2% system 75.2% total 99.4%)
Net I/O: 3975.4 KB/s (32.6*10^6 bps)

Errors: total 0 client-timo 0 socket-timo 0 connrefused 0 connreset 0
Errors: fd-unavail 0 addrunavail 0 ftab-full 0 other 0

以下是文本格式访问的统计数据

oneoo@oneoo-pc:~/Desktop$ httperf --server oneoo.com --num-conns 2000 --add-header "accept-encoding: normal"
httperf --client=0/1 --server=oneoo.com --port=80 --uri=/ --send-buffer=4096 --recv-buffer=16384 --add-header='accept-encoding: normal' --num-conns=2000 --num-calls=1
Maximum connect burst length: 1

Total: connections 2000 requests 2000 replies 2000 test-duration 2.349 s

Connection rate: 851.3 conn/s (1.2 ms/conn, <=1 concurrent connections)
Connection time [ms]: min 1.1 avg 1.2 max 5.8 median 1.5 stddev 0.2
Connection time [ms]: connect 0.0
Connection length [replies/conn]: 1.000

Request rate: 851.3 req/s (1.2 ms/req)
Request size [B]: 83.0

Reply rate [replies/s]: min 0.0 avg 0.0 max 0.0 stddev 0.0 (0 samples)
Reply time [ms]: response 0.6 transfer 0.6
Reply size [B]: header 278.0 content 42562.0 footer 0.0 (total 42840.0)
Reply status: 1xx=0 2xx=2000 3xx=0 4xx=0 5xx=0

CPU time [s]: user 0.62 system 1.73 (user 26.2% system 73.7% total 99.9%)
Net I/O: 35683.0 KB/s (292.3*10^6 bps)

Errors: total 0 client-timo 0 socket-timo 0 connrefused 0 connreset 0
Errors: fd-unavail 0 addrunavail 0 ftab-full 0 other 0

从以上数据可以看到 yo2cache 性能挺好的,最高能达到每秒 1500 个并发处理。性能瓶颈是出现在缓存数据的解压与压缩处理上,如果缓存空间足够大的话,可以考虑保存多种格式的缓存数据,就能解决这个瓶颈问题。

而在 deflate 数据压缩方面,因为2级压缩率与4级压缩率所产生的数据量差距不大,但并发性能有一定差距,可以考虑使用 2 级压缩率。

关于3月的相片销售业绩总结

家还记得3月的时候我曾经发表过文章,要在网络销售自己的生活照;)

现在两个月过去了,共有3个网友购买了我的照片,收入是3块钱人民币 _-!! 因为我不是什么名人,并且是个大男人。照片的吸引力确实不怎么样,能卖出去已经算是成功了。如果你是 mm ,估计你的销售业绩肯定比我好多了。这个收入跟放个广告差距不大 _-!!

还是原始的欲望所带来的商机大啊,好比做(合法)网站的,就算网站怎么个出色,也很难在一年内实现盈利,但人家做色·情·站的不用一个月就能开宝马了。呵呵,对比就是这么大。

注意:照片销售正式停止 ;)

Yes! 是 Yo2messenger

早以前,一个老伯伯就发过一个 Yo2messenger 的截图,但此老伯伯当时只做了个非常简陋的登录界面,就没有回事。并未继续开发下去。

现在这个老伯伯终于下定决心要把它给“生”下来的 :) 并且制作了更好的界面,剩下的工作就是加入实际功能。

程序是基于网页 AJAX 的形式进行开发,当然对于 Windows 平台就提供一个简单的框架,更方便使用。而 Linux 等其他使用 FireFox 浏览器的用户则可以在浏览器的侧栏加载此程序 :) 界面已定型,现在给大家放个图

sc.gif

你的理想是什么?

想-是人生的奋斗目标,是人们对未来的一种有可能实现的想象。理想是一种对未来的想象,但是,并不是任何想象都是理想。

如果没有理想,你只能平庸的度过了自己短暂的一生。当然各个人的理想都不同,比如有的女人理想就是嫁一好老公,能过上安稳的日子,而有的则是希望嫁个有权势的老公,享尽荣华富贵。更有的理想是成为独立的女强人 :) 不知道你的理想是什么?

不同的理想所造就出来的人生差距是非常大的。拥有好老公的不可能成为人群中的亮点,而拥有权势的也不可能进出菜市场一样。 可以说理想决定了你的一生,你怎样选择就得好好想想咯。

不同的生活环境造就不同的理想。生活在贫困当中的人,估计他所想到的理想也就只会局限在物质方面了,连自己的生活都未过得安稳,他如何去想更大的理想,并能够实现自己的理想呢?出身于富裕家庭的人,他的理想会只需要过上安稳的生活吗?他已经拥有安稳生活了啊!

安稳的生活成为理想定位的最大敌人!如果你生活在一个安稳的环境下, 那么你的理想很可能被现在已拥有的生活而局限起来。你会觉得自己已经拥有一些其他人都没有物质,也就没有了强大的动力推使你去实现更大的理想,可能你已经觉得反正自己已经比人家优秀,没必要花费更大的力气了。安稳的生活也会使人生过得平庸!

我的理想是 Yo2 能够建立起一个品牌,成为互联网上一颗闪亮的星星 :)

我为实现自己的理想,放弃了一直以来的安稳生活,全心全意的付出着,等待着···

完美实现垂直水平居中的 DIV

个问题,估计很多网页设计员都会遇到过,如何在页面中建立出一个垂直水平居中的 DIV 呢?

我在 google 搜索了一下关键字div 垂直居中” ,约有71,900项符合的查询。但并未能找到一个正确的,符合 XHTML和CSS规范的办法。自己就琢磨了一下,其实也不难,虽然DIV不支持未明确高度的垂直居中,但这个是可以变通的。

我们知道 div 的 position 属性是支持百分比数值来进行定位的,有了这个定位能力,我们就可以把 div 的显示坐标定位在网页的绝对中心了,再通过 margin 属性把 div 设置为我们需要的宽度和高度就可以。当然我们的 margin-top 和 margin-left 属性需要使用到负数,把DIV的定位从中心分别向上和向左移动到合适的地方。下面这个例子可以在页面上建立一个垂直水平居中的 DIV:

使用此方法,既不需要书写不标准的 css 代码,使用各浏览器的Hack,更不需要使用 JavaScript 来实现。