通过内存评估或使用常规文件提高速度

发布于 2024-07-22 15:05:21 字数 220 浏览 1 评论 0原文

我正在努力提高服务器的速度,但在修改所有内容之前我想听听您的看法。

我的文件系统读取率很高。 现在我们使用的是常规 PHP 文件。 我想知道是否可以将这些文件缓存在 Memcache 中,然后对代码进行评估,是否比让这些文件被解释更快。

那么是使用 memcache + eval 还是常规 php 解释更好呢? 我认为一种解决方案可以是 tempfs,但我还没有使用它。

I'm trying to improve the speed of our server but I would like to have your view of that before modifying everything.

I have a high read rate on my file system. Right now we are using regular PHP file. I wonder if I can cache these file in Memcache and later do an eval on the code if it will be faster than letting these file get interpreted.

So is it better to have memcache + eval or regular php interpretation.
I think one solution can be tempfs but I haven't use it yet.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

野味少女 2024-07-29 15:05:21

我相信 APC 是您正在寻找的解决方案,因为它为您提供字节码缓存。

I believe APC is the solution you are looking for as it does bytecode caching for you.

歌枕肩 2024-07-29 15:05:21

这取决于......只需创建一个类似于您的真实环境的模型并对其进行测量即可。 使用 evals 您可能会减少 fs 读取,但会增加交换,这样您就不会获得任何优势。

为了减少 FSreading,请尝试将大量包含内容合并到 1 个 lib 文件中。 您可以编写一个脚本来仅在存储库导出时合并这些组以进行生产(因为很难支持大文件)。 即 my.lib.inc 包含您开发软件时的所有包含内容,并且在导出时它会被所有文件中的合并内容替换,而不是包含它们。

你可以使用某物。 像 APC、nginx 等来缓存脚本和静态内容。 这些改进一起应该会有所帮助。

It depends... just create a model similar to your real environment and measure it. Using evals you may decrease fs-reading but increase swapping instead so you'll get no advantage.

To decrease FSreading try to merge tons of includes into 1 lib-file. You may write a script to merge these groups for production only on repository export (because it's hard to support the huge file). I.e my.lib.inc contains all includes when you develop software, and on export it's being replaced with merged content from all files instead of including them.

You can use smth. like APC, nginx etc to cache scripts and static content. Together these improvements should help.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文