php74 preloading configs

🔥Iggy🔥

Well-known member
hello,
we have only just recently been able to upgrade to php74 and now i am looking into this opcache preloading feature.

have a few questions like:

does xf have a file directing the conditions? if so where is it located?
do we need to do other configs on our end for it to work? i.e. add that file location to php.ini or such.

or perhaps its fully all custom work? optimally set by server/site stats etc.....in which case, i would be curious to see how people are configuring that....

seems like a powerful tool but isnt exactly plug and play so a little clarity would be great.

thank you
 
hello,
we have only just recently been able to upgrade to php74 and now i am looking into this opcache preloading feature.

have a few questions like:

does xf have a file directing the conditions? if so where is it located?
do we need to do other configs on our end for it to work? i.e. add that file location to php.ini or such.

or perhaps its fully all custom work? optimally set by server/site stats etc.....in which case, i would be curious to see how people are configuring that....

seems like a powerful tool but isnt exactly plug and play so a little clarity would be great.

thank you
did you submit a ticket to ask this?
 
did you submit a ticket to ask this?
no...
i am partly still trying to understand what gain it has over memcached or such, which we currently use...it sort of sounds like "just a cache" but i really dont understand it well at all...hard to imagine them reinventing the wheel then releasing it as a cutting edge feature you know...
 
Memcached is irrelevant to opcache. Memcached provides in memory database caching whereas opcache provides caching for PHP files. Opcache (as well as memcached) can significantly improve site performance and it is highly recommended. Preloading introduced in 7.4 enhances the existing opcache.
 
Opcache (as well as memcached) can significantly improve site performance and it is highly recommended. Preloading introduced in 7.4 enhances the existing opcache.
So how to check that opcache is working? I can check redis page cache by x-xf-cache-status:HIT in headers. What about opcache?
 
To check if opcache is working in general, just run var_dump(opcache_get_status());

If it returns false it's not enabled/working. If it returns an array with information then it's working.
 
good info thank you....helps me understand what its about....

the config still is not clear however......what i am understanding is that the php files to be cached need to be manually defined....things could be working just fine, but if those files arent defined, it wont speed up the xenforo right?

so the question remains, which xenforo files should be included for preloading?
 
Memcached is irrelevant to opcache. Memcached provides in memory database caching whereas opcache provides caching for PHP files. Opcache (as well as memcached) can significantly improve site performance and it is highly recommended. Preloading introduced in 7.4 enhances the existing opcache.
what does caching php file mean?

database cache means query results are saved in memory but I don't understand what could be a case of php cache
 
what does caching php file mean?

database cache means query results are saved in memory but I don't understand what could be a case of php cache
Normally, whenever a PHP script needs to be run/executed it is being loaded and parsed. As you understand, this takes time and processing power. opcache caches a precompiled version of a PHP file so only the first time that is run is loaded and parsed. Then in all subsequent requests the code is being loaded from the cache thus saving time in loading/parsing the script again.

Is the PHP script not cached? -> Load->Parse->Compile->Save to Memory->Execute
Is the PHP script cached? Read from Memory->Execute
 
hmm maybe i can ask a different question....

should any php files be EXCLUDED from preloading with xenforo?

do some help improve performance more and will we break the server if we just include the entire XF? 🙃
 
good info thank you....helps me understand what its about....

the config still is not clear however......what i am understanding is that the php files to be cached need to be manually defined....things could be working just fine, but if those files arent defined, it wont speed up the xenforo right?

so the question remains, which xenforo files should be included for preloading?
Yes the files need to be manually specified. Usually you create an autoload file which reads all the relevant PHP files and adds them in the preloading cache. Unfortunately I don't know exactly which XF file you would need to add. I assume whatever is under the src folder but I might be wrong.
 
hmm maybe i can ask a different question....

should any php files be EXCLUDED from preloading with xenforo?

do some help improve performance more and will we break the server if we just include the entire XF? 🙃
Well, you can always try it on a sandbox :) If something is wrong you will get an error in your logs but it shouldn't break anything! The preloading will just not work.

If you don't have opcache enabled just enable it and you should be OK. You can live without preloading :P
 
we have decent memory and dedicated machine, it just sounds like alot to preload the entire software lol, but maybe not??

it seems a tempting incentive tho as these claims are standard 25% ish increase in performance with preloading......yet nobody seems to really be using it with xenforo :unsure:
 
Top Bottom