Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds support for weighted lock #35

Open
loganmzz opened this issue Feb 28, 2018 · 0 comments
Open

Adds support for weighted lock #35

loganmzz opened this issue Feb 28, 2018 · 0 comments

Comments

@loganmzz
Copy link

Description

Sometime a resource (as in lock management) can be split into sub-part. For example, Cloud Foundry quota, nodes in a distributed architecture, ...

So, it will be nice to support easily such kind of lock.

Proposal

Solution 1 : Pool metadata

Pool directory may contain metadata which describe pool & lock capacities. When acquired, lock weight may be specified and recorded into new file. When released, lock weight is read from same file.

Note: When lock weight isn't specified, all capacity is assumed.

Solution 2 : Multi acquire/release (simplest)

Users have to create enough locks as pool capacity. acquire now accepts a number (or adds acquire_count). A new count file is generated providing lock count (and/or a names file with lock names). Then, name.<index> and metadata.<index> are generated as existing.

release doesn't change signature but support new directory structure.

Workaround

Currently I use as enough lock as necessary.

But need:

  • to split into a reasonable amount of locks. For example, I divided my 10240 MB Cloud Foundry quota into 40 slots of 256 MB ; while static web component only requires 64 MB.
  • to add enough put to acquire/release (not also being sure how to arrange release in order to be sure they are all correctly release in all cases)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant