aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordec05eba <0xdec05eba@gmail.com>2018-05-20 11:14:16 +0200
committerdec05eba <0xdec05eba@gmail.com>2018-05-20 11:14:18 +0200
commite46344de86b92da7bb8c6e82c8f668fa5d20357c (patch)
tree82a548c4b30c034c618b51cb3413d14db6f7a406
parent279969f2da1f334c77a38153ae809c985d060bb2 (diff)
Update memory usage test
-rw-r--r--src/Database.cpp3
-rw-r--r--tests/main.cpp7
2 files changed, 7 insertions, 3 deletions
diff --git a/src/Database.cpp b/src/Database.cpp
index 918cd4e..140ca85 100644
--- a/src/Database.cpp
+++ b/src/Database.cpp
@@ -122,12 +122,13 @@ namespace odhtdb
/*.proxy_server = */"",
/*.push_node_id = */""
});
+ node.setStorageLimit(1024 * 1024 * 1); // 1 Megabyte
auto portStr = to_string(port);
node.bootstrap(bootstrapNodeAddr, portStr.c_str());
const auto &remoteNodes = databaseStorage.getRemoteNodes();
if(!remoteNodes.empty())
node.bootstrap(remoteNodes);
- Log::debug("Connecting to bootstrap node (%s) and %u other known nodes that we have connected to previously", bootstrapNodeAddr, remoteNodes.size());
+ Log::debug("Connecting to bootstrap node (%s) and %u other known nodes that we have connected to previously with port %d", bootstrapNodeAddr, remoteNodes.size(), port);
// TODO: Make this work for multiple threads initializing database at same time
++databaseCount;
diff --git a/tests/main.cpp b/tests/main.cpp
index eaaa7ea..6a74548 100644
--- a/tests/main.cpp
+++ b/tests/main.cpp
@@ -372,12 +372,15 @@ void testMemoryUsage()
auto adminUserKey = databaseCreateResponse->getNodeAdminKeyPair();
database.seed(databaseNode);
+ const char *msg = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.";
+ const usize msgLength = strlen(msg);
+
const int iterations = 500;
for(int i = 0; i < iterations; ++i)
{
Log::debug("Memory usage test %d/%d", 1 + i, iterations);
- database.addData(databaseNode, *adminUserKey, DataView{ (void*)"hello, world!", 13 });
- this_thread::sleep_for(chrono::milliseconds(50));
+ database.addData(databaseNode, *adminUserKey, DataView{ (void*)msg, msgLength });
+ this_thread::sleep_for(chrono::milliseconds(250));
}
}