repeating sorting is decreasing performance on rebalancing
Bug #1262166 reported by
Nikolay Markov
This bug affects 5 people
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
OpenStack Object Storage (swift) |
Fix Released
|
Undecided
|
Nikolay Markov |
Bug Description
On Ubuntu + Python 2.7 swift rebalance takes up to 8 minutes to complete, instead of 1-2.
/bin/sh -c swift-ring-builder /etc/swift/
Looking through recent changes, I found that complexity and time spent on ring rebalancing was seriously increased with calling sorted() on each iteration through tiers depths
Changed in swift: | |
assignee: | nobody → Nikolay Markov (nmarkov) |
description: | updated |
description: | updated |
Changed in swift: | |
status: | New → Fix Released |
To post a comment you must log in.
It did get quite a bit slower, but now it produces optimally-balanced rings in one try instead of needing many repeated rebalancings, so overall it's probably a win. See commit d3e2cb35db5c9d9 0c35ec6440a9ffd 18f2d33aa4 for more details.
That said, there is some precedent for avoiding sort() calls in the ring builder. There are other places where things are kept in order from least-to- most-desirable, then the most-desirable one is removed with pop(), modified, and reinserted appropriately (using a binary search). That's certainly preferring speed over simplicity.
To see examples of this, look for calls to bisect. bisect_ left() in the ring builder code.