From ec6c8431249b80989228446921cb3c08d39edb6b Mon Sep 17 00:00:00 2001 From: Evan Tschannen Date: Sat, 16 Mar 2019 16:18:58 -0700 Subject: [PATCH 1/3] increased the GRV client batch size, similarly increased the proxy limits related to the number of transactions started in a batch --- fdbclient/Knobs.cpp | 2 +- fdbserver/Knobs.cpp | 5 +++-- fdbserver/Knobs.h | 1 + fdbserver/MasterProxyServer.actor.cpp | 4 +++- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/fdbclient/Knobs.cpp b/fdbclient/Knobs.cpp index 5168333bb0..1d30370784 100644 --- a/fdbclient/Knobs.cpp +++ b/fdbclient/Knobs.cpp @@ -60,7 +60,7 @@ ClientKnobs::ClientKnobs(bool randomize) { init( SPLIT_KEY_SIZE_LIMIT, KEY_SIZE_LIMIT/2 ); if( randomize && BUGGIFY ) SPLIT_KEY_SIZE_LIMIT = KEY_SIZE_LIMIT - serverKeysPrefixFor(UID()).size() - 1; init( METADATA_VERSION_CACHE_SIZE, 1000 ); - init( MAX_BATCH_SIZE, 20 ); if( randomize && BUGGIFY ) MAX_BATCH_SIZE = 1; // Note that SERVER_KNOBS->START_TRANSACTION_MAX_BUDGET_SIZE is set to match this value + init( MAX_BATCH_SIZE, 1000 ); if( randomize && BUGGIFY ) MAX_BATCH_SIZE = 1; // Note that SERVER_KNOBS->START_TRANSACTION_MAX_BUDGET_SIZE is set to match this value init( GRV_BATCH_TIMEOUT, 0.005 ); if( randomize && BUGGIFY ) GRV_BATCH_TIMEOUT = 0.1; init( LOCATION_CACHE_EVICTION_SIZE, 300000 ); diff --git a/fdbserver/Knobs.cpp b/fdbserver/Knobs.cpp index 0d7122cccf..7064672ef8 100644 --- a/fdbserver/Knobs.cpp +++ b/fdbserver/Knobs.cpp @@ -250,8 +250,9 @@ ServerKnobs::ServerKnobs(bool randomize, ClientKnobs* clientKnobs) { init( START_TRANSACTION_BATCH_INTERVAL_LATENCY_FRACTION, 0.5 ); init( START_TRANSACTION_BATCH_INTERVAL_SMOOTHER_ALPHA, 0.1 ); init( START_TRANSACTION_BATCH_QUEUE_CHECK_INTERVAL, 0.001 ); - init( START_TRANSACTION_MAX_TRANSACTIONS_TO_START, 10000 ); - init( START_TRANSACTION_MAX_BUDGET_SIZE, 20 ); // Currently set to match CLIENT_KNOBS->MAX_BATCH_SIZE + init( START_TRANSACTION_MAX_TRANSACTIONS_TO_START, 500000 ); + init( START_TRANSACTION_MAX_BUDGET_SIZE, 1000 ); // Currently set to match CLIENT_KNOBS->MAX_BATCH_SIZE + init( START_TRANSACTION_MAX_REQUESTS_TO_START, 10000 ); init( COMMIT_TRANSACTION_BATCH_INTERVAL_FROM_IDLE, 0.0005 ); if( randomize && BUGGIFY ) COMMIT_TRANSACTION_BATCH_INTERVAL_FROM_IDLE = 0.005; init( COMMIT_TRANSACTION_BATCH_INTERVAL_MIN, 0.001 ); if( randomize && BUGGIFY ) COMMIT_TRANSACTION_BATCH_INTERVAL_MIN = 0.1; diff --git a/fdbserver/Knobs.h b/fdbserver/Knobs.h index 219a5c89d2..3244818f58 100644 --- a/fdbserver/Knobs.h +++ b/fdbserver/Knobs.h @@ -199,6 +199,7 @@ public: double START_TRANSACTION_BATCH_QUEUE_CHECK_INTERVAL; double START_TRANSACTION_MAX_TRANSACTIONS_TO_START; double START_TRANSACTION_MAX_BUDGET_SIZE; + int START_TRANSACTION_MAX_REQUESTS_TO_START; double COMMIT_TRANSACTION_BATCH_INTERVAL_FROM_IDLE; double COMMIT_TRANSACTION_BATCH_INTERVAL_MIN; diff --git a/fdbserver/MasterProxyServer.actor.cpp b/fdbserver/MasterProxyServer.actor.cpp index 07c0a8a533..3886f18ed5 100644 --- a/fdbserver/MasterProxyServer.actor.cpp +++ b/fdbserver/MasterProxyServer.actor.cpp @@ -1156,7 +1156,8 @@ ACTOR static Future transactionStarter( double leftToStart = 0; double batchLeftToStart = 0; - while (!transactionQueue.empty()) { + int requestsToStart = 0; + while (!transactionQueue.empty() && requestsToStart < SERVER_KNOBS->START_TRANSACTION_MAX_REQUESTS_TO_START) { auto& req = transactionQueue.top().first; int tc = req.transactionCount; @@ -1182,6 +1183,7 @@ ACTOR static Future transactionStarter( start[req.flags & 1].push_back(std::move(req)); static_assert(GetReadVersionRequest::FLAG_CAUSAL_READ_RISKY == 1, "Implementation dependent on flag value"); transactionQueue.pop(); + requestsToStart++; } if (!transactionQueue.empty()) From 87e2a1a0297b3786533cf93aad3c387418264c3c Mon Sep 17 00:00:00 2001 From: Evan Tschannen Date: Mon, 18 Mar 2019 16:09:57 -0700 Subject: [PATCH 2/3] The proxy budget is implemented to let one request over its limit through, and then pay back what was over the limit in the next update --- fdbclient/Knobs.cpp | 2 +- fdbserver/Knobs.cpp | 1 - fdbserver/Knobs.h | 1 - fdbserver/MasterProxyServer.actor.cpp | 16 +++++++--------- 4 files changed, 8 insertions(+), 12 deletions(-) diff --git a/fdbclient/Knobs.cpp b/fdbclient/Knobs.cpp index 1d30370784..344220249f 100644 --- a/fdbclient/Knobs.cpp +++ b/fdbclient/Knobs.cpp @@ -60,7 +60,7 @@ ClientKnobs::ClientKnobs(bool randomize) { init( SPLIT_KEY_SIZE_LIMIT, KEY_SIZE_LIMIT/2 ); if( randomize && BUGGIFY ) SPLIT_KEY_SIZE_LIMIT = KEY_SIZE_LIMIT - serverKeysPrefixFor(UID()).size() - 1; init( METADATA_VERSION_CACHE_SIZE, 1000 ); - init( MAX_BATCH_SIZE, 1000 ); if( randomize && BUGGIFY ) MAX_BATCH_SIZE = 1; // Note that SERVER_KNOBS->START_TRANSACTION_MAX_BUDGET_SIZE is set to match this value + init( MAX_BATCH_SIZE, 1000 ); if( randomize && BUGGIFY ) MAX_BATCH_SIZE = 1; init( GRV_BATCH_TIMEOUT, 0.005 ); if( randomize && BUGGIFY ) GRV_BATCH_TIMEOUT = 0.1; init( LOCATION_CACHE_EVICTION_SIZE, 300000 ); diff --git a/fdbserver/Knobs.cpp b/fdbserver/Knobs.cpp index 7064672ef8..ee5cd8d574 100644 --- a/fdbserver/Knobs.cpp +++ b/fdbserver/Knobs.cpp @@ -251,7 +251,6 @@ ServerKnobs::ServerKnobs(bool randomize, ClientKnobs* clientKnobs) { init( START_TRANSACTION_BATCH_INTERVAL_SMOOTHER_ALPHA, 0.1 ); init( START_TRANSACTION_BATCH_QUEUE_CHECK_INTERVAL, 0.001 ); init( START_TRANSACTION_MAX_TRANSACTIONS_TO_START, 500000 ); - init( START_TRANSACTION_MAX_BUDGET_SIZE, 1000 ); // Currently set to match CLIENT_KNOBS->MAX_BATCH_SIZE init( START_TRANSACTION_MAX_REQUESTS_TO_START, 10000 ); init( COMMIT_TRANSACTION_BATCH_INTERVAL_FROM_IDLE, 0.0005 ); if( randomize && BUGGIFY ) COMMIT_TRANSACTION_BATCH_INTERVAL_FROM_IDLE = 0.005; diff --git a/fdbserver/Knobs.h b/fdbserver/Knobs.h index 3244818f58..ee881c889d 100644 --- a/fdbserver/Knobs.h +++ b/fdbserver/Knobs.h @@ -198,7 +198,6 @@ public: double START_TRANSACTION_BATCH_INTERVAL_SMOOTHER_ALPHA; double START_TRANSACTION_BATCH_QUEUE_CHECK_INTERVAL; double START_TRANSACTION_MAX_TRANSACTIONS_TO_START; - double START_TRANSACTION_MAX_BUDGET_SIZE; int START_TRANSACTION_MAX_REQUESTS_TO_START; double COMMIT_TRANSACTION_BATCH_INTERVAL_FROM_IDLE; diff --git a/fdbserver/MasterProxyServer.actor.cpp b/fdbserver/MasterProxyServer.actor.cpp index 3886f18ed5..74ff3d2848 100644 --- a/fdbserver/MasterProxyServer.actor.cpp +++ b/fdbserver/MasterProxyServer.actor.cpp @@ -1069,22 +1069,20 @@ ACTOR Future fetchVersions(ProxyCommitData *commitData) { struct TransactionRateInfo { double rate; - double budget; - double limit; - TransactionRateInfo(double rate) : rate(rate), budget(0), limit(0) {} + TransactionRateInfo(double rate) : rate(rate), limit(0) {} void reset(double elapsed) { - this->limit = std::min(rate * elapsed, SERVER_KNOBS->START_TRANSACTION_MAX_TRANSACTIONS_TO_START) + budget; + limit = std::min(0.0,limit) + std::min(rate * elapsed, SERVER_KNOBS->START_TRANSACTION_MAX_TRANSACTIONS_TO_START); } - bool canStart(int64_t numToStart, int64_t numAlreadyStarted) { - return numToStart + numAlreadyStarted < limit || numToStart * g_random->random01() + numAlreadyStarted < limit - std::max(0.0, budget); + bool canStart(int64_t numAlreadyStarted) { + return numAlreadyStarted < limit; } void updateBudget(int64_t numStarted) { - budget = std::max(std::min(limit - numStarted, SERVER_KNOBS->START_TRANSACTION_MAX_BUDGET_SIZE), -SERVER_KNOBS->START_TRANSACTION_MAX_BUDGET_SIZE); + limit -= numStarted; } }; @@ -1161,10 +1159,10 @@ ACTOR static Future transactionStarter( auto& req = transactionQueue.top().first; int tc = req.transactionCount; - if(req.priority() < GetReadVersionRequest::PRIORITY_DEFAULT && !batchRateInfo.canStart(tc, transactionsStarted[0] + transactionsStarted[1])) { + if(req.priority() < GetReadVersionRequest::PRIORITY_DEFAULT && !batchRateInfo.canStart(transactionsStarted[0] + transactionsStarted[1])) { break; } - else if(req.priority() < GetReadVersionRequest::PRIORITY_SYSTEM_IMMEDIATE && !normalRateInfo.canStart(tc, transactionsStarted[0] + transactionsStarted[1])) { + else if(req.priority() < GetReadVersionRequest::PRIORITY_SYSTEM_IMMEDIATE && !normalRateInfo.canStart(transactionsStarted[0] + transactionsStarted[1])) { break; } From 2554fed96550d5a10be9417d64dcbfa69b50b625 Mon Sep 17 00:00:00 2001 From: Evan Tschannen Date: Mon, 18 Mar 2019 16:16:03 -0700 Subject: [PATCH 3/3] reduce max transaction to start --- fdbserver/Knobs.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fdbserver/Knobs.cpp b/fdbserver/Knobs.cpp index ee5cd8d574..76758345c1 100644 --- a/fdbserver/Knobs.cpp +++ b/fdbserver/Knobs.cpp @@ -250,7 +250,7 @@ ServerKnobs::ServerKnobs(bool randomize, ClientKnobs* clientKnobs) { init( START_TRANSACTION_BATCH_INTERVAL_LATENCY_FRACTION, 0.5 ); init( START_TRANSACTION_BATCH_INTERVAL_SMOOTHER_ALPHA, 0.1 ); init( START_TRANSACTION_BATCH_QUEUE_CHECK_INTERVAL, 0.001 ); - init( START_TRANSACTION_MAX_TRANSACTIONS_TO_START, 500000 ); + init( START_TRANSACTION_MAX_TRANSACTIONS_TO_START, 100000 ); init( START_TRANSACTION_MAX_REQUESTS_TO_START, 10000 ); init( COMMIT_TRANSACTION_BATCH_INTERVAL_FROM_IDLE, 0.0005 ); if( randomize && BUGGIFY ) COMMIT_TRANSACTION_BATCH_INTERVAL_FROM_IDLE = 0.005;