Support batching up commands #48
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When you have around 60 baremetal nodes attached to a single switch, it
takes a long time to execute all those commands. This gets worse when
you limit the number of concurrent ssh connections.
Here we look to batch up commands to send to the switch together using a
single connection. The results of each port's commands are returned when
available.
This is implemented using etcd as a queueing system. Commands are added
to an input key, then a worker thread processes the available commands
for a particular switch device. We pull off the queue using the version
at which the keys were added, giving a FIFO style queue. The result of
each command set are added to an output key, which the original request
thread is watching. Distributed locks are used to serialise the
processing of commands for each switch device.
Various neat etcd features are used here to alleviate some of the issues
of distributed task coordination, including transactions, leases,
watches, historical key/value tracking, etc.
Co-Authored-By: Mark Goddard mark@stackhpc.com
Change-Id: I8c458bbc94df5630cfede5434bcdbe527988059c
(cherry picked from commit a915d2b39273c8c65eee4346d6ac4552ef170fd6)