I am currently working on some projects using Zend Framework which is an excellent but huge framework.
One of the problems of systems like this is the huge number of files that are included ( e.g. using include_once etc. ). It is not only Zend Framework that suffers speed issues due to this but all systems which include a fair number of files, any of the frameworks, Drupal etc. etc.
The PHP realpath cache helps greatly here except for one thing, as standard PHP ( php.ini ) sets realpath_cache_size at a miserly 16K which is ridiculously small.
realpath_cache_ttl is set to 120 seconds which also may or may not benefit by being larger dependent on the system.
I ran a test on the system I am building and saw the following on first page load: -
- Parse time: 0.1278 seconds
- Realpath cache used: 16.35K ( standard PHP 16k )
- Realpath cache remaining: -0.35K
I then adjusted to realpath_cache_size = 150k and saw: -
- Parse time: 0.0521 seconds
- Realpath cache used: 92.61K ( adjusted to 150k )
- Realpath cache remaining: 57.39K
Such a simple change with such dramatic improvements, I though it worth sharing.
In case it helps below is a simple method I use in my system class: -
public function getSystemData( $target = false ) {
$realpath_cache_available = (int)str_ireplace( 'k', '', ini_get( 'realpath_cache_size' ) );
$realpath_cache_used = number_format( ( realpath_cache_size() / 1000 ), 2 );
switch ( $target ) {
case 'parse_time':
return number_format ( ( microtime ( true ) - self::$system_time ), 4 );
break;
case 'realpath_cache_used':
return $realpath_cache_used . 'K';
break;
case 'realpath_cache_remaining':
return ( $realpath_cache_available - $realpath_cache_used ) . 'K';
break;
default:
return 'data unavailable';
break;
}
} // end method
self::$system_time is set when the system bootstraps using microtime( true );















