星期二, 1月 30, 2007

Another Django Benchmark.

又一個新的web framework benchmark,
作的看起來似乎是目前所有benchmark評比裏面最完整的.
程式碼跟設定都有秀出來.
http://www.alrond.com/en/2007/jan/25/performance-test-of-6-leading-frameworks/

總而言之這次比了RubyOnRails,PHP的 CodeIgniter,Symfony,
Perl的Catalyst ,跟Python的 Django TurboGears

做出來的結果是:
django > turbogears=RoR1.1.6 > Catalyst > CodeIgniter > RoR 1.2.1 > Symfony (後面作者有補充, CodeIgniter加上eAccelerator似乎快了不少, 所以排名可能僅次於django, 只差一倍的效能.)

所以... 這次Django又在benchmark上贏了... :)

贏了其實也不是重點 重點是文章裏面有提到一些django的設定問題:
"""
The Prefork-mode takes away more memory,
but for it the system comes out, which stably works on extreme loads,
and the smaller use of the processor resources.
In a threaded-mode Django hanged under the big load and did not answer on inquiries.
The same happened with TurboGears too.
This is due to the fact that python works badly in a treaded-mode.
"""

這樣看來還是得把fastcgi啟動時的method改成非預設的prefork mode才可以.
(預設threaded大概是為了方便windows用戶吧?)

"""
Psyco module accelerates Django on 15-30 %,
but it will be worth the grown memory use VSZ on 80 % in a prefork-mode
and on 400 % (!!!) in threaded-mode. Use of RSS memory increases in 2-2.5 times.
"""
而且Psyco搭配django吃的memory在threaded-mode似乎也暴增?

再來還有更勁爆的... Psyco+ 64bit machine會運作的不大好!?

"""
About Psyco. Django-developers have tested it,
and have found something interesting.
On 32-bit systems it really gives an increase in productivity.
And on 64 bit - on the contrary productivity sinks.
It happens, because the processor switches under Psyco to a 32-bit mode
and does not use all advantages of one's own architecture.
If it is so, than this fact, that Django worked more quickly under Psyco,
very likely means,
that Linux and Python don't use 64 bits system (in spite of work on Overtone).
"""

總結這篇文章提到有關django的設定:
1. 在unix上使用fastcgi 時不要用預設的threaded mode, 要以prefork模式啟動.
2. 32位元機器而且有足夠的ram並且需要速度時可以使用psyco來換取速度.
3. 64位元機器或ram不大夠時(聽說ram永遠都不夠) 要斟酌使用psyco.


沒有留言: