[SERVER-19189] Improve performance under high number of threads with WT Created: 29/Jun/15 Updated: 19/Sep/15 Resolved: 20/Jul/15 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | WiredTiger |
| Affects Version/s: | None |
| Fix Version/s: | 3.0.5, 3.1.6 |
| Type: | Task | Priority: | Major - P3 |
| Reporter: | Martin Bligh | Assignee: | Martin Bligh |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Attachments: |
|
||||||||||||||||||||||||
| Issue Links: |
|
||||||||||||||||||||||||
| Backwards Compatibility: | Fully Compatible | ||||||||||||||||||||||||
| Backport Completed: | |||||||||||||||||||||||||
| Sprint: | Quint Iteration 6 | ||||||||||||||||||||||||
| Participants: | |||||||||||||||||||||||||
| Comments |
| Comment by Githook User [ 10/Jul/15 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Author: {u'username': u'martinbligh', u'name': u'Martin Bligh', u'email': u'mbligh@mongodb.com'}Message: (cherry picked from commit 47b6b1a8fd60b0365f72c0550269c0dc0322acfd) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Githook User [ 10/Jul/15 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Author: {u'username': u'martinbligh', u'name': u'Martin Bligh', u'email': u'mbligh@mongodb.com'}Message: can race with epoch++ and end up with us putting an old (cherry picked from commit 2256dfa40676c48788265d241f7fa18ac0d0b322) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Githook User [ 10/Jul/15 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Author: {u'username': u'martinbligh', u'name': u'Martin Bligh', u'email': u'mbligh@mongodb.com'}Message: Technically it's illegal to check this outside the lock, though it's heuristic (cherry picked from commit 90f72ea0b819335e55a6ddd147d5c8d4afa3c988) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Michael Cahill (Inactive) [ 10/Jul/15 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
btw martin.bligh, the WT_SESSION::reset call is in MongoDB master, we can try having releaseSession call that on the cached session in the Client in your patch? | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Michael Cahill (Inactive) [ 10/Jul/15 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Testing the 3.0 backport here: https://evergreen.mongodb.com/version/559f4aa23ff122536500011c_0 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Githook User [ 10/Jul/15 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Author: {u'username': u'martinbligh', u'name': u'Martin Bligh', u'email': u'mbligh@mongodb.com'}Message: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Michael Cahill (Inactive) [ 08/Jul/15 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
When these changes are settled, they should be backported to 3.0. I'm happy to take that on. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Alexander Gorrod [ 08/Jul/15 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
martin.bligh I suppose the consequence of removing the counters is that there is no bound on how many sessions are cached. It seems to me as though having a cap is a good idea, maybe we could eventually replace it with a utility thread that maintains the session cache (i.e: removes and closes sessions from the cache if they aren't being regularly used). Also I've got most of a change around to switch from using a std::vector to a simple linked list for the session cache. I found that it reduces the amount of time the lock is held. Are you still seeing contention on the _cacheLock with the latest version of the code? If so is it worth me updating that patch and sharing it? | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Githook User [ 07/Jul/15 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Author: {u'username': u'martinbligh', u'name': u'Martin Bligh', u'email': u'mbligh@mongodb.com'}Message: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Chad Kreimendahl [ 06/Jul/15 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
I'm not sure on https://github.com/mongodb/mongo/commit/90f72ea0b819335e55a6ddd147d5c8d4afa3c988 why it's "illegal" to check outside of a lock. If it's thread safe (seeing if it's set), then that's actually a good practice to entirely avoid a lock if, in most scenarios, that's going to be set. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Githook User [ 06/Jul/15 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Author: {u'username': u'martinbligh', u'name': u'Martin Bligh', u'email': u'mbligh@mongodb.com'}Message: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Githook User [ 06/Jul/15 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Author: {u'username': u'martinbligh', u'name': u'Martin Bligh', u'email': u'mbligh@mongodb.com'}Message: can race with epoch++ and end up with us putting an old | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Githook User [ 06/Jul/15 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Author: {u'username': u'martinbligh', u'name': u'Martin Bligh', u'email': u'mbligh@mongodb.com'}Message: Technically it's illegal to check this outside the lock, though it's heuristic | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Bruce Lucas (Inactive) [ 03/Jul/15 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Further potential improvement in WT journaling here. Performance with journaling enabled at high thread count improved 3x over base 3.0.4, peak performance improved 15%. Still however pending review and testing for functional correctness. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Githook User [ 02/Jul/15 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Author: {u'username': u'martinbligh', u'name': u'Martin Bligh', u'email': u'mbligh@mongodb.com'}Message: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Bruce Lucas (Inactive) [ 02/Jul/15 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
On | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Martin Bligh [ 02/Jul/15 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
No oplogStones patch - this was virgin top of tree. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Michael Cahill (Inactive) [ 02/Jul/15 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
martin.bligh, I'm still absorbing this – one question, are the oplog numbers quoted here with the oplogStones changes from Happy to drill into bottlenecks in logging, but it seems like we should get the session caching layer right first. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Martin Bligh [ 01/Jul/15 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
We were discussing converting the spinlock to a stdx::mutex, but that's actually slower (a little surprising since it seems heavily contended, but if hold time < 2 context switches, probably makes sense). | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Martin Bligh [ 01/Jul/15 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Tried the column store thing for amusement, but it actually seems slower on this: 1:54370 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Martin Bligh [ 01/Jul/15 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
geert.bosch michael.cahill 1. Stats in ~OldClientContext I've tried killing 1 & 2, we just hit the next bottlenecks, but will keep applying hatchet. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Martin Bligh [ 01/Jul/15 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Overall perf numbers with 128 threads. With oplog => single node replica set
Note not much difference from journal vs not with oplog => oplog is the bigger bottleneck Scaling, no oplog, no journal 1:58340 Scaling, no oplog, journal 1:36069 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Martin Bligh [ 01/Jul/15 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
w/o journal, confirming the sched_yield disappears.
And without oplog / rs:
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Martin Bligh [ 01/Jul/15 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
michael.cahill looks like we still have a lot of sched_yield that's causing far more context switches than the cache mutex
Context switch profile (ie perf -e context-switches)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by David Daly [ 30/Jun/15 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
This ticket should help |