Req #73888 [Opn]: realpath_cache should be SHM

From: Date: Wed, 11 Jan 2017 10:48:28 +0000
Subject: Req #73888 [Opn]: realpath_cache should be SHM
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-206511@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=73888&edit=1 ID: 73888 User updated by: spam2 at rhsoft dot net Reported by: spam2 at rhsoft dot net Summary: realpath_cache should be SHM Status: Open Type: Feature/Change Request Package: Performance problem PHP Version: Irrelevant Block user comment: N Private report: N New Comment: and as long as every httpd process maintains it's authistic realpath_cache commits like below are harmful because wit 500 forkers under load you end in 900 MB wasted memory instead 4 MB https://github.com/php/php-src/commit/782b84c6d550ac6e695b54070bb0b409cac29f58 Previous Comments: ------------------------------------------------------------------------ [2017-01-07 18:57:36] spam2 at rhsoft dot net maybe these numbers a view minutes after reload http makes the problem clear: echo count(realpath_cache_get()); 325 6 57 1692 so we have one forker with a effective cache of 1692 records while another one a few seconds before only had 6 cache entries and so don't benefit from anything ------------------------------------------------------------------------ [2017-01-07 18:40:30] spam2 at rhsoft dot net Description: ------------ in theory "realpath_cache" is a nice concept, but when you do repeatly print_r(realpath_cache_get()); you see it's very randomly depending on the forker instance you hit and so it's not really effective - on server with high load and so many hundret processes each maintains it's own cache and the hit rate because ttl is reached drops heavily besides it's not a effective as it should be there are more disadvantages: * you waste memory realpath_cache_size muliplied with process count * clearstatcache() called by applications after file-changes is more or less worthless because only the worker process issuing the command is affected while others still use cached results so this should work like "apcu" with a SHM segment sahred by all workers or since PHP now has 'opcache' shared between workers and doing all sorts of optimizations (include-hack, interned string buffers..) maybe the storage for realpath_cache could even go to 'opcache' at all ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=73888&edit=1

« previous php.bugs (#206511) next »