You are here

PHPExcel performance settings in PHPExcel 7.3

Same name and namespace in other branches
  1. 8.3 phpexcel.api.php \phpexcel_perf

PHPExcel (the library) allows developers to have fine-grained control over the way cell data is cached. Large Excel files can quickly take up a lot of memory (about 1Kb per cell), and PHP processes could die running out of available memory.

PHPExcel is usable with APC, Memcached, SQLite or static file storage, to optimize memory usage. PHPExcel can also gzip cell data, resulting in less memory usage, but at the cost of speed.

Because this should not be controlled by any modules, but depends on each site install, there's no API to set what caching method to use. By default, PHPEXcel will use in-memory caching for fastest performance. Site administrators can change this by going to /admin/config/system/phpexcel. This configuration form will allow them to choose an appropriate caching method, and provide any related settings. The module will then start using these settings when exporting and importing data, to optimize memory usage.

The following methods are available:

  • In memory, which is the fastest, but also consumes the most memory.
  • In memory, serialized. Slightly slower, but decreases memory usage.
  • In memory, gzipped. Slighty slower than serialized, but decreases memory usage even further.
  • APC, requires APC to be installed. Fast, and doesn't increase memory usage.
  • Memcache, requires Memcached to be installed and running. Fast, and doesn't increase memory usage.
  • SQLite3. Ships with most PHP installs. Slow, but doesn't increase memory usage.
  • Static files (stored in php://tmp). Slowest, but doesn't increase memory usage. In this case, it is still possible to set a maximum limit, up until which PHPExcel will still use in-memory caching. Defaults to 1Mb. After reaching that limit, data is stored in static files.

File

./phpexcel.api.php, line 252
Module API documentation.