前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >测试PyPy运行Django项目对比Python

测试PyPy运行Django项目对比Python

作者头像
the5fire
发布2019-02-28 17:12:14
2K0
发布2019-02-28 17:12:14
举报

继续昨天的文章,终于用pypy跑起了Django和MySQL,今天就把blog用pypy在本地跑一下试试。然后顺便用ab测一下,看看效果。

先介绍下我的环境:

  • ubuntu13.04 64位
  • i5-2410的cpu
  • 4G DDR3内存

软件环境就是,用gunicorn通过wsgi的方式启动Django1.5.1.

只是测试了并发100, 10000次访问的情况。得到的结果是:由pypy运行的gunicorn 平均每秒处理13.32个请求;通过python2.7.3执行的gunicorn,平均每秒处理11.09 个请求。

这个差别并不大,不过关于内存占用的差别倒是挺出乎意料的,基于pypy运行的gunicorn占了300M多的内存,而后者,我之前也说过,30M左右。这个差异还是挺大的。

有兴趣的可以自己在本地跑一个Django项目,然后测试对比一下。

最后是完整的记录:

  • 先是Python2.7.3:
代码语言:javascript
复制
Server Software:        gunicorn/0.17.4
Server Hostname:        127.0.0.1
Server Port:            8888

Document Path:          /
Document Length:        36482 bytes

Concurrency Level:      100
Time taken for tests:   901.496 seconds
Complete requests:      10000
Failed requests:        0
Write errors:           0
Total transferred:      366790000 bytes
HTML transferred:       364820000 bytes
Requests per second:    11.09 [#/sec] (mean)
Time per request:       9014.955 [ms] (mean)
Time per request:       90.150 [ms] (mean, across all concurrent requests)
Transfer rate:          397.33 [Kbytes/sec] received

Connection Times (ms)
min  mean[+/-sd] median   max
Connect:        0    0   0.7      0      10
Processing:   686 8981 2641.9   7934   19722
Waiting:      686 8980 2641.8   7933   19721
Total:        696 8981 2641.8   7935   19722

Percentage of the requests served within a certain time (ms)
50%   7935
66%   9416
75%  10341
80%  10836
90%  12515
95%  14492
98%  17245
99%  18081
100%  19722 (longest request)
  • 然后是Pypy2.0.2:
代码语言:javascript
复制
Server Software:        gunicorn/0.17.4
Server Hostname:        127.0.0.1
Server Port:            8000

Document Path:          /
Document Length:        36482 bytes

Concurrency Level:      100
Time taken for tests:   750.585 seconds
Complete requests:      10000
Failed requests:        0
Write errors:           0
Total transferred:      366790000 bytes
HTML transferred:       364820000 bytes
Requests per second:    13.32 [#/sec] (mean)
Time per request:       7505.848 [ms] (mean)
Time per request:       75.058 [ms] (mean, across all concurrent requests)
Transfer rate:          477.22 [Kbytes/sec] received

Connection Times (ms)
min  mean[+/-sd] median   max
Connect:        0    0   0.7      0      10
Processing:   444 7466 2179.8   6554   17179
Waiting:      443 7466 2179.8   6554   17178
Total:        454 7466 2179.7   6554   17179

Percentage of the requests served within a certain time (ms)
50%   6554
66%   7239
75%   8438
80%   9181
90%  10498
95%  12012
98%  14026
99%  15469
100%  17179 (longest request)

update: pypy的成员alex写了片关于pypy测试的文章,有兴趣的可以了解下,英文的: http://alexgaynor.net/2013/jul/15/your-tests-are-not-benchmark/

本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2013-05-30 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
相关产品与服务
云数据库 MySQL
腾讯云数据库 MySQL(TencentDB for MySQL)为用户提供安全可靠,性能卓越、易于维护的企业级云数据库服务。其具备6大企业级特性,包括企业级定制内核、企业级高可用、企业级高可靠、企业级安全、企业级扩展以及企业级智能运维。通过使用腾讯云数据库 MySQL,可实现分钟级别的数据库部署、弹性扩展以及全自动化的运维管理,不仅经济实惠,而且稳定可靠,易于运维。
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档