Are there big drawbacks using opcache as file storage instead of Ram memory? - Hack The Tech - Latest News related to Computer and Technology

Hack The Tech - Latest News related to Computer and Technology

Get Daily Latest News related to Computer and Technology and hack the world.

Thursday, March 31, 2022

Are there big drawbacks using opcache as file storage instead of Ram memory?

Since some time, I have been doing hobby projects again in PHP. One of the things I am running is a small application to store some Json data.

And another to make some big calculations. As we all know, PHP itself is not the best language for this (working with big calculations), since we need to compile it everytime we call it, it's kinda slow (if you compare it with golang or other languages that are already compiled before it runs).

To increase the speed of PHP we can use opcache to compile everything and store it in the Ram memory, so it will load much quicker.

Ram: Random access memory

But one of the things I found out, is that you can use opcache as file storage as well (https://patrickkerrigan.uk/blog/php-opcache-file-cache/), instead of putting it in more expensive Ram memory (since storage is cheaper than memory).

I understand why you would add it into Ram, since it is really quick. but why not use file storage more for servers that don't have that much Ram (it's slower, but will still increase the speed of your application since it is compiled to binary code)?

I did not find a lot of articles about this. Are there big drawbacks to this approach?



source https://stackoverflow.com/questions/71682245/are-there-big-drawbacks-using-opcache-as-file-storage-instead-of-ram-memory

No comments:

Post a Comment