Giter Club home page Giter Club logo

Comments (7)

Herz3h avatar Herz3h commented on June 24, 2024 1

@gordalina Removing these two lines fixes the problem, not sure why:

; php.ini
opcache.preload=/var/www/html/preload.php

; required for opcache.preload:
opcache.preload_user=www-data

Content of preload.php:

https://github.com/symfony/recipes/blob/main/symfony/framework-bundle/5.4/config/preload.php

Edit: Problem solved, I had to put the preload.php file inside my project not in a random spot on the filesystem..... (i used /var/www/html/preload.php before, now I used /var/www/symfony/preload.php

Thank you for the assistance.

from cachetool.

gordalina avatar gordalina commented on June 24, 2024

Run these commands with a warm cache and show me the output.

Locally I can see that num_cached_keys went from ~1800 to 0, showing that opcache_reset() was successful.

bin/cachetool php:eval --run='return var_export(opcache_get_status()["opcache_statistics"], true);'
bin/cachetool php:eval --run='opcache_reset();'
bin/cachetool php:eval --run='return var_export(opcache_get_status()["opcache_statistics"], true);'

from cachetool.

Herz3h avatar Herz3h commented on June 24, 2024

Output for cachetool opcache:status:

+----------------------+---------------------------------+
| Name                 | Value                           |
+----------------------+---------------------------------+
| Enabled              | Yes                             |
| Cache full           | No                              |
| Restart pending      | No                              |
| Restart in progress  | No                              |
| Memory used          | 102.39 MiB                      |
| Memory free          | 153.61 MiB                      |
| Memory wasted (%)    | 0 b (0%)                        |
| Strings buffer size  | 12 MiB                          |
| Strings memory used  | 8.38 MiB                        |
| Strings memory free  | 3.62 MiB                        |
| Number of strings    | 120684                          |
+----------------------+---------------------------------+
| Cached scripts       | 11472                           |
| Cached keys          | 12476                           |
| Max cached keys      | 32531                           |
| Start time           | Thu, 28 Sep 2023 22:55:59 +0200 |
| Last restart time    | Thu, 28 Sep 2023 23:12:44 +0200 |
| Oom restarts         | 0                               |
| Hash restarts        | 0                               |
| Manual restarts      | 2                               |
| Hits                 | 4527408                         |
| Misses               | 7807                            |
| Blacklist misses (%) | 0 (0%)                          |
| Opcache hit rate     | 99.827858216204                 |
+----------------------+---------------------------------+
cachetool php:eval --run='return var_export(opcache_get_status()["opcache_statistics"], true);'
array (
  'num_cached_scripts' => 11472,
  'num_cached_keys' => 12476,
  'max_cached_keys' => 32531,
  'hits' => 4528098,
  'start_time' => 1695934559,
  'last_restart_time' => 1695935564,
  'oom_restarts' => 0,
  'hash_restarts' => 0,
  'manual_restarts' => 2,
  'misses' => 7808,
  'blacklist_misses' => 0,
  'blacklist_miss_ratio' => 0.0,
  'opcache_hit_rate' => 99.82786239397377,
)
cachetool php:eval --run='opcache_reset();'
cachetool php:eval --run='return var_export(opcache_get_status()["opcache_statistics"], true);'
array (
  'num_cached_scripts' => 3705,
  'num_cached_keys' => 3705,
  'max_cached_keys' => 32531,
  'hits' => 0,
  'start_time' => 1695934559,
  'last_restart_time' => 1696492288,
  'oom_restarts' => 0,
  'hash_restarts' => 0,
  'manual_restarts' => 3,
  'misses' => 1,
  'blacklist_misses' => 0,
  'blacklist_miss_ratio' => 0.0,
  'opcache_hit_rate' => 0.0,
)

Also, it seems like that opcache_reset() does not reset opcache. Maybe it does for one php-fpm process only (bug) in my case ?

from cachetool.

gordalina avatar gordalina commented on June 24, 2024

@Herz3h it does seem that it cleaned the cache, see the cached keys is the same as cached scripts, and the hit counter was reset.

There seem to be some cached scripts which you can check which ones by running cachetool opcache:status:scripts.

from cachetool.

Herz3h avatar Herz3h commented on June 24, 2024

I have a php file where I add (let's call it test.php):

var_dump('test');
die;

After which I run cachetool opcache:reset but it's acting as if I didn't add anything to that file and upon running (cachetool opcache:status:scripts after cachetool opcache:reset), the file where I added the var_dump (test.php) has a HIT value of 0

from cachetool.

gordalina avatar gordalina commented on June 24, 2024

You need to have the FPM call the file test.php so it can cache it. It should only have a hit=1 on the second call to the file.

from cachetool.

Herz3h avatar Herz3h commented on June 24, 2024

I'm loading the page through the browser, and even after it is being cached, it doesn't take into account the code I changed, how should I further debug this ? I have tried upgrading to php 8.1.24, same thing

from cachetool.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.