|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2008-06-03 14:56 UTC] gdiego at gmail dot com
Description:
------------
When calling apc_store, if it needs memory, it might take a long time to free if several user variables are stored.
I think the problem comes with a modification at line 659 / 660 of php_apc.c that now has this code:
apc_cache_expunge(apc_cache,t);
apc_cache_expunge(apc_user_cache,t);
If several variables are stored in the cache then it takes a long time to free some.
Reproduce code:
---------------
<?
set_time_limit(0);
for ($i = 0; $i < 500000; $i++) {
$u = apc_cache_info("user", true); $u = $u['mem_size'];
if ($i % 50000 == 0) echo "--- $i $u\n";
$x = microtime(true); apc_store($i, $i); $x = microtime(true) - $x;
if ($x > 3) die("$x seconds taken for $i\n");
}
echo "test";
?>
Expected result:
----------------
An echo every time $i % 50000 == 0
test
Actual result:
--------------
--- 0 0
--- 50000 5177780
--- 100000 10377780
--- 150000 15677780
76.2400200367 seconds taken for 163626
(it takes a long time at iteration 163626 when cache is full)
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 21:00:01 2025 UTC |
With apc-3.1.x CVS HEAD, with a slight change to your script $u = apc_cache_info("user", true); $e = $u['expunges']; $m = $u['mem_size']; if ($i % 50000 == 0) echo "--- $i $e $m\n"; --- 0 0 0 --- 50000 0 28000000 --- 100000 1 27072080 --- 150000 2 26144160 --- 200000 3 25216240 --- 250000 4 24288320 --- 300000 5 23360400 --- 350000 6 22432480 --- 400000 7 21504560 --- 450000 8 20576640 took 14 seconds with a 32Mb cache. Please test CVS HEAD of pecl/apc and update the bug