From e6c3d42e02a0aa3f1209610dcf6e1bdfea300f48 Mon Sep 17 00:00:00 2001 From: Matej Ferencevic <matej.ferencevic@memgraph.io> Date: Thu, 5 Oct 2017 21:32:04 +0200 Subject: [PATCH] Changed long running stress parameters. Summary: Increased query execution timeout. Enabled global queries by default. Implemented faster RandomElement for vertices and edges. Changed long running verify message format. Changed vertex and edge count to be per worker. Reviewers: mislav.bradac Reviewed By: mislav.bradac Subscribers: pullbot Differential Revision: https://phabricator.memgraph.io/D864 --- config/stress.conf | 2 ++ tests/stress/continuous_integration | 8 ++++---- tests/stress/long_running.cpp | 32 ++++++++++++++++------------- 3 files changed, 24 insertions(+), 18 deletions(-) diff --git a/config/stress.conf b/config/stress.conf index 69e63d465..6ab3d9617 100644 --- a/config/stress.conf +++ b/config/stress.conf @@ -24,3 +24,5 @@ # database recovering is disabled by default --snapshot-recover-on-startup=false +# increase query timeout (10 min) +--query-execution-time-sec=600 diff --git a/tests/stress/continuous_integration b/tests/stress/continuous_integration index 502129d59..e1347a5db 100755 --- a/tests/stress/continuous_integration +++ b/tests/stress/continuous_integration @@ -28,12 +28,12 @@ SMALL_DATASET = [ }, { "test": "long_running.cpp", - "options": ["--vertex-count", "1000", "--edge-count", "1000", "--max-time", "1", "--verify", "20"], + "options": ["--vertex-count", "1000", "--edge-count", "5000", "--max-time", "1", "--verify", "20"], "timeout": 5, }, { "test": "long_running.cpp", - "options": ["--vertex-count", "1000", "--edge-count", "1000", "--max-time", "2", "--verify", "30"], + "options": ["--vertex-count", "10000", "--edge-count", "50000", "--max-time", "2", "--verify", "30"], "timeout": 5, }, ] @@ -56,13 +56,13 @@ LARGE_DATASET = [ ] + [ { "test": "long_running.cpp", - "options": ["--vertex-count", "100000", "--edge-count", "100000", "--max-time", "5", "--verify", "60"], + "options": ["--vertex-count", "10000", "--edge-count", "40000", "--max-time", "5", "--verify", "60"], "timeout": 8, }, ] * 6 + [ { "test": "long_running.cpp", - "options": ["--vertex-count", "100000", "--edge-count", "20000000", "--max-time", "480", "--verify", "300"], + "options": ["--vertex-count", "1000000", "--edge-count", "4000000", "--max-time", "480", "--verify", "300"], "timeout": 500, }, ] diff --git a/tests/stress/long_running.cpp b/tests/stress/long_running.cpp index 63aa7af2a..8599faeae 100644 --- a/tests/stress/long_running.cpp +++ b/tests/stress/long_running.cpp @@ -20,15 +20,17 @@ DEFINE_string(port, "7687", "Server port"); DEFINE_string(username, "", "Username for the database"); DEFINE_string(password, "", "Password for the database"); -DEFINE_int32(vertex_count, 0, "The average number of vertices in the graph"); -DEFINE_int32(edge_count, 0, "The average number of edges in the graph"); +DEFINE_int32(vertex_count, 0, + "The average number of vertices in the graph per worker"); +DEFINE_int32(edge_count, 0, + "The average number of edges in the graph per worker"); DEFINE_int32(prop_count, 5, "The max number of properties on a node"); DEFINE_uint64(max_queries, 1 << 30, "Maximum number of queries to execute"); DEFINE_int32(max_time, 1, "Maximum execution time in minutes"); DEFINE_int32(verify, 0, "Interval (seconds) between checking local info"); DEFINE_int32(worker_count, 1, "The number of workers that operate on the graph independently"); -DEFINE_bool(global_queries, false, +DEFINE_bool(global_queries, true, "If queries that modifiy globally should be executed sometimes"); /** @@ -83,8 +85,14 @@ class GraphSession { bool Bernoulli(double p) { return GetRandom() < p; } - template <typename T> - T RandomElement(std::set<T> &data) { + uint64_t RandomElement(std::set<uint64_t> &data) { + uint64_t min = *data.begin(), max = *data.rbegin(); + uint64_t val = std::floor(GetRandom() * (max - min) + min); + auto it = data.lower_bound(val); + return *it; + } + + std::string RandomElement(std::set<std::string> &data) { uint64_t pos = std::floor(GetRandom() * data.size()); auto it = data.begin(); std::advance(it, pos); @@ -264,8 +272,7 @@ class GraphSession { // generate report std::ostringstream report; - report << std::endl - << fmt::format("Runner {} graph verification success:", id_) + report << fmt::format("Runner {} graph verification success:", id_) << std::endl << fmt::format("\tExecuted {} queries in {:.2f} seconds", executed_queries_, timer_.Elapsed().count()) @@ -290,14 +297,11 @@ class GraphSession { public: void Run() { - uint64_t vertex_count = FLAGS_vertex_count / FLAGS_worker_count; - uint64_t edge_count = FLAGS_edge_count / FLAGS_worker_count; - // initial vertex creation - CreateVertices(vertex_count); + CreateVertices(FLAGS_vertex_count); // initial edge creation - CreateEdges(edge_count); + CreateEdges(FLAGS_edge_count); if (FLAGS_verify > 0) VerifyGraph(); double last_verify = timer_.Elapsed().count(); @@ -311,8 +315,8 @@ class GraphSession { last_verify = timer_.Elapsed().count(); } - double ratio_e = (double)edges_.size() / (double)edge_count; - double ratio_v = (double)vertices_.size() / (double)vertex_count; + double ratio_e = (double)edges_.size() / (double)FLAGS_edge_count; + double ratio_v = (double)vertices_.size() / (double)FLAGS_vertex_count; // try to edit vertices globally if (FLAGS_global_queries) {