Coder Social home page Coder Social logo

Comments (4)

kamaradclimber avatar kamaradclimber commented on June 1, 2024 1

Suggested algorithm looks ok to me.

I'm a bit concerned by how this will be used: if I use the "rack" mode, I would still need to specif the concurrency level for nodes (but default case would be to allow the full rack whatever its size).

I would suggest to subclass ConsulLock to:

  • use the rack name as the consul lock id (we usually set it to the node name)
  • by default concurrency is 1 which corresponds to 1 rack allowed at a time
  • we add a new field by holder (by rack) containing the list of nodes in that rack using the lock

{"version":1,"concurrency":1,"holders":{"rack1": "today"}, rack1: {"node1": "today"}}

your algorithm still holds: we maintain the list of nodes in the rack using the lock and release the lock only when this list is empty.

It supports correctly the possiblity to have multiple racks under the lock (default to 1) and allow unlimited number of nodes in the same rack to be in the lock.

What do you think?

from choregraphie.

ashangit avatar ashangit commented on June 1, 2024

Fine for me I will just use a json like that one to be able to easily get all holder by racks:
{"version":1,"concurrency":1,"holders":{"rack1": "today"}, "racks": {"rack1": {"node1": "today"}}}

from choregraphie.

ashangit avatar ashangit commented on June 1, 2024

As seen with @Annih we are thinking of using this structure instead to still have nodes has holders:
{"version":1,"holders":{"node1": {"ts": "today", "rack": "rack1", "concurrency":1}}

from choregraphie.

kamaradclimber avatar kamaradclimber commented on June 1, 2024

fine by me. Note that this is an upgrade of the format so bump the version

from choregraphie.

Related Issues (3)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.