简体   繁体   中英

Does Opcache on PHP7 preallocate all assigned memory?

My opcache had a memory_consumption set of 512M and it was full.

So I increased it to 2048M, and restarted the php-fpm daemon. And it immediately filled up again:

缓存问题

This site is simply running a WP Multisite installation with 2 subdomain sites. Nothing special, really. It's a low traffic site, mostly static. It does have a Woocommerce shop, but with two products only. Nothing makes me think that this amount of cache consumption is justified.

  • Does PHP7's Opcache preallocate all of the memory it is configured to use?
  • Or is my cache genuinely filled?
  • Or am I setting the incorrect property?

My php-fpm config has:

php_value[opcache.memory_consumption] = 2048

How can I get further insight into what's going on?

The problem was in the way I had configured the opcache. I had configured it in the fpm pool by setting this property:

php_value[opcache.memory_consumption] = 2048

However, the right way of configuring it is in php.ini or in php.d:

opcache.memory_consumption=2048

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM