node
node copied to clipboard
Support for multiple instances behind load balancer
Running multiple instances of the node behind a load balancer could lead to race conditions.
https://github.com/poetapp/node/blob/b1ffa5e6ec7a0de6951c13794f5421dcd68920c1/src/Storage/ClaimController.ts#L111-L117
To ensure there are no race conditions we need to use findAndModify and ensure the proper indexes are created.
TODO:
- Find and list all places in code that could lead to race conditions
- List all indexes we're missing
Assigning to @warrenv.
@lautarodragan and @wzalazar : would we need to replicate this across to frost-api as well?
@WesleyCharlesBlake we already have four instances of Frost API behind an LB in production and they have been working fine :sunglasses:
Frost API has much less state in general (since it delegates most operations to the node), but it'd be nice to do a thorough check just to be on the safe side.
Awesome! Was just making sure. But yes will need a thorough audit in frost-api . So for in k8s it's been working well.
Reassigning to @kennylavender. Please sync with Warren if you need any input.
Moving this back over to you @warrenv to keep Kenny focused on API and work/claim split. Thanks.
Running multiple instances of the node behind a load balancer could lead to race conditions.
Is this something we can be testing out in the new QA environment right now? (@WesleyCharlesBlake @lautarodragan)
yeah simple enough to test out, just need to increase the replica count for each node configuration from 1 to n (where n is the ideal amount needed to run optimally)