Eurasia 3.0.0 Preview

21 views
Skip to first unread message

沈崴

unread,
Nov 18, 2007, 11:53:26 AM11/18/07
to eurasia-users
Eurasia 3.0.0 Preview, 可以从:
http://eurasia.googlecode.com/files/Eurasia-3.0.0-preview.tar.gz
载。

本次发布仍然使用 Python 标准库 asyncore.py 的算法, 优化阶段还未开始, 性能尚待提高。
这里提供部分简单功能的预览, 及简单的基准测试 (Apache ab)。欢迎讨论。

代码一, "hello world!"
-------------------------------------------------------
代码:

#!/usr/bin/env python2.5
#import psyco; psyco.full()

from web import Response, config, poll

def controller(req):
resp = Response(req)
resp['Content-Type'] = 'text/plain'
print >> resp, 'hello world!'
resp.close()

config(controller=controller, port=8080)
while True:
poll()

-------------------------------------------------------
基准测试 1:

$ ab -c 1021 -n 10000 'http://localhost:8080/'
This is ApacheBench, Version 2.0.40-dev <$Revision: 1.146 $>
apache-2.0
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Copyright 2006 The Apache Software Foundation, http://www.apache.org/

Benchmarking localhost (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:
Server Hostname: localhost
Server Port: 8080

Document Path: /
Document Length: 13 bytes

Concurrency Level: 1021
Time taken for tests: 2.84486 seconds
Complete requests: 10000
Failed requests: 0
Write errors: 0
Total transferred: 1770885 bytes
HTML transferred: 130065 bytes
Requests per second: 4797.35 [#/sec] (mean)
Time per request: 212.826 [ms] (mean)
Time per request: 0.208 [ms] (mean, across all concurrent
requests)
Transfer rate: 829.46 [Kbytes/sec] received

Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 1 3.5 1 24
Processing: 9 26 3.4 26 230
Waiting: 7 25 3.4 25 228
Total: 25 27 4.7 27 231

Percentage of the requests served within a certain time (ms)
50% 27
66% 27
75% 27
80% 27
90% 28
95% 28
98% 45
99% 50
100% 231 (longest request)

-------------------------------------------------------
基准测试 2, 使用 psyco.full() 优化:

$ ab -c 1021 -n 10000 'http://localhost:8080/'
This is ApacheBench, Version 2.0.40-dev <$Revision: 1.146 $>
apache-2.0
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Copyright 2006 The Apache Software Foundation, http://www.apache.org/

Benchmarking localhost (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:
Server Hostname: localhost
Server Port: 8080

Document Path: /
Document Length: 13 bytes

Concurrency Level: 1021
Time taken for tests: 1.519026 seconds
Complete requests: 10000
Failed requests: 0
Write errors: 0
Total transferred: 1770708 bytes
HTML transferred: 130052 bytes
Requests per second: 6583.17 [#/sec] (mean)
Time per request: 155.093 [ms] (mean)
Time per request: 0.152 [ms] (mean, across all concurrent
requests)
Transfer rate: 1138.23 [Kbytes/sec] received

Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 1 4.0 1 25
Processing: 10 18 3.6 19 239
Waiting: 9 17 3.5 17 237
Total: 18 20 5.6 20 241

Percentage of the requests served within a certain time (ms)
50% 20
66% 20
75% 20
80% 20
90% 21
95% 21
98% 46
99% 47
100% 241 (longest request)



代码 2: Eurasia3 自带 Demo
-------------------------------------------------------
启动 demo:
$ ./demo start

功能:
使用了逻辑调度器, 每 0.1 秒对协程进行一次调度。
使用了 session, 在测试中为每个请求建立一份 session (共计 10000 份)。

-------------------------------------------------------
基准测试:

$ ab -c 1021 -n 10000 'http://localhost:8080/'
This is ApacheBench, Version 2.0.40-dev <$Revision: 1.146 $>
apache-2.0
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Copyright 2006 The Apache Software Foundation, http://www.apache.org/

Benchmarking localhost (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:
Server Hostname: localhost
Server Port: 8080

Document Path: /
Document Length: 8 bytes

Concurrency Level: 1021
Time taken for tests: 8.923888 seconds
Complete requests: 10000
Failed requests: 0
Write errors: 0
Total transferred: 2521500 bytes
HTML transferred: 80688 bytes
Requests per second: 1120.59 [#/sec] (mean)
Time per request: 911.129 [ms] (mean)
Time per request: 0.892 [ms] (mean, across all concurrent
requests)
Transfer rate: 275.89 [Kbytes/sec] received

Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 252 823.2 5 3011
Processing: 130 186 89.0 170 921
Waiting: 129 182 89.1 165 915
Total: 143 438 877.6 176 3929

Percentage of the requests served within a certain time (ms)
50% 176
66% 180
75% 185
80% 191
90% 221
95% 3223
98% 3419
99% 3916
100% 3929 (longest request)

---
沈崴 (热爱生活, 远离 Django)
http://blog.163.com/eishn

沈崴

unread,
Nov 18, 2007, 1:07:30 PM11/18/07
to eurasia-users
补遗, 机器配置:

$ cat /proc/version
Linux version 2.6.20-16-generic (root@terranova) (gcc version 4.1.2
(Ubuntu 4.1.2-0ubuntu4)) #2 SMP Sun Sep 23 19:50:39 UTC 2007

$ cat /proc/cpuinfo
processor : 0
vendor_id : AuthenticAMD
cpu family : 15
model : 75
model name : AMD Athlon(tm) 64 X2 Dual Core Processor 3600+
stepping : 2
cpu MHz : 2009.283
cache size : 256 KB
physical id : 0
siblings : 2
core id : 0
cpu cores : 2
fdiv_bug : no
hlt_bug : no
f00f_bug : no
coma_bug : no
fpu : yes
fpu_exception : yes
cpuid level : 1
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge
mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext
fxsr_opt lm 3dnowext 3dnow pni cx16 lahf_lm cmp_legacy svm cr8legacy
ts fid vid ttp tm stc
bogomips : 4021.64
clflush size : 64

processor : 1
vendor_id : AuthenticAMD
cpu family : 15
model : 75
model name : AMD Athlon(tm) 64 X2 Dual Core Processor 3600+
stepping : 2
cpu MHz : 2009.283
cache size : 256 KB
physical id : 0
siblings : 2
core id : 1
cpu cores : 2
fdiv_bug : no
hlt_bug : no
f00f_bug : no
coma_bug : no
fpu : yes
fpu_exception : yes
cpuid level : 1
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge
mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext
fxsr_opt lm 3dnowext 3dnow pni cx16 lahf_lm cmp_legacy svm cr8legacy
ts fid vid ttp tm stc
bogomips : 4018.57
clflush size : 64

$ cat /proc/meminfo
MemTotal: 2075004 kB
MemFree: 1841156 kB
Buffers: 10448 kB
Cached: 173656 kB
SwapCached: 0 kB
Active: 95236 kB
Inactive: 107744 kB
HighTotal: 1178496 kB
HighFree: 973204 kB
LowTotal: 896508 kB
LowFree: 867952 kB
SwapTotal: 6080560 kB
SwapFree: 6080560 kB
Dirty: 4 kB
Writeback: 0 kB
AnonPages: 18968 kB
Mapped: 8952 kB
Slab: 14340 kB
SReclaimable: 6168 kB
SUnreclaim: 8172 kB
PageTables: 844 kB
NFS_Unstable: 0 kB
Bounce: 0 kB
CommitLimit: 7118060 kB
Committed_AS: 513260 kB
VmallocTotal: 114680 kB
VmallocUsed: 11708 kB
VmallocChunk: 67544 kB

On Nov 19, 12:53 am, "沈崴" <wilei...@gmail.com> wrote:
> Eurasia 3.0.0 Preview, 可以从:
> http://eurasia.googlecode.com/files/Eurasia-3.0.0-preview.tar.gz
> 载。
>
> 本次发布仍然使用 Python 标准库 asyncore.py 的算法, 优化阶段还未开始, 性能尚待提高。
> 这里提供部分简单功能的预览, 及简单的基准测试 (Apache ab)。欢迎讨论。
>
> ---
> 沈崴 (热爱生活, 远离 Django)http://blog.163.com/eishn

jaxiinofea

unread,
Nov 18, 2007, 11:57:55 PM11/18/07
to eurasia-users
现在还没达到使君的性能承诺哟......"每秒種處理上萬次 CGI 請求"......哈哈

On Nov 19, 12:53 am, "沈崴" <wilei...@gmail.com> wrote:
> 本次发布仍然使用 Python 标准库 asyncore.py 的算法, 优化阶段还未开始, 性能尚待提高。
> Requests per second: 4797.35 [#/sec] (mean)
> Requests per second: 6583.17 [#/sec] (mean)

沈崴

unread,
Nov 19, 2007, 12:06:49 AM11/19/07
to eurasia-users
到正式发布的时候应该可以到 10000+ 吧。目前有些关键算法仍然是临时算法, 提升的空间还是相当大的 :)

BTW: 起两个 Eurasia3 服务器就可以了 :D
Reply all
Reply to author
Forward
0 new messages