Zend Framework的性能问题(Performance issue with Zend Framework)

编程入门 行业动态 更新时间:2024-10-26 09:21:58
Zend Framework的性能问题(Performance issue with Zend Framework)

我在1个月前将Zend Framework添加到我的php项目中。 我正在使用Zend_Measure和Zend_Locale将数字格式化为良好的语言环境。

我使用PHP 5.3与APC和Zend Framework 1.11。

从数据库导出原始数据时遇到了一个主要问题。 排除可忽略不计的mysql查询时间,带有记录格式的php导出每1000条记录需要3.5秒。 所有这些时间都花在Zend_Locale_Format::toNumber() 。 我怎样才能提高性能呢?

这个基准测试是在我自己的计算机上完成的(Macbook pro i5)。 在我们的生产服务器上,每1000条记录需要70秒! 此服务器是2GB rackspaceCloud云服务器,带有centos,只运行我们的Web应用程序。

macbook和rackspace服务器性能之间有20个因素。 我的macbook是如此强大吗? 我不这么认为......


UPDATE

在进行一些分析之后,似乎瓶颈是Zend_Cache_Backend_File->_fileGetContents 。 它默认使用Zend_Cache_Backend_File。 如何配置Zend Framework以使用Zend_Cache_Backend_Apc或Zend_Cache_Backend_TwoLevels ? 它可能会改善性能......

I added Zend Framework to my php project 1 month ago. I am using Zend_Measure and Zend_Locale for formatting the numbers to the good locale.

I am using php 5.3 with APC and Zend Framework 1.11.

I have a major issue with the export of raw data from my database. Excluding the mysql query time which is negligible the php export with formatting of the records takes 3.5 seconds per 1000 records. All this time is spend in Zend_Locale_Format::toNumber(). How can I improve the performance of this?

This benchmark has been done on my own computer (Macbook pro i5). On our production server it take 70 seconds per 1000 records!!! This server is a 2GB rackspaceCloud Cloud server with centos and only our web application running.

There is a 20 factor between the macbook and the rackspace server performance. Is my macbook so powerful? I don't think so...


UPDATE

After doing some profiling it appear that the bottleneck is Zend_Cache_Backend_File->_fileGetContents. It use by default Zend_Cache_Backend_File. How can I configure Zend Framework to use Zend_Cache_Backend_Apc or Zend_Cache_Backend_TwoLevels? It could maybe improve the performance...

最满意答案

您是否为Zend_Locale设置了全局缓存? 检查此文档页面并滚动到底部。

另外,检查您的APC设置。 我自己不使用APC,但是当缓存大小太小时,XCache会出现性能问题。 这也可能是您的配置问题。


要配置Zend_Locale和Zend_Local_Format使用的缓存,请使用Zend_Locale::setCache($cache)和Zend_Locale_Format::setOptions(array('cache' => $adapter)) 。 可以在手册中找到。

Have you setup the global cache for Zend_Locale? Check this doc page and scroll to the bottom.

Also, check your APC settings. I don't use APC myself but have had performance issues with XCache when the cache size was too small. This could also be an issue for your configuration.


To configure the cache used by Zend_Locale and Zend_Local_Format use Zend_Locale::setCache($cache) and Zend_Locale_Format::setOptions(array('cache' => $adapter)). As can be found in the manual.

更多推荐

本文发布于:2023-08-04 16:02:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1417897.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:性能   Framework   Zend   Performance   issue

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!