In single thread mode don't batch
Former-commit-id: b1cb230690a584b8bfe7f433fc0ca0320877ebd3
This commit is contained in:
parent
6a3294ab7b
commit
1b02987b0c
@ -2551,7 +2551,7 @@ void parseClientCommandBuffer(client *c) {
|
||||
}
|
||||
|
||||
/* Prefetch outside the lock for better perf */
|
||||
if (g_pserver->prefetch_enabled && cqueriesStart < c->vecqueuedcmd.size() &&
|
||||
if (g_pserver->prefetch_enabled && cserver.cthreads > 1 && cqueriesStart < c->vecqueuedcmd.size() &&
|
||||
(g_pserver->m_pstorageFactory || aeLockContested(cserver.cthreads/2) || cserver.cthreads == 1) && !GlobalLocksAcquired()) {
|
||||
auto &query = c->vecqueuedcmd.back();
|
||||
if (query.argc > 0 && query.argc == query.argcMax) {
|
||||
@ -2624,7 +2624,7 @@ void readQueryFromClient(connection *conn) {
|
||||
int nread, readlen;
|
||||
size_t qblen;
|
||||
|
||||
serverAssertDebug(FCorrectThread(c) sdfsdf);
|
||||
serverAssertDebug(FCorrectThread(c));
|
||||
serverAssertDebug(!GlobalLocksAcquired());
|
||||
|
||||
AeLocker aelock;
|
||||
@ -2696,9 +2696,16 @@ void readQueryFromClient(connection *conn) {
|
||||
return;
|
||||
}
|
||||
|
||||
parseClientCommandBuffer(c);
|
||||
|
||||
serverTL->vecclientsProcess.push_back(c);
|
||||
if (cserver.cthreads > 1) {
|
||||
parseClientCommandBuffer(c);
|
||||
serverTL->vecclientsProcess.push_back(c);
|
||||
} else {
|
||||
// If we're single threaded its actually better to just process the command here while the query is hot in the cache
|
||||
// multithreaded lock contention dominates and batching is better
|
||||
aeAcquireLock();
|
||||
runAndPropogateToReplicas(processInputBuffer, c, true /*fParse*/, CMD_CALL_FULL);
|
||||
aeReleaseLock();
|
||||
}
|
||||
}
|
||||
|
||||
void processClients()
|
||||
|
Loading…
x
Reference in New Issue
Block a user