8000 added test by jsteemann · Pull Request #4840 · arangodb/arangodb · GitHub
[go: up one dir, main page]

Skip to content

added test #4840

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Mar 14, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8000 Next Next commit
added test
  • Loading branch information
jsteemann committed Mar 14, 2018
commit 1daf84e9d613d6a6d00763d489fbf97e1af6f4f3
1 change: 1 addition & 0 deletions arangosh/Benchmark/BenchFeature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ void BenchFeature::collectOptions(std::shared_ptr<ProgramOptions> options) {
new BooleanParameter(&_waitForSync));

std::unordered_set<std::string> cases = {"version",
"stream-cursor",
"document",
"collection",
"import-document",
Expand Down
100 changes: 64 additions & 36 deletions arangosh/Benchmark/test-cases.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@ static bool CreateIndex(SimpleHttpClient*, std::string const&,
struct VersionTest : public BenchmarkOperation {
VersionTest() : BenchmarkOperation() { _url = "/_api/version"; }

~VersionTest() {}

bool setUp(SimpleHttpClient* client) override { return true; }

void tearDown() override {}
Expand Down Expand Up @@ -70,8 +68,6 @@ struct VersionTest : public BenchmarkOperation {
struct DocumentCrudAppendTest : public BenchmarkOperation {
DocumentCrudAppendTest() : BenchmarkOperation() {}

~DocumentCrudAppendTest() {}

bool setUp(SimpleHttpClient* client) override {
return DeleteCollection(client, ARANGOBENCH->collection()) &&
CreateCollection(client, ARANGOBENCH->collection(), 2);
Expand Down Expand Up @@ -162,8 +158,6 @@ struct DocumentCrudAppendTest : public BenchmarkOperation {
struct DocumentCrudWriteReadTest : public BenchmarkOperation {
DocumentCrudWriteReadTest() : BenchmarkOperation() {}

~DocumentCrudWriteReadTest() {}

bool setUp(SimpleHttpClient* client) override {
return DeleteCollection(client, ARANGOBENCH->collection()) &&
CreateCollection(client, ARANGOBENCH->collection(), 2);
Expand Down Expand Up @@ -240,8 +234,6 @@ struct DocumentCrudWriteReadTest : public BenchmarkOperation {
struct ShapesTest : public BenchmarkOperation {
ShapesTest() : BenchmarkOperation() {}

~ShapesTest() {}

bool setUp(SimpleHttpClient* client) override {
return DeleteCollection(client, ARANGOBENCH->collection()) &&
CreateCollection(client, ARANGOBENCH->collection(), 2);
Expand Down Expand Up @@ -327,8 +319,6 @@ struct ShapesTest : public BenchmarkOperation {
struct ShapesAppendTest : public BenchmarkOperation {
ShapesAppendTest() : BenchmarkOperation() {}

~ShapesAppendTest() {}

bool setUp(SimpleHttpClient* client) override {
return DeleteCollection(client, ARANGOBENCH->collection()) &&
CreateCollection(client, ARANGOBENCH->collection(), 2);
Expand Down Expand Up @@ -413,8 +403,6 @@ struct RandomShapesTest : public BenchmarkOperation {
_randomValue = RandomGenerator::interval(UINT32_MAX);
}

~RandomShapesTest() {}

bool setUp(SimpleHttpClient* client) override {
return DeleteCollection(client, ARANGOBENCH->collection()) &&
CreateCollection(client, ARANGOBENCH->collection(), 2);
Expand Down Expand Up @@ -505,8 +493,6 @@ struct RandomShapesTest : public BenchmarkOperation {
struct DocumentCrudTest : public BenchmarkOperation {
DocumentCrudTest() : BenchmarkOperation() {}

~DocumentCrudTest() {}

bool setUp(SimpleHttpClient* client) override {
return DeleteCollection(client, ARANGOBENCH->collection()) &&
CreateCollection(client, ARANGOBENCH->collection(), 2);
Expand Down Expand Up @@ -599,8 +585,6 @@ struct DocumentCrudTest : public BenchmarkOperation {
struct EdgeCrudTest : public BenchmarkOperation {
EdgeCrudTest() : BenchmarkOperation() {}

~EdgeCrudTest() {}

bool setUp(SimpleHttpClient* client) override {
return DeleteCollection(client, ARANGOBENCH->collection()) &&
CreateCollection(client, ARANGOBENCH->collection(), 3);
Expand Down Expand Up @@ -710,8 +694,6 @@ struct EdgeCrudTest : public BenchmarkOperation {
struct SkiplistTest : public BenchmarkOperation {
SkiplistTest() : BenchmarkOperation() {}

~SkiplistTest() {}

bool setUp(SimpleHttpClient* client) override {
return DeleteCollection(client, ARANGOBENCH->collection()) &&
CreateCollection(client, ARANGOBENCH->collection(), 2) &&
Expand Down Expand Up @@ -795,8 +777,6 @@ struct SkiplistTest : public BenchmarkOperation {
struct HashTest : public BenchmarkOperation {
HashTest() : BenchmarkOperation() {}

~HashTest() {}

bool setUp(SimpleHttpClient* client) override {
return DeleteCollection(client, ARANGOBENCH->collection()) &&
CreateCollection(client, ARANGOBENCH->collection(), 2) &&
Expand Down Expand Up @@ -994,8 +974,6 @@ struct CollectionCreationTest : public BenchmarkOperation {
_url = "/_api/collection";
}

~CollectionCreationTest() {}

bool setUp(SimpleHttpClient* client) override { return true; }

void tearDown() override {}
Expand Down Expand Up @@ -1045,8 +1023,6 @@ std::atomic<uint64_t> CollectionCreationTest::_counter(0);
struct TransactionAqlTest : public BenchmarkOperation {
TransactionAqlTest() : BenchmarkOperation() {}

~TransactionAqlTest() {}

bool setUp(SimpleHttpClient* client) override {
_c1 = std::string(ARANGOBENCH->collection() + "1");
_c2 = std::string(ARANGOBENCH->collection() + "2");
Expand Down Expand Up @@ -1138,8 +1114,6 @@ struct TransactionAqlTest : public BenchmarkOperation {
struct TransactionCountTest : public BenchmarkOperation {
TransactionCountTest() : BenchmarkOperation() {}

~TransactionCountTest() {}

bool setUp(SimpleHttpClient* client) override {
return DeleteCollection(client, ARANGOBENCH->collection()) &&
CreateCollection(client, ARANGOBENCH->collection(), 2);
Expand Down Expand Up @@ -1187,8 +1161,6 @@ struct TransactionCountTest : public BenchmarkOperation {
struct TransactionDeadlockTest : public BenchmarkOperation {
TransactionDeadlockTest() : BenchmarkOperation() {}

~TransactionDeadlockTest() {}

bool setUp(SimpleHttpClient* client) override {
_c1 = std::string(ARANGOBENCH->collection() + "1");
_c2 = std::string(ARANGOBENCH->collection() + "2");
Expand Down Expand Up @@ -1255,8 +1227,6 @@ struct TransactionDeadlockTest : public BenchmarkOperation {
struct TransactionMultiTest : public BenchmarkOperation {
TransactionMultiTest() : BenchmarkOperation() {}

~TransactionMultiTest() {}

bool setUp(SimpleHttpClient* client) override {
_c1 = std::string(ARANGOBENCH->collection() + "1");
_c2 = std::string(ARANGOBENCH->collection() + "2");
Expand Down Expand Up @@ -1338,8 +1308,6 @@ struct TransactionMultiTest : public BenchmarkOperation {
struct TransactionMultiCollectionTest : public BenchmarkOperation {
TransactionMultiCollectionTest() : BenchmarkOperation() {}

~TransactionMultiCollectionTest() {}

bool setUp(SimpleHttpClient* client) override {
_c1 = std::string(ARANGOBENCH->collection() + "1");
_c2 = std::string(ARANGOBENCH->collection() + "2");
Expand Down Expand Up @@ -1410,11 +1378,70 @@ struct TransactionMultiCollectionTest : public BenchmarkOperation {
std::string _c2;
};

struct StreamCursorTest : public BenchmarkOperation {
StreamCursorTest() : BenchmarkOperation() {}

bool setUp(SimpleHttpClient* client) override {
return DeleteCollection(client, ARANGOBENCH->collection()) &&
CreateCollection(client, ARANGOBENCH->collection(), 2);
}

void tearDown() override {}

std::string url(int const threadNumber, size_t const threadCounter,
size_t const globalCounter) override {
return std::string("/_api/cursor");
}

rest::RequestType type(int const threadNumber, size_t const threadCounter,
size_t const globalC 6D47 ounter) override {
return rest::RequestType::POST;
}

char const* payload(size_t* length, int const threadNumber,
size_t const threadCounter, size_t const globalCounter,
bool* mustFree) override {

TRI_string_buffer_t* buffer;
buffer = TRI_CreateSizedStringBuffer(256);

size_t const mod = globalCounter % 2;

if (mod == 0) {
TRI_AppendStringStringBuffer(buffer,
"{\"query\":\"INSERT { _key: \\\"test");
TRI_AppendInt64StringBuffer(buffer, (int64_t)globalCounter);
TRI_AppendStringStringBuffer(buffer, "\\\"");

uint64_t const n = ARANGOBENCH->complexity();
for (uint64_t i = 1; i <= n; ++i) {
TRI_AppendStringStringBuffer(buffer, ",\\\"value");
TRI_AppendUInt64StringBuffer(buffer, i);
TRI_AppendStringStringBuffer(buffer, "\\\":true");
}

TRI_AppendStringStringBuffer(buffer, " } INTO ");
TRI_AppendStringStringBuffer(buffer, ARANGOBENCH->collection().c_str());
TRI_AppendStringStringBuffer(buffer, "\"}");
} else {
TRI_AppendStringStringBuffer(buffer,
"{\"query\":\"FOR doc IN ");
TRI_AppendStringStringBuffer(buffer, ARANGOBENCH->collection().c_str());
TRI_AppendStringStringBuffer(buffer, " RETURN doc\",\"options\":{\"stream\":true}}");
}

*length = TRI_LengthStringBuffer(buffer);
*mustFree = true;
char* ptr = TRI_StealStringBuffer(buffer);
TRI_FreeStringBuffer(buffer);

return (char const*)ptr;
}
};

struct AqlInsertTest : public BenchmarkOperation {
AqlInsertTest() : BenchmarkOperation() {}

~AqlInsertTest() {}

bool setUp(SimpleHttpClient* client) override {
return DeleteCollection(client, ARANGOBENCH->collection()) &&
CreateCollection(client, ARANGOBENCH->collection(), 2);
Expand Down Expand Up @@ -1466,8 +1493,6 @@ struct AqlInsertTest : public BenchmarkOperation {
struct AqlV8Test : public BenchmarkOperation {
AqlV8Test() : BenchmarkOperation() {}

~AqlV8Test() {}

bool setUp(SimpleHttpClient* client) override {
return DeleteCollection(client, ARANGOBENCH->collection()) &&
CreateCollection(client, ARANGOBENCH->collection(), 2);
Expand Down Expand Up @@ -1701,6 +1726,9 @@ static BenchmarkOperation* GetTestCase(std::string const& name) {
if (name == "aqlv8") {
return new AqlV8Test();
}
if (name == "stream-cursor") {
return new StreamCursorTest();
}

return nullptr;
}
5 changes: 5 additions & 0 deletions js/client/modules/@arangodb/testsuites/arangobench.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,11 @@ const benchTodos = [{
'concurrency': '1',
'test-case': 'version',
'async': 'true'
}, {
'requests': '10000',
'concurrency': '3',
'test-case': 'stream-cursor',
'complexity': '4'
}, {
'requests': '100000',
'concurrency': '2',
Expand Down
0