Zend Config Performance Optimization

612 views Asked by At

I am optimizing a Zend Framework based application, and I am sure using ini based config slows down overall performance as the sites need to read and parse ini on each and every page request. Now I have 2 ideas to deal with the situation

  • Cache the ini file or cache the zend_config object and use it from cache
  • Or convert the ini based config to php

I am not sure which approach provides better performance. I will be modifying the configuration my self in future if needed, and I don't need the feature of writing config back to the ini. So please suggest which approach is better for extreme performance. In cache approach its just deserializing an already existing object, while in php array its constructing object from scratch.

2

There are 2 answers

2
FloydThreepwood On BEST ANSWER

Cache!

Explanation:

If you convert it to a php Object you merely exchange the parser, and mind: PHP has many constructs, and building a AST is not even remotely simple for this language.

With a cache your data will likely be stored in Memory and so your HardDisk will not have to perform any I/O to get the settings object each request. Even parsing or deserialization can be handled a lot quicker that way, and remember this will also be done by the PHP Interpreter.

A last Hint:

If you are afraid your ini files parse too long, maybe you could slice your config file and, and not always load all settings?

0
sas On

Cache the ini file or cache the zend_config object and use it from cache

this is the right choice.

check this application.ini cache