diff options
author | unknown <mronstrom@mysql.com> | 2005-01-31 18:11:26 +0100 |
---|---|---|
committer | unknown <mronstrom@mysql.com> | 2005-01-31 18:11:26 +0100 |
commit | 0a507d2cf1244d67dbe702343d34b3ff78089374 (patch) | |
tree | 1bf7e7191e2c346caef7e064b1f9a863908cad0b /ndb | |
parent | 4faf77a9fe079dde6d9f8f563a5eb10fba44c87f (diff) | |
download | mariadb-git-0a507d2cf1244d67dbe702343d34b3ff78089374.tar.gz |
Fixed a bug in the ndbd scheduler with send of packed signals.
Fixing this bugs improves performance by 40% for very small read
statements and with 12-13 % for very simple updating transactions
(flexBench -o 10000) in single threaded application. Removes a fixed
cost of around 100.000 cycles every time the ndbd process wakes up to
execute some queries.
ndb/src/kernel/vm/FastScheduler.cpp:
Integrate sendPacked into doJob
The lack of integration meant that several loops in
ipControlLoop were executed each time the ndbd process
woke up, also for reads it meant that response was divided
in two TCP/IP packets
Is necessary to integrate this with overload protection
ndb/src/kernel/vm/ThreadConfig.cpp:
Integrate sendPacked into doJob
The lack of integration meant that several loops in
ipControlLoop were executed each time the ndbd process
woke up, also for reads it meant that response was divided
in two TCP/IP packets
Is necessary to integrate this with overload protection
Diffstat (limited to 'ndb')
-rw-r--r-- | ndb/src/kernel/vm/FastScheduler.cpp | 33 | ||||
-rw-r--r-- | ndb/src/kernel/vm/ThreadConfig.cpp | 3 |
2 files changed, 22 insertions, 14 deletions
diff --git a/ndb/src/kernel/vm/FastScheduler.cpp b/ndb/src/kernel/vm/FastScheduler.cpp index eca456d26dd..d05c02360a7 100644 --- a/ndb/src/kernel/vm/FastScheduler.cpp +++ b/ndb/src/kernel/vm/FastScheduler.cpp @@ -76,19 +76,26 @@ FastScheduler::activateSendPacked() globalData.loopMax = 2048; }//FastScheduler::activateSendPacked() +//------------------------------------------------------------------------ +// sendPacked is executed at the end of the loop. +// To ensure that we don't send any messages before executing all local +// packed signals we do another turn in the loop (unless we have already +// executed too many signals in the loop). +//------------------------------------------------------------------------ void FastScheduler::doJob() { + Uint32 init_loopCount = 0; + Uint32 TminLoops = getBOccupancy() + EXTRA_SIGNALS_PER_DO_JOB; + Uint32 TloopMax = (Uint32)globalData.loopMax; + if (TminLoops < TloopMax) { + TloopMax = TminLoops; + }//if + if (TloopMax < MIN_NUMBER_OF_SIG_PER_DO_JOB) { + TloopMax = MIN_NUMBER_OF_SIG_PER_DO_JOB; + }//if do{ - Uint32 loopCount = 0; - Uint32 TminLoops = getBOccupancy() + EXTRA_SIGNALS_PER_DO_JOB; - Uint32 TloopMax = (Uint32)globalData.loopMax; - if (TminLoops < TloopMax) { - TloopMax = TminLoops; - }//if - if (TloopMax < MIN_NUMBER_OF_SIG_PER_DO_JOB) { - TloopMax = MIN_NUMBER_OF_SIG_PER_DO_JOB; - }//if + Uint32 loopCount = init_loopCount; register Uint32 tHighPrio = globalData.highestAvailablePrio; register Signal* signal = getVMSignals(); while ((tHighPrio < LEVEL_IDLE) && (loopCount < TloopMax)) { @@ -151,7 +158,7 @@ FastScheduler::doJob() if (globalData.sendPackedActivated == 1) { Uint32 t1 = theDoJobTotalCounter; Uint32 t2 = theDoJobCallCounter; - t1 += loopCount; + t1 += (loopCount - init_loopCount); t2++; theDoJobTotalCounter = t1; theDoJobCallCounter = t2; @@ -161,7 +168,11 @@ FastScheduler::doJob() theDoJobTotalCounter = 0; }//if }//if - } while (getBOccupancy() > MAX_OCCUPANCY); + init_loopCount = loopCount; + sendPacked(); + } while ((getBOccupancy() > MAX_OCCUPANCY) || + ((init_loopCount < TloopMax) && + (globalData.highestAvailablePrio < LEVEL_IDLE))); }//FastScheduler::doJob() void FastScheduler::sendPacked() diff --git a/ndb/src/kernel/vm/ThreadConfig.cpp b/ndb/src/kernel/vm/ThreadConfig.cpp index 4844bb9a477..76fcc4ba84f 100644 --- a/ndb/src/kernel/vm/ThreadConfig.cpp +++ b/ndb/src/kernel/vm/ThreadConfig.cpp @@ -173,9 +173,6 @@ void ThreadConfig::ipControlLoop() // until all buffers are empty or until we have executed 2048 signals. //-------------------------------------------------------------------- globalScheduler.doJob(); - - globalScheduler.sendPacked(); - }//while globalData.incrementWatchDogCounter(6); |