PHP Opcache 已满,但不知道原因

PHP Opcache 已满,但不知道原因

我们的生产服务器显示操作缓存已满,无法再向缓存添加任何脚本。尽管配置/统计信息应该如此。

配置设置如下。

[opcache.enable] => 1
[opcache.enable_cli] => 1
[opcache.use_cwd] => 1
[opcache.validate_timestamps] => 1
[opcache.validate_permission] => 
[opcache.validate_root] => 
[opcache.inherited_hack] => 1
[opcache.dups_fix] => 
[opcache.revalidate_path] => 
[opcache.log_verbosity_level] => 1
[opcache.memory_consumption] => 268435456
[opcache.interned_strings_buffer] => 8
[opcache.max_accelerated_files] => 10000
[opcache.max_wasted_percentage] => 0.05
[opcache.consistency_checks] => 0
[opcache.force_restart_timeout] => 180
[opcache.revalidate_freq] => 60
[opcache.preferred_memory_model] => 
[opcache.blacklist_filename] => 
[opcache.max_file_size] => 0
[opcache.error_log] => /usr/local/php/var/log/opcache.log
[opcache.protect_memory] => 
[opcache.save_comments] => 1
[opcache.enable_file_override] => 
[opcache.optimization_level] => 2147483647
[opcache.lockfile_path] => /tmp

OpCache 的统计数据如下。

[opcache_enabled] => 1
[cache_full] => 1
[restart_pending] => 
[restart_in_progress] => 
[memory_usage] => Array
    (
        [used_memory] => 50731400
        [free_memory] => 215329480
        [wasted_memory] => 2374576
        [current_wasted_percentage] => 0.88459849357605
    )

[interned_strings_usage] => Array
    (
        [buffer_size] => 8388608
        [used_memory] => 4651068
        [free_memory] => 3737540
        [number_of_strings] => 80180
    )

[opcache_statistics] => Array
    (
        [num_cached_scripts] => 834
        [num_cached_keys] => 16229
        [max_cached_keys] => 16229
        [hits] => 136143449
        [start_time] => 1711217285
        [last_restart_time] => 0
        [oom_restarts] => 0
        [hash_restarts] => 0
        [manual_restarts] => 0
        [misses] => 32577
        [blacklist_misses] => 0
        [blacklist_miss_ratio] => 0
        [opcache_hit_rate] => 99.976077286908
    )

答案1

您已max_accelerated_files设置为10000,这将向上舍入(请参阅文档) 到16229中可以看到opcache_statistics.max_cached_keys,您已经达到了这个限制opcache_statistics.num_cached_keys。要解决这个问题,您需要增加max_accelerated_files

相关内容