From f3c5660f1b94f4ca7d24eee9b58091f17a0e2d74 Mon Sep 17 00:00:00 2001 From: Javad Saberlatibari <76922325+javadsaberlatibari@users.noreply.github.com> Date: Mon, 1 Apr 2024 22:32:09 -0700 Subject: [PATCH] Add files via upload --- .../benchmark/rubis-benchmark.cpp | 67 ++++++++++++------- 1 file changed, 42 insertions(+), 25 deletions(-) diff --git a/wellcoordination/benchmark/rubis-benchmark.cpp b/wellcoordination/benchmark/rubis-benchmark.cpp index d7c311e..89bbfa8 100644 --- a/wellcoordination/benchmark/rubis-benchmark.cpp +++ b/wellcoordination/benchmark/rubis-benchmark.cpp @@ -10,9 +10,10 @@ //sellItem 0 2(id+value) //storeBuyNow 1 2(id+value) by leader //registerUser 2 1(id) by leader -//openAuction 1(id) by default consider 100 auctions are open. -//placeBid 3 3(auctionid+userid+value) -//query 4 like movie does not consider read. +//openAuction 3 1(id) by default consider 100 auctions are open. +//placeBid 4 3(auctionid+userid+value) +//placeBid 5 +//query 6 like movie does not consider read. int main(int argc, char* argv[]) { std::string loc = @@ -43,8 +44,8 @@ int main(int argc, char* argv[]) { double total_writes = num_ops * write_percentage; int queries = num_ops - total_writes; - int num_conflicting_write_methods = 2; - int num_nonconflicting_write_methods = 3; + int num_conflicting_write_methods = 4; + int num_nonconflicting_write_methods = 2; int num_read_methods = 0; std::cout << "ops: " << num_ops << std::endl; @@ -130,10 +131,44 @@ int main(int argc, char* argv[]) { } } } + // third leader + else if (i == 3) { + for (int type = 0; type <= 1; type++) { + int count = 0; + for (; count < expected_calls_per_update_method;) { + // registerUser + // add users from 100 - 199. + std::string callStr; + if (type == 0) { + // placeBid + // Bid with user id 0 - 99 and item id 0 - 99 + std::string a_id = std::to_string(std::rand() % 100); //auction id + std::string u_id = std::to_string(std::rand() % 100); //user id + std::string value = std::to_string(std::rand() % 1000); //bid value + + callStr = "3 " + a_id + "-" + u_id + "-" + value; + } + if (type == 1) { + //Close Auctions + std::string i_id = std::to_string(100 + std::rand() % 100); //auction id + //std::string stock = std::to_string(1 + std::rand() % 1000); //stock + + //open[i - 1].push_back(i_id); + callStr = "5 " + i_id + } + MethodCall call = ReplicatedObject::createCall("id", callStr); + if (test->isPermissible(call)) { + test->execute(call); + calls[i - 1].push_back(callStr); + count++; + } + } + } + } // follower else { // non-conflicting write method - for (int type = 0; type <= 2; type++) { + for (int type = 0; type <= 1; type++) { for (int count = 0; count < expected_nonconflicting_write_calls_per_follower; count++) { std::string callStr; @@ -143,17 +178,8 @@ int main(int argc, char* argv[]) { std::string value = std::to_string(std::rand() % 1000); callStr = "0 " + s_id+ "-"+ value; } - if (type == 1) { - // placeBid - // Bid with user id 0 - 99 and item id 0 - 99 - std::string a_id = std::to_string(std::rand() % 100); //auction id - std::string u_id = std::to_string(std::rand() % 100); //user id - std::string value = std::to_string(std::rand() % 1000); //bid value - - callStr = "3 " + a_id + "-" + u_id + "-" + value; - } - if (type == 2) { + if (type == 1) { //Open Auctions // Open 100 - 199, with different stock values // Save the opened ids so we can close them after shuffling. @@ -189,15 +215,6 @@ int main(int argc, char* argv[]) { calls[i].insert(calls[i].begin(), std::string("#" + std::to_string(write_calls))); std::random_shuffle(calls[i].begin() + 1, calls[i].end()); - - std::string callStr; - if (i != 0 && i != 1) - for (int count = 0; count < expected_nonconflicting_write_calls_per_follower; count++) { - //Close Auction (using the saved values we opened added to the end of the shuffled operations) - callStr = "5 " + open[i][count]; - calls[i].push_back(callStr); - } - } for (int i = 0; i < nr_procs; i++) {