Does PHP provide an option to keep a file open instead of re-opening whenever the script is started?
My script is called around 500 times per second and can be compared to a counter script, which reads 100 lines from the file status.json, does some ++ or -- or resets some values in the file and writes the result back to the same file.
With 500 read/writes per second, the hdd has no issue yet and is not blocking other parallel scripts that r/w the same file. However, this will happen as soon as the number of calls per second increase significantly.
That's why I'd like to keep this file open for r/w by any PHP instances without locks or delay by reopening or closing again and again within each script.
Any tip for this? Has this been solved well with sqlite? If yes, I can switch to sqlite.