node icon indicating copy to clipboard operation
node copied to clipboard

Support for multiple instances behind load balancer

Open lautarodragan opened this issue 6 years ago • 8 comments

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

lautarodragan avatar Aug 14 '18 18:08 lautarodragan

Assigning to @warrenv.

geoffturk avatar Aug 15 '18 06:08 geoffturk

@lautarodragan and @wzalazar : would we need to replicate this across to frost-api as well?

WesleyCharlesBlake avatar Aug 15 '18 14:08 WesleyCharlesBlake

@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.

lautarodragan avatar Aug 15 '18 15:08 lautarodragan

Awesome! Was just making sure. But yes will need a thorough audit in frost-api . So for in k8s it's been working well.

WesleyCharlesBlake avatar Aug 15 '18 15:08 WesleyCharlesBlake

Reassigning to @kennylavender. Please sync with Warren if you need any input.

geoffturk avatar Sep 21 '18 09:09 geoffturk

Moving this back over to you @warrenv to keep Kenny focused on API and work/claim split. Thanks.

geoffturk avatar Oct 09 '18 16:10 geoffturk

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)

geoffturk avatar Oct 17 '18 11:10 geoffturk

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)

WesleyCharlesBlake avatar Oct 17 '18 12:10 WesleyCharlesBlake