I have a website and part of my website needs to read/write a plain text file on server. most of the time we have between 50 to 100 concurrent online users and their actions on our site result to read/write certain file in which that is a temporary place holder for some other pages.
So I want to know about concurrent read/write conflicts and what’s the best practice to avoid that if that happened. How does my server manage these requests?
Of more importance than the webserver is the underlying OS and filesystem.
You can (in supported circumstances) obtain an exclusive lock on a file handle in PHP using flock() causing all other attempts at an exclusive lock to block and stack behind it.