星期二, 十月 10, 2006

mod_lua性能提升,是mod_python速度115%

在上次的性能对比之后,忍不住对mod_lua的程序作了改进,下面是最新的测试结果

mod_python
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) 2006 The Apache Software Foundation, http://www.apache.org/

Benchmarking localhost (be patient)


Server Software: Apache/2.0.59
Server Hostname: localhost
Server Port: 80

Document Path: /tmp/hello.py
Document Length: 12 bytes

Concurrency Level: 1
Time taken for tests: 1.78125 seconds
Complete requests: 500
Failed requests: 0
Write errors: 0
Total transferred: 102500 bytes
HTML transferred: 6000 bytes
Requests per second: 463.77 [#/sec] (mean)
Time per request: 2.156 [ms] (mean)
Time per request: 2.156 [ms] (mean, across all concurrent requests)
Transfer rate: 92.75 [Kbytes/sec] received

Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 2.3 0 15
Processing: 0 1 4.7 0 15
Waiting: 0 1 4.5 0 15
Total: 0 1 5.1 0 15

Percentage of the requests served within a certain time (ms)
50% 0
66% 0
75% 0
80% 0
90% 15
95% 15
98% 15
99% 15
100% 15 (longest request)
mod_lua
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) 2006 The Apache Software Foundation, http://www.apache.org/

Benchmarking localhost (be patient)


Server Software: Apache/2.0.59
Server Hostname: localhost
Server Port: 80

Document Path: /tmp/hello.lua
Document Length: 12 bytes

Concurrency Level: 1
Time taken for tests: 0.937500 seconds
Complete requests: 500
Failed requests: 0
Write errors: 0
Total transferred: 102000 bytes
HTML transferred: 6000 bytes
Requests per second: 533.33 [#/sec] (mean)
Time per request: 1.875 [ms] (mean)
Time per request: 1.875 [ms] (mean, across all concurrent requests)
Transfer rate: 105.60 [Kbytes/sec] received

Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 2.2 0 15
Processing: 0 1 4.2 0 15
Waiting: 0 1 4.1 0 15
Total: 0 1 4.7 0 15

Percentage of the requests served within a certain time (ms)
50% 0
66% 0
75% 0
80% 0
90% 15
95% 15
98% 15
99% 15
100% 15 (longest request)
这次修改可谓全胜
速度比如下每秒处理的请求 463.77/533.33(mod_python/mod_lua)
每个请求处理花费的时间微妙: 2.156/1.875(mod_python/mod_lua)

性能提升的原因说明:

1 mod_lua从串行处理方式改成并行处理方式
2 lua虚拟机采用了空闲池处理

没有评论: