Answer the question
In order to leave comments, you need to log in
How to prevent parallel access to the URL at the NGINX level?
Hello!
Let's say there is a location /cron/, which contains all PHP files that should be executed according to the schedule (cron).
Is it possible at the NGINX level when accessing a location to determine "if the URL is active, return the code 429"?
This is necessary to protect against running scripts in parallel.
It is relevant when there is one front-server, followed by several back-servers.
Of course, at the PHP level, I can use Redis to check/save the busy state of the script, but the Redis server is a remote storage and running the script in parallel can be faster than checking/saving the state in Redis.
Thank you!
Answer the question
In order to leave comments, you need to log in
but the Redis server is a remote storage and running the script in parallel can be faster than checking/saving the state in Redis
HTTP is a stateless protocol, without external storage - nothing. It could be a disk file, a radish, whatever.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question