php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #78202 Opcache stats for cache hits, hits and opcache_hit_rate are capped at 32bit NUM
Submitted: 2019-06-24 21:54 UTC Modified: 2019-06-25 11:10 UTC
From: arutledge at paycomonline dot com Assigned: cmb (profile)
Status: Closed Package: opcache
PHP Version: Irrelevant OS: WINNT
Private report: No CVE-ID: None
 [2019-06-24 21:54 UTC] arutledge at paycomonline dot com
Description:
------------
I have a fairly high usage cluster of 35+ servers.  Opcache is reset daily each night.  Opcache stats for 'cache hits', 'hits' and 'opcache_hit_rate' appear to be affected by the 'hits' variable which is limited to a maximum number size of 2,147,483,647...or 32bit int.  Once this # of hits is reached the number will turn negative and start counting up(going more positive) until it reaches zero and then it will go positive again.  Meanwhile the 'opcache_hit_rate' will become a negative number...IE -788% hit rate for example.

My concern is if this affects performance?

Status dump below for an example server...
opcache_enabled	true
cache_full	false
restart_pending	false
restart_in_progress	false
used_memory	479.96 MB
free_memory	288.04 MB
wasted_memory	0 bytes
current_wasted_percentage	0.00%
buffer_size	67,108,864
used_memory	34.91 MB
free_memory	29.09 MB
number_of_strings	663,003
num_cached_scripts	17,085
num_cached_keys	35,394
max_cached_keys	65,407
hits	-2,063,254,866
start_time	Sun, 23 Jun 19 07:37:35 -0500
last_restart_time	never
oom_restarts	0
hash_restarts	0
manual_restarts	0
misses	17,638
blacklist_misses	0
blacklist_miss_ratio	0.00%
opcache_hit_rate	-108.17%

Thank you


Patches

Pull Requests

Pull requests:

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2019-06-25 08:02 UTC] cmb@php.net
The respective variables are declared as `zend_ulong` which is 32bit only on x86. 
 I wouldn't consider this to be a bug, but rather a limitation (similar to file size restrictions).  Are you running x86 PHP executables?

There is, however, certainly a signed confusion issue.
 [2019-06-25 08:03 UTC] cmb@php.net
The following pull request has been associated:

Patch Name: Fix #78202: Opcache stats for cache hits are capped at 32bit NUM
On GitHub:  https://github.com/php/php-src/pull/4307
Patch:      https://github.com/php/php-src/pull/4307.patch
 [2019-06-25 11:08 UTC] cmb@php.net
Automatic comment on behalf of cmbecker69@gmx.de
Revision: http://git.php.net/?p=php-src.git;a=commit;h=4366f22dfcadfa080862c3fcbac8e0e42f05bf62
Log: Fix #78202: Opcache stats for cache hits are capped at 32bit NUM
 [2019-06-25 11:08 UTC] cmb@php.net
-Status: Open +Status: Closed
 [2019-06-25 11:10 UTC] cmb@php.net
-Assigned To: +Assigned To: cmb
 [2019-06-25 11:10 UTC] cmb@php.net
PR 4307 has been merged, so the signed/unsigned issue should be resolved.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 09:01:32 2024 UTC