nexrender icon indicating copy to clipboard operation
nexrender copied to clipboard

Add option for the optimistic locking in nexrender-server when using Redis

Open ivansenic opened this issue 3 years ago • 2 comments

Is your feature request related to a problem? Please describe. We are trying to run multiple instances of the nexrender-server in order to have more performance and stability overall. We are splitting those instances in different availability zones, to avoid failure in case a zone is down. However, we have noticed that in such setup, some jobs can be picked up by two workers. In general, this is not a huge issue at the moment as both workers would actually render the same job and give the same output, but it would be nice to overcome this and always have one worker picking up.

Describe the solution you'd like In order to do this, we should implement a optimistic locking when Redis is used. This way only one worker would be able to pick up a job. More info: https://redis.io/docs/manual/transactions/#optimistic-locking-using-check-and-set

Describe alternatives you've considered None.

Additional context I would be up in contributing this. I would also enable it on the environment variable only, and use current behavior as the default one. In case when the check and set fails, I would suggest that the pickup responds in the same way as if there is no available job, or re-try.

ivansenic avatar Jun 22 '22 16:06 ivansenic

Hey @ivansenic 👋

That sounds amazing. I did not see a possibility of using multiple nexrender-servers in combination.

Any contribution is highly welcomed, especially something complex like that!

inlife avatar Jun 24 '22 06:06 inlife

Great.. I'll try to post the PR as soon as I find some free time..

ivansenic avatar Jun 24 '22 06:06 ivansenic

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Aug 31 '22 02:08 stale[bot]