基准测试PHP与Pylons [英] benchmarking PHP vs Pylons

查看:84
本文介绍了基准测试PHP与Pylons的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想对PHP与Pylons进行基准测试.我希望两者之间的比较尽可能一致,所以这是我想出的:

I want to benchmark PHP vs Pylons. I want my comparison of both to be as even as possible, so here is what I came up with:

  • 带有APC的PHP 5.1.6,使用连接到MySQL数据库的smarty模板
  • Python 2.6.1,结合使用Pylons和连接相同MySQL数据库的mako模板

在该设置中是否应该更改任何内容,以使其更公平地进行比较?

Is there anything that I should change in that setup to make it a more fair comparison?

我要在几乎没有任何活动的备用服务器上运行它,该服务器具有2G的ram和4个内核.

I'm going to run it on a spare server that has almost no activity, 2G of ram and 4 cores.

关于我应该或不应该对其进行基准测试的任何建议?我计划使用Ab进行实际的基准测试.

Any suggestions of how I should or shouldn't benchmark them? I plan on using ab to do the actual benchmarking.

推荐答案

如果您不在PHP中使用ORM,则也不应使用SQLAlchemy ORM或SQL-Expression语言,而应使用原始SQL命令.如果您使用的是APC,则应确保Python对您的应用程序所在的文件夹具有写权限,或者.py文件是预编译的.

If you're not using an ORM in PHP you should not use the SQLAlchemy ORM or SQL-Expression language either but use raw SQL commands. If you're using APC you should make sure that Python has write privileges to the folder your application is in, or that the .py files are precompiled.

此外,如果您使用的是Smarty缓存,则出于公平起见,请考虑同时启用Mako缓存.

Also if you're using the smarty cache consider enabling the Mako cache as well for fairness sake.

但是有一个陷阱:Python MySQL适配器是非常糟糕的.对于数据库连接,您可能会注意到性能降低(如果SQLAlchemy自行执行unicode解码)或泄漏内存(如果MySQL适配器执行此操作).

However there is a catch: the Python MySQL adapter is incredible bad. For the database connections you will probably notice either slow performance (if SQLAlchemy performs the unicode decoding for itself) or it leaks memory (if the MySQL adapter does that).

这两个PHP都没有的问题,因为不支持unicode.因此,为了完全公平起见,您必须在数据库连接中禁用unicode(但这是一个不可思议的坏主意).

Both issues you don't have with PHP because there is no unicode support. So for total fairness you would have to disable unicode in the database connection (which however is an incredible bad idea).

所以:似乎没有一种比较PHP和Pylons的公平方法:)

So: there doesn't seem to be a fair way to compare PHP and Pylons :)

这篇关于基准测试PHP与Pylons的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆