Guntis asked:
We are using nginx with php-fpm. We plan to make first page static (generate html file). if we have 100 concurrent connections, how we can handle file regeneration? basically we need generate new file index_new.html, then delete index.html, and then move index_new.html to index.html. What happens when index.html file was deleted? User gets 404 error? Or nginx handles file from OS cache? One idea is to tell nginx, that 404 error is index_new.html and then not to move index_new to index, but copy. But i don’t like idea about 404 error.
Thanks.
My answer:
The Unix rename()
system call, which is used by the mv
command, is atomic. So if you use mv index_new.html index.html
then no requests will be missed.
View the full question and any other answers on Server Fault.
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.