答复: [PECL-DEV] Unpredictable results w ith APC 3.1.4 for Windows
| From: | ��һ�[ | Date: | Fri, 17 Sep 2010 04:50:13 +0000 |
| Subject: | 答复: [PECL-DEV] Unpredictable results w ith APC 3.1.4 for Windows | ||
| References: | 1 2 | Groups: | php.pecl.dev |
| Request: | Send a blank email to pecl-dev+get-7644@lists.php.net to get a copy of this message | ||
Maybe you should send mail directly to its Maintainer. You can find it at http://pecl.php.net/package/APC.
Good Luck!
-----邮件原件-----
发件人: Marco Moreno [mailto:mmoreno@pobox.com]
发送时间: 2010年9月17日 12:17
收件人: pecl-dev@lists.php.net
主题: Re: [PECL-DEV] Unpredictable results with APC 3.1.4 for Windows
I've seen no response on this so I'm wondering if I am asking this in the wrong group? Or
should I report this as a bug? I'm new to APC so I don't know if I'm using it
correctly.
Marco
On Sep 3, 2010, at 4:35 PM, Marco Moreno wrote:
> I'm using APC 3.1.4 with Apache 2.2.16 (Win32) and PHP 5.2.14. I obtained php_apc.dll
> from downloads.php.net/pierre/php_apc-3.1.4-5.2-VC6-x86.zip
>
> I am seeing unpredictable results with apc_store() which appears to be adding duplicate entries
> to the cache instead of replacing the old one. In addition, it often appears to store FALSE instead
> of the correct value. Setting write_lock and slam_defense on or off doesn't seem to make a
> difference. I'm not sure if I am using this improperly, have the wrong dll, or if I'm
> encountering a bug.
>
> Apache also appears to be rather unstable - crashing several times per day. I also upgraded
> Apache and PHP at the same time as implementing APC so I'm not sure what may be contributing to
> it (nothing in the logs).
>
> Thanks,
>
> Marco Moreno
>
>
> I figured a picture is worth a thousand words so here you go:
>
> <?php
>
> // Array of various test values to store in APC cache
> $test = array(
> "test-1" => 1,
> "test-2" => 2,
> "test-3" => 3,
> "test-4" => "apple",
> "test-5" => "banana",
> "test-6" => "orange",
> "test-7" => NULL,
> "test-8" => array("1", "2", "3"),
> "test-9" => array("cat" => "mouse", "cops"
> => "robbers"),
> "test-10" => array(
> "nuts" => array("pecan", "walnut",
> "cashew"),
> "dogs" => array("lab", "lap",
> "hot"),
> ),
> );
>
> // Cache info dump - BEFORE
> apc_clear_cache("user");
> echo "<h3>Cache dump BEFORE via apc_cache_info('user'):</h3>";
> echo "<pre>";
> print_r(apc_cache_info("user"));
> echo "</pre>";
> echo "<hr />";
>
> // Display original values
> echo "<h3>Original list of test cases</h3>";
> echo "<p><strong>Note that 'test-7' is
> NULL</strong></p>";
> echo "<pre>";
> print_r($test);
> echo "</pre>";
> echo "<hr />";
>
> // Number of times to repeat tests
> $repeat_times = 10;
> echo "<h3>Runing apc_store()/apc_fetch() $repeat_times times...</h3>";
> foreach (range(1,$repeat_times) as $i) {
> echo "<p><strong>Run #{$i}</strong></p>";
> echo "<pre>";
> do_test();
> echo "</pre>";
> }
> echo "<hr />";
>
> // Cache info dump - AFTER
> echo "<h3>Cache dump AFTER via apc_cache_info('user'):</h3>";
> echo "<pre>";
> print_r(apc_cache_info("user"));
> echo "</pre>";
>
> function do_test() {
> global $test;
> foreach (array_keys($test) as $i) {
> apc_store($i, $test[$i]) or die("Failed storing key '{$i}'");
> }
>
> foreach (array_keys($test) as $i) {
> $cache[$i] = apc_fetch("{$i}");
> echo "Key '{$i}' ";
> if ($cache[$i] === $test[$i]) {
> echo "ok.\n";
> }
> else {
> echo "FAILED!";
> echo "<blockquote>";
> echo "Expected:\n";
> var_dump($test[$i]);
> echo "\nReturned:\n";
> var_dump($cache[$i]);
> echo "</blockquote>";
> }
> }
> }
>
> ?>
>
>
> RESULTS:
>
> Cache dump BEFORE via apc_cache_info('user'):
>
> Array
> (
> [num_slots] => 4099
> [ttl] => 7200
> [num_hits] => 0
> [num_misses] => 0
> [num_inserts] => 0
> [expunges] => 0
> [start_time] => 1283543299
> [mem_size] => 0
> [num_entries] => 0
> [file_upload_progress] => 1
> [memory_type] => IPC shared
> [locking_type] => spin
> [cache_list] => Array
> (
> )
>
> [deleted_list] => Array
> (
> )
>
> )
>
> Original list of test cases
>
> Note that 'test-7' is NULL
>
> Array
> (
> [test-1] => 1
> [test-2] => 2
> [test-3] => 3
> [test-4] => apple
> [test-5] => banana
> [test-6] => orange
> [test-7] =>
> [test-8] => Array
> (
> [0] => 1
> [1] => 2
> [2] => 3
> )
>
> [test-9] => Array
> (
> [cat] => mouse
> [cops] => robbers
> )
>
> [test-10] => Array
> (
> [nuts] => Array
> (
> [0] => pecan
> [1] => walnut
> [2] => cashew
> )
>
> [dogs] => Array
> (
> [0] => lab
> [1] => lap
> [2] => hot
> )
>
> )
>
> )
>
> Runing apc_store()/apc_fetch() 10 times...
>
> Run #1
>
> Key 'test-1' ok.
> Key 'test-2' ok.
> Key 'test-3' ok.
> Key 'test-4' ok.
> Key 'test-5' ok.
> Key 'test-6' ok.
> Key 'test-7' ok.
> Key 'test-8' ok.
> Key 'test-9' ok.
> Key 'test-10' ok.
>
> Run #2
>
> Key 'test-1' ok.
> Key 'test-2' ok.
> Key 'test-3' ok.
> Key 'test-4' ok.
> Key 'test-5' ok.
> Key 'test-6' ok.
> Key 'test-7' FAILED!
>
> Expected:
> NULL
>
> Returned:
> bool(false)
>
> Key 'test-8' ok.
> Key 'test-9' ok.
> Key 'test-10' ok.
>
> Run #3
>
> Key 'test-1' FAILED!
> Expected:
> int(1)
>
> Returned:
> bool(false)
>
> Key 'test-2' FAILED!
> Expected:
> int(2)
>
> Returned:
> bool(false)
>
> Key 'test-3' ok.
> Key 'test-4' ok.
> Key 'test-5' ok.
> Key 'test-6' ok.
> Key 'test-7' FAILED!
>
> Expected:
> NULL
>
> Returned:
> bool(false)
>
> Key 'test-8' ok.
> Key 'test-9' ok.
> Key 'test-10' ok.
>
> Run #4
>
> Key 'test-1' FAILED!
> Expected:
> int(1)
>
> Returned:
> bool(false)
>
> Key 'test-2' ok.
> Key 'test-3' ok.
> Key 'test-4' ok.
> Key 'test-5' ok.
> Key 'test-6' ok.
> Key 'test-7' FAILED!
>
> Expected:
> NULL
>
> Returned:
> bool(false)
>
> Key 'test-8' ok.
> Key 'test-9' ok.
> Key 'test-10' ok.
>
> Run #5
>
> Key 'test-1' FAILED!
> Expected:
> int(1)
>
> Returned:
> bool(false)
>
> Key 'test-2' ok.
> Key 'test-3' ok.
> Key 'test-4' ok.
> Key 'test-5' ok.
> Key 'test-6' ok.
> Key 'test-7' FAILED!
>
> Expected:
> NULL
>
> Returned:
> bool(false)
>
> Key 'test-8' ok.
> Key 'test-9' ok.
> Key 'test-10' ok.
>
> Run #6
>
> Key 'test-1' FAILED!
> Expected:
> int(1)
>
> Returned:
> bool(false)
>
> Key 'test-2' ok.
> Key 'test-3' ok.
> Key 'test-4' ok.
> Key 'test-5' ok.
> Key 'test-6' ok.
> Key 'test-7' FAILED!
>
> Expected:
> NULL
>
> Returned:
> bool(false)
>
> Key 'test-8' ok.
> Key 'test-9' ok.
> Key 'test-10' ok.
>
> Run #7
>
> Key 'test-1' FAILED!
> Expected:
> int(1)
>
> Returned:
> bool(false)
>
> Key 'test-2' ok.
> Key 'test-3' ok.
> Key 'test-4' ok.
> Key 'test-5' ok.
> Key 'test-6' FAILED!
>
> Expected:
> string(6) "orange"
>
> Returned:
> bool(false)
>
> Key 'test-7' FAILED!
> Expected:
> NULL
>
> Returned:
> bool(false)
>
> Key 'test-8' ok.
> Key 'test-9' ok.
> Key 'test-10' ok.
>
> Run #8
>
> Key 'test-1' FAILED!
> Expected:
> int(1)
>
> Returned:
> bool(false)
>
> Key 'test-2' ok.
> Key 'test-3' ok.
> Key 'test-4' ok.
> Key 'test-5' ok.
> Key 'test-6' ok.
> Key 'test-7' ok.
> Key 'test-8' ok.
> Key 'test-9' ok.
> Key 'test-10' ok.
>
> Run #9
>
> Key 'test-1' FAILED!
> Expected:
> int(1)
>
> Returned:
> bool(false)
>
> Key 'test-2' ok.
> Key 'test-3' ok.
> Key 'test-4' ok.
> Key 'test-5' ok.
> Key 'test-6' ok.
> Key 'test-7' FAILED!
>
> Expected:
> NULL
>
> Returned:
> bool(false)
>
> Key 'test-8' ok.
> Key 'test-9' ok.
> Key 'test-10' ok.
>
> Run #10
>
> Key 'test-1' FAILED!
> Expected:
> int(1)
>
> Returned:
> bool(false)
>
> Key 'test-2' ok.
> Key 'test-3' ok.
> Key 'test-4' ok.
> Key 'test-5' ok.
> Key 'test-6' ok.
> Key 'test-7' FAILED!
>
> Expected:
> NULL
>
> Returned:
> bool(false)
>
> Key 'test-8' ok.
> Key 'test-9' ok.
> Key 'test-10' ok.
>
> Cache dump AFTER via apc_cache_info('user'):
>
> Array
> (
> [num_slots] => 4099
> [ttl] => 7200
> [num_hits] => 82
> [num_misses] => 18
> [num_inserts] => 100
> [expunges] => 0
> [start_time] => 1283543299
> [mem_size] => 15608
> [num_entries] => 26
> [file_upload_progress] => 1
> [memory_type] => IPC shared
> [locking_type] => spin
> [cache_list] => Array
> (
> [0] => Array
> (
> [info] => test-10
> [ttl] => 0
> [type] => user
> [num_hits] => 1
> [mtime] => 1283543299
> [creation_time] => 1283543299
> [deletion_time] => 0
> [access_time] => 1283543299
> [ref_count] => 0
> [mem_size] => 1108
> )
>
> [1] => Array
> (
> [info] => test-9
> [ttl] => 0
> [type] => user
> [num_hits] => 1
> [mtime] => 1283543299
> [creation_time] => 1283543299
> [deletion_time] => 0
> [access_time] => 1283543299
> [ref_count] => 0
> [mem_size] => 580
> )
>
> [2] => Array
> (
> [info] => test-8
> [ttl] => 0
> [type] => user
> [num_hits] => 1
> [mtime] => 1283543299
> [creation_time] => 1283543299
> [deletion_time] => 0
> [access_time] => 1283543299
> [ref_count] => 0
> [mem_size] => 580
> )
>
> [3] => Array
> (
> [info] => test-7
> [ttl] => 0
> [type] => user
> [num_hits] => 0
> [mtime] => 1283543299
> [creation_time] => 1283543299
> [deletion_time] => 0
> [access_time] => 1283543299
> [ref_count] => 0
> [mem_size] => 580
> )
>
> [4] => Array
> (
> [info] => test-7
> [ttl] => 0
> [type] => user
> [num_hits] => 0
> [mtime] => 1283543299
> [creation_time] => 1283543299
> [deletion_time] => 0
> [access_time] => 1283543299
> [ref_count] => 0
> [mem_size] => 580
> )
>
> [5] => Array
> (
> [info] => test-7
> [ttl] => 0
> [type] => user
> [num_hits] => 0
> [mtime] => 1283543299
> [creation_time] => 1283543299
> [deletion_time] => 0
> [access_time] => 1283543299
> [ref_count] => 0
> [mem_size] => 580
> )
>
> [6] => Array
> (
> [info] => test-7
> [ttl] => 0
> [type] => user
> [num_hits] => 0
> [mtime] => 1283543299
> [creation_time] => 1283543299
> [deletion_time] => 0
> [access_time] => 1283543299
> [ref_count] => 0
> [mem_size] => 580
> )
>
> [7] => Array
> (
> [info] => test-7
> [ttl] => 0
> [type] => user
> [num_hits] => 0
> [mtime] => 1283543299
> [creation_time] => 1283543299
> [deletion_time] => 0
> [access_time] => 1283543299
> [ref_count] => 0
> [mem_size] => 580
> )
>
> [8] => Array
> (
> [info] => test-7
> [ttl] => 0
> [type] => user
> [num_hits] => 0
> [mtime] => 1283543299
> [creation_time] => 1283543299
> [deletion_time] => 0
> [access_time] => 1283543299
> [ref_count] => 0
> [mem_size] => 580
> )
>
> [9] => Array
> (
> [info] => test-7
> [ttl] => 0
> [type] => user
> [num_hits] => 0
> [mtime] => 1283543299
> [creation_time] => 1283543299
> [deletion_time] => 0
> [access_time] => 1283543299
> [ref_count] => 0
> [mem_size] => 580
> )
>
> [10] => Array
> (
> [info] => test-7
> [ttl] => 0
> [type] => user
> [num_hits] => 0
> [mtime] => 1283543299
> [creation_time] => 1283543299
> [deletion_time] => 0
> [access_time] => 1283543299
> [ref_count] => 0
> [mem_size] => 580
> )
>
> [11] => Array
> (
> [info] => test-6
> [ttl] => 0
> [type] => user
> [num_hits] => 1
> [mtime] => 1283543299
> [creation_time] => 1283543299
> [deletion_time] => 0
> [access_time] => 1283543299
> [ref_count] => 0
> [mem_size] => 580
> )
>
> [12] => Array
> (
> [info] => test-6
> [ttl] => 0
> [type] => user
> [num_hits] => 0
> [mtime] => 1283543299
> [creation_time] => 1283543299
> [deletion_time] => 0
> [access_time] => 1283543299
> [ref_count] => 0
> [mem_size] => 580
> )
>
> [13] => Array
> (
> [info] => test-5
> [ttl] => 0
> [type] => user
> [num_hits] => 1
> [mtime] => 1283543299
> [creation_time] => 1283543299
> [deletion_time] => 0
> [access_time] => 1283543299
> [ref_count] => 0
> [mem_size] => 580
> )
>
> [14] => Array
> (
> [info] => test-4
> [ttl] => 0
> [type] => user
> [num_hits] => 1
> [mtime] => 1283543299
> [creation_time] => 1283543299
> [deletion_time] => 0
> [access_time] => 1283543299
> [ref_count] => 0
> [mem_size] => 580
> )
>
> [15] => Array
> (
> [info] => test-3
> [ttl] => 0
> [type] => user
> [num_hits] => 1
> [mtime] => 1283543299
> [creation_time] => 1283543299
> [deletion_time] => 0
> [access_time] => 1283543299
> [ref_count] => 0
> [mem_size] => 580
> )
>
> [16] => Array
> (
> [info] => test-2
> [ttl] => 0
> [type] => user
> [num_hits] => 1
> [mtime] => 1283543299
> [creation_time] => 1283543299
> [deletion_time] => 0
> [access_time] => 1283543299
> [ref_count] => 0
> [mem_size] => 580
> )
>
> [17] => Array
> (
> [info] => test-2
> [ttl] => 0
> [type] => user
> [num_hits] => 0
> [mtime] => 1283543299
> [creation_time] => 1283543299
> [deletion_time] => 0
> [access_time] => 1283543299
> [ref_count] => 0
> [mem_size] => 580
> )
>
> [18] => Array
> (
> [info] => test-1
> [ttl] => 0
> [type] => user
> [num_hits] => 0
> [mtime] => 1283543299
> [creation_time] => 1283543299
> [deletion_time] => 0
> [access_time] => 1283543299
> [ref_count] => 0
> [mem_size] => 580
> )
>
> [19] => Array
> (
> [info] => test-1
> [ttl] => 0
> [type] => user
> [num_hits] => 0
> [mtime] => 1283543299
> [creation_time] => 1283543299
> [deletion_time] => 0
> [access_time] => 1283543299
> [ref_count] => 0
> [mem_size] => 580
> )
>
> [20] => Array
> (
> [info] => test-1
> [ttl] => 0
> [type] => user
> [num_hits] => 0
> [mtime] => 1283543299
> [creation_time] => 1283543299
> [deletion_time] => 0
> [access_time] => 1283543299
> [ref_count] => 0
> [mem_size] => 580
> )
>
> [21] => Array
> (
> [info] => test-1
> [ttl] => 0
> [type] => user
> [num_hits] => 0
> [mtime] => 1283543299
> [creation_time] => 1283543299
> [deletion_time] => 0
> [access_time] => 1283543299
> [ref_count] => 0
> [mem_size] => 580
> )
>
> [22] => Array
> (
> [info] => test-1
> [ttl] => 0
> [type] => user
> [num_hits] => 0
> [mtime] => 1283543299
> [creation_time] => 1283543299
> [deletion_time] => 0
> [access_time] => 1283543299
> [ref_count] => 0
> [mem_size] => 580
> )
>
> [23] => Array
> (
> [info] => test-1
> [ttl] => 0
> [type] => user
> [num_hits] => 0
> [mtime] => 1283543299
> [creation_time] => 1283543299
> [deletion_time] => 0
> [access_time] => 1283543299
> [ref_count] => 0
> [mem_size] => 580
> )
>
> [24] => Array
> (
> [info] => test-1
> [ttl] => 0
> [type] => user
> [num_hits] => 0
> [mtime] => 1283543299
> [creation_time] => 1283543299
> [deletion_time] => 0
> [access_time] => 1283543299
> [ref_count] => 0
> [mem_size] => 580
> )
>
> [25] => Array
> (
> [info] => test-1
> [ttl] => 0
> [type] => user
> [num_hits] => 0
> [mtime] => 1283543299
> [creation_time] => 1283543299
> [deletion_time] => 0
> [access_time] => 1283543299
> [ref_count] => 0
> [mem_size] => 580
> )
>
> )
>
> [deleted_list] => Array
> (
> )
>
> )
>
>
> APC INFO:
>
> APC Support enabled
> Version 3.1.4
> MMAP Support Disabled
> Locking type spin Locks
> Revision $Revision: 301663 $
> Build Date Aug 10 2010 11:34:45
>
> Directive Local Value Master Value
> apc.cache_by_default On On
> apc.canonicalize On On
> apc.coredump_unmap Off Off
> apc.enable_cli Off Off
> apc.enabled On On
> apc.file_md5 Off Off
> apc.file_update_protection 2 2
> apc.filters no value no value
> apc.gc_ttl 3600 3600
> apc.include_once_override Off Off
> apc.lazy_classes Off Off
> apc.lazy_functions Off Off
> apc.max_file_size 1M 1M
> apc.num_files_hint 1000 1000
> apc.preload_path no value no value
> apc.report_autofilter Off Off
> apc.rfc1867 Off Off
> apc.rfc1867_freq 0 0
> apc.rfc1867_name APC_UPLOAD_PROGRESS APC_UPLOAD_PROGRESS
> apc.rfc1867_prefix upload_ upload_
> apc.rfc1867_ttl 3600 3600
> apc.shm_segments 1 1
> apc.shm_size 256M 256M
> apc.slam_defense Off Off
> apc.stat On On
> apc.stat_ctime Off Off
> apc.ttl 7200 7200
> apc.use_request_time On On
> apc.user_entries_hint 4096 4096
> apc.user_ttl 7200 7200
> apc.write_lock Off Off
>
>
>
>
> --
> PECL development discussion Mailing List (http://pecl.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
--
PECL development discussion Mailing List (http://pecl.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php