什么是提高zend框架性能的最佳方法?

时间:2022-02-12 03:59:07

zend framework has many components/services I don't need, it has many includes. All this I think slow down application. Do you know how to speed up it? may be remove not used(what is common) components, or combine files to one file?

zend框架有许多我不需要的组件/服务,它有很多包含。所有这些我认为减慢了应用程序。你知道如何加快它吗?可能是删除未使用(什么是常见的)组件,或将文件合并到一个文件?

6 个解决方案

#1


  1. APC or eAccelerator (APC will be included by default in future releases, so I'd recommend using it, even though raw speed is slightly below of eAccelerator)

    APC或eAccelerator(APC将在未来的版本中默认包含在内,所以我建议使用它,即使原始速度略低于eAccelerator)

  2. Two level cache for configuration, full-page, partial views, queries, model objects:

    用于配置,整页,部分视图,查询,模型对象的两级缓存:

    • 1st level cache (in memory KV-store, APC store or memcached)
    • 第一级缓存(在内存KV存储,APC存储或memcached中)

    • 2nd level cache (persistent KV-store in files, SQLite or dedicated KV-store)
    • 二级缓存(文件中持久的KV存储,SQLite或专用KV存储)

  3. RDBMS connection pooling, if avaliable.

    RDBMS连接池,如果可用的话。

#2


Before you start worrying about actively modifying things for more performance, you'll want to check the Performance Guide from the manual. One of the simplest steps you can do is to enable an opcode cache (such as APC) on your server - an Opcode cache alone can give you a 3-4x boost.

在您开始担心主动修改内容以获得更高性能之前,您需要查看手册中的“性能指南”。您可以做的最简单的步骤之一是在服务器上启用操作码缓存(例如APC) - 仅Opcode缓存就可以为您提供3-4倍的提升。

#3


I agree with Topbit, that you should start with code profiling. Find what is the problem.

我同意Topbit,你应该从代码分析开始。找出问题所在。

I don't think that the problem is just because of ZF has so many files. It uses autoloading, so only files required at the moment are loaded. You definitely shouldn't split different files contents.

我不认为问题只是因为ZF有这么多文件。它使用自动加载,因此只加载当前所需的文件。你绝对不应该拆分不同的文件内容。

For many perfomance problems, caching is your friend.

对于许多性能问题,缓存是你的朋友。

#4


Code on disk that isn't being called, doesn't take any time. The only way to see what is slow is to measure it. That said, if you aren't running an opcode-cache such as APC, then you are wasting time.

磁盘上未被调用的代码不需要任何时间。看到什么是缓慢的唯一方法是测量它。也就是说,如果你没有运行像APC这样的操作码缓存,那么你就是在浪费时间。

#5


you can get a bit of extra speed by optimizing the requirements statements as stated in the optimizing help topic ... first remove all the requirements and i also recommend using pear naming and overwriting the autoloader,

您可以通过优化帮助主题中所述的需求语句来获得一些额外的速度...首先删除所有要求,我还建议使用pear命名并覆盖自动加载器,

  function __autoload($class) {
      require str_replace('_', '/', $class) . '.php';
  }

you can find more details here

你可以在这里找到更多细节

#6


Are you being forced to use the Zend Framework? If there is no obligation to use it, then not using it would obviously be the fastest way to speed things up. There are several lightweight PHP frameworks that don't come with all the overhead and bulk of Zend. For instance, Codeigniter, Yii, Symfony, and Kohana are all excellent choices and I know at least that codenigniter and Kohana both support the use of Zend components (for instance:Using Zend with Codeigniter).

您是否*使用Zend Framework?如果没有义务使用它,那么不使用它显然是加快速度的最快方法。有几个轻量级PHP框架没有Zend的所有开销和大量。例如,Codeigniter,Yii,Symfony和Kohana都是很好的选择,我至少知道codenigniter和Kohana都支持使用Zend组件(例如:使用Zend和Codeigniter)。

Good luck!

#1


  1. APC or eAccelerator (APC will be included by default in future releases, so I'd recommend using it, even though raw speed is slightly below of eAccelerator)

    APC或eAccelerator(APC将在未来的版本中默认包含在内,所以我建议使用它,即使原始速度略低于eAccelerator)

  2. Two level cache for configuration, full-page, partial views, queries, model objects:

    用于配置,整页,部分视图,查询,模型对象的两级缓存:

    • 1st level cache (in memory KV-store, APC store or memcached)
    • 第一级缓存(在内存KV存储,APC存储或memcached中)

    • 2nd level cache (persistent KV-store in files, SQLite or dedicated KV-store)
    • 二级缓存(文件中持久的KV存储,SQLite或专用KV存储)

  3. RDBMS connection pooling, if avaliable.

    RDBMS连接池,如果可用的话。

#2


Before you start worrying about actively modifying things for more performance, you'll want to check the Performance Guide from the manual. One of the simplest steps you can do is to enable an opcode cache (such as APC) on your server - an Opcode cache alone can give you a 3-4x boost.

在您开始担心主动修改内容以获得更高性能之前,您需要查看手册中的“性能指南”。您可以做的最简单的步骤之一是在服务器上启用操作码缓存(例如APC) - 仅Opcode缓存就可以为您提供3-4倍的提升。

#3


I agree with Topbit, that you should start with code profiling. Find what is the problem.

我同意Topbit,你应该从代码分析开始。找出问题所在。

I don't think that the problem is just because of ZF has so many files. It uses autoloading, so only files required at the moment are loaded. You definitely shouldn't split different files contents.

我不认为问题只是因为ZF有这么多文件。它使用自动加载,因此只加载当前所需的文件。你绝对不应该拆分不同的文件内容。

For many perfomance problems, caching is your friend.

对于许多性能问题,缓存是你的朋友。

#4


Code on disk that isn't being called, doesn't take any time. The only way to see what is slow is to measure it. That said, if you aren't running an opcode-cache such as APC, then you are wasting time.

磁盘上未被调用的代码不需要任何时间。看到什么是缓慢的唯一方法是测量它。也就是说,如果你没有运行像APC这样的操作码缓存,那么你就是在浪费时间。

#5


you can get a bit of extra speed by optimizing the requirements statements as stated in the optimizing help topic ... first remove all the requirements and i also recommend using pear naming and overwriting the autoloader,

您可以通过优化帮助主题中所述的需求语句来获得一些额外的速度...首先删除所有要求,我还建议使用pear命名并覆盖自动加载器,

  function __autoload($class) {
      require str_replace('_', '/', $class) . '.php';
  }

you can find more details here

你可以在这里找到更多细节

#6


Are you being forced to use the Zend Framework? If there is no obligation to use it, then not using it would obviously be the fastest way to speed things up. There are several lightweight PHP frameworks that don't come with all the overhead and bulk of Zend. For instance, Codeigniter, Yii, Symfony, and Kohana are all excellent choices and I know at least that codenigniter and Kohana both support the use of Zend components (for instance:Using Zend with Codeigniter).

您是否*使用Zend Framework?如果没有义务使用它,那么不使用它显然是加快速度的最快方法。有几个轻量级PHP框架没有Zend的所有开销和大量。例如,Codeigniter,Yii,Symfony和Kohana都是很好的选择,我至少知道codenigniter和Kohana都支持使用Zend组件(例如:使用Zend和Codeigniter)。

Good luck!