PHP配置文件之间的性能差异 [英] Difference in performance among config files for PHP

查看:100
本文介绍了PHP配置文件之间的性能差异的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在建立一个站点,该站点的配置数据由 php文件保存,变量不超过15行。

I'm building a site whose configuration data is held by a php file, with no more than 15 lines of variables.

到目前为止,一切工作都很好,但是现在我面临着定义更多变量的需求,并且进行了一些研究,发现有关PHP中应用程序配置的文章,其结论指出, php文件是分析它们的方式时最重要的选择规模(数据库是更好的选择)。

Everything has worked well so far, but now I'm facing the need of defining more variables, and researching a little I found an article about Application Configuration in PHP, whose conclusions state that php files are the wost option when analyzing how they scale (Databases being the better choice).

在决定配置文件的格式时,最推荐的选择是什么

What is the most recommended choice when deciding which format of configuration file to use?

推荐答案

对不起,什么?!


php文件在分析它们的扩展方式时是最有用的选择(数据库是更好的选择)。

php files are the wost option when analyzing how they scale (Databases being the better choice).

这只是很奇怪,因为您可以很好地扩展php-只需设置另一个服务器即可

This is just weird, because you can scale php very well - just set up another server and that's it, you've scaled your php twice.

还要记住,有一些操作码优化器会将解析后的文件内容保存在内存中。

Also keep in mind that there are opcode optimizers that will keep the parsed file contents in the memory.

缩放数据库一门火箭科学。扩展数据库是一个棘手的过程,涉及到良好的数据库内部知识和您的OS知识。

Whereas scaling databases is a rocket science. Scaling databases is a tricky process, that involves good database internals and your OS knowledge.

因此,我不会再引用该文章。

So I wouldn't refer to that article ever.

PS:看了这篇文章:

PS: looked at the article:


运行脚本时,结果在其中。平均0.052640个标记,这是迄今为止最慢的方法。

When the script is run, the results are in. Averaging around 0.052640 mark, making this by far the slowest method so far.

我不知道实例化变量比从数据库中读取变量还要慢(包括连接开销,读取表开销,传输数据开销以及最后的相同实例化变量处理)。根据定义, X 不能超过 X + Y

I cannot realize how just instantiating variables can be slower than reading from database (which includes connection overhead, reading from tables overhead, transmitting the data overhead and the same instantiating variables process in the end). X just cannot be more than X + Y by definition.

这篇关于PHP配置文件之间的性能差异的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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