dreamhost上运行python(web.py)

费了2个晚上的时间,终于搞定了,看看效果

http://dh-py.yanghao.org/

分别用cgi和fastcgi测试了一下,看结果:

cgi:

[plain]/usr/sbin/ab -c 4 -n 300 http://dh-py.yanghao.org/
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking dh-py.yanghao.org (be patient)
Completed 100 requests
Completed 200 requests
Completed 300 requests
Finished 300 requests

Server Software: Apache
Server Hostname: dh-py.yanghao.org
Server Port: 80

Document Path: /
Document Length: 569 bytes

Concurrency Level: 4
Time taken for tests: 19.771 seconds
Complete requests: 300
Failed requests: 0
Write errors: 0
Total transferred: 216900 bytes
HTML transferred: 170700 bytes
Requests per second: 15.17 [#/sec] (mean)
Time per request: 263.608 [ms] (mean)
Time per request: 65.902 [ms] (mean, across all concurrent requests)
Transfer rate: 10.71 [Kbytes/sec] received

Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.1 0 1
Processing: 152 262 81.4 239 518
Waiting: 137 239 76.4 218 483
Total: 152 262 81.4 239 518

Percentage of the requests served within a certain time (ms)
50% 239
66% 292
75% 317
80% 334
90% 374
95% 420
98% 459
99% 494
100% 518 (longest request)
[/plain]

fastcgi:

[plain]
/usr/sbin/ab -c 4 -n 300 http://dh-py.yanghao.org/
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking dh-py.yanghao.org (be patient)
Completed 100 requests
Completed 200 requests
Completed 300 requests
Finished 300 requests

Server Software: Apache
Server Hostname: dh-py.yanghao.org
Server Port: 80

Document Path: /
Document Length: 569 bytes

Concurrency Level: 4
Time taken for tests: 2.544 seconds
Complete requests: 300
Failed requests: 0
Write errors: 0
Total transferred: 216900 bytes
HTML transferred: 170700 bytes
Requests per second: 117.90 [#/sec] (mean)
Time per request: 33.926 [ms] (mean)
Time per request: 8.481 [ms] (mean, across all concurrent requests)
Transfer rate: 83.25 [Kbytes/sec] received

Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.0 0 0
Processing: 14 34 113.4 19 1159
Waiting: 14 34 113.4 19 1159
Total: 14 34 113.4 19 1160

Percentage of the requests served within a certain time (ms)
50% 19
66% 23
75% 25
80% 28
90% 36
95% 44
98% 56
99% 1155
100% 1160 (longest request)
[/plain]

fastcgi果真不是吹的,上面测试是直接在dreamhost上测的,执行cgi测试时load高达15左右,不知道dreamhost会不会有意见!!!还是不要测的好~

This entry was posted in Python. Bookmark the permalink.

2 Responses to dreamhost上运行python(web.py)

  1. huji says:

    你好,我在自己dreamhost的主机上搞了两天了,还是配置不了webpy,能不能请问下你是怎么配置好的。我先按照dreamhost官网的方法配置了,不行,因为它给的那个fcgi的下载地址不能用了,然后我看了webpy官网的webpy+apache的配置过程,但是那个需要修改httpd的配置文件,貌似权限有限,dreamhost不让这么干,然后我就在网上别处下载了一个fcgi.py,貌似实现是不一样的,脚本运行不了。请指点一下。

    • yh says:

      这个好久了,我都忘记怎么配的了,现在我也没dreamhost的空间了,不过我查了一下代码库,找到个yanghao.fcgi的文件,应该是apache用的,代码如何,你看看


      #!/home/yanghao/python/bin/python

      import app
      import web

      web.config.debug = False
      web.wsgi.runwsgi = lambda func, addr=None: web.wsgi.runfcgi(func, addr)
      if __name__ == "__main__":
      app.app.run()

发表评论

电子邮件地址不会被公开。 必填项已用 * 标注

*

您可以使用这些 HTML 标签和属性: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>