-
Notifications
You must be signed in to change notification settings - Fork 24
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
triton_machine: Introduce new affinity rules feature #42
Conversation
671af14
to
c70e748
Compare
d952fde
to
8d3bcfc
Compare
* Enforce serialized resource creation given affinity rules * Update website documentation
8d3bcfc
to
c9c2b21
Compare
More here... https://apidocs.joyent.com/cloudapi/#830 |
I’m going to submit a follow up PR to move us off of |
} | ||
|
||
if len(affinity) > 0 { | ||
client.affinityLock.Lock() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The following will require some exploration, but it would be good to know when the metadata re: placement is present in Triton. If we put a stutter in here that is sufficiently long so that we pace the rate at which we execute CreateMachine calls, we could actually allow for parallelism while side-stepping the raciness of affinity
within Triton.
Being explicit, if we find that the metadata for the evaluation of affinity
is present within Triton within 1s, then we could stagger the CreateMachine
calls to be paced at a rate of one call per second. This would allow the provider to have concurrent CreateMachine
calls in-flight.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also: this is a suggestion for an optimization in a follow up PR.
* `locality` - (map of Locality hints, Optional) | ||
A mapping of [Locality](https://apidocs.joyent.com/cloudapi/#CreateMachine) attributes to apply to the machine that assist in datacenter placement. NOTE: Locality hints are only used at the time of machine creation and not referenced after. | ||
A mapping of [Locality](https://apidocs.joyent.com/cloudapi/#CreateMachine) attributes to apply to the machine that assist in data center placement. NOTE: Locality hints are only used at the time of machine creation and not referenced after. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, are we a data center
company or a `data center company? Which ever we are, let’s be consistent with the rest of our docs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was an effort to be more consistent in the doc since we were already using "data center". I chose to run with the space.
This can't be merged just yet because CloudAPI is only updated on I'm working on how to handle CloudAPI endpoints that do not support affinity, whether we need some sort of version detection in |
It sounds like CloudAPI was updated across JPC with dependent functionality for this feature (much faster than I anticipated). I confirmed using the following command which shows $ triton profile ls -o name | grep 'us-' | xargs -I % triton -p \% cloudapi /--ping -i 2>&1 | grep server | uniq
server: cloudapi/8.3.0 I'll test again tomorrow and get this PR merged. |
👍 |
Ref: #32 (comment) as well as internal ticket PUBAPI-1428.
Triton team is deprecating
locality
in favor of theaffinity
rules feature ported from Docker API into CloudAPI's CreateMachine endpoint. This is still incoming but we're prepping for the release by integrating with the provider (coming to a CloudAPI near you).We've introduced
affinity
argument totriton_machine
like so...The syntax used for rule definition are publicly documented here.
In order to achieve the desired behavior throughout a DC we've serialized resource creation when affinity rules are present (ht @sean-). If affinity is defined on a set of
triton_machine
resources than each resource will be created one after the other. If a resource has acount > 1
you'll see each resource group created in a serial fashion as well.Here's a configuration that demonstrates some of the interplay between resource definitions and various options for affinity rules.
In the example above we want the following placement...
db
instances to never be placed next to otherdb
("hard" affinity,!=
).web
placed next todb
("soft" affinity,==~
) but never on a CN alongside anotherweb
instance ("soft"!=~
).web
has adepends_on
to ensure it is explicitly dependent upondb
being created first.sidecar
process that can provision anywhere (no affinity).Given this setup and the serial nature of provisioning with
affinity
, bothsidecar
anddb
resources will be created first, followed byweb
after. The following is a list of compute nodes that demonstrate the finalized placement (ordered by creation and CN).ATM I'm still fine tuning documentation, linking to the rule syntax, and acceptance tests but wanted to get this out early.