简体   繁体   中英

Performance issue with Zend Framework

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...

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM