Skip to content
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

Add communication benchmarks #100

Open
wants to merge 56 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
a9f3c27
[aws][system] Add C++ dependencies images
mcopik May 3, 2022
d0af6f9
[aws][system] Add C++ dependencies images
mcopik May 3, 2022
6cc22bf
Merge branch 'cpp_benchmarks' of github.com:spcl/serverless-benchmark…
mcopik May 6, 2022
495085d
[aws] Change name style of C++ Docker images
mcopik May 7, 2022
3ca2b87
[aws] Add AWS C++ Lambda runtime as dependency
mcopik May 7, 2022
cc5c86b
[aws] Add the basic wrapper for C++
mcopik May 7, 2022
fae837d
[aws] Add Docker build container for C++
mcopik May 7, 2022
6187885
[benchmarks] Add sleep benchmark implementation for C++
mcopik May 7, 2022
a2879d7
[aws] Define necessary package files for C++
mcopik May 7, 2022
5c38ffe
[system] Add Docker build arguments for C++ images
mcopik May 7, 2022
76254bf
[aws] Implement correct return from C++
mcopik May 7, 2022
f017635
[aws] [system] First version of support for C++ benchmarks
mcopik May 7, 2022
46131d9
[aws] Add Boost UUID in handler
mcopik May 7, 2022
a74f6f4
[aws] Support HTTP trigger for C++
mcopik May 7, 2022
2a21112
[aws] Minor update of C++ dependencies
mcopik May 7, 2022
a01c535
[aws] Update C++ wrappers to handle exit code
mcopik May 14, 2022
873e016
[aws] Add storage method to create S3 paths
mcopik May 14, 2022
00156ef
[system] Simplify hendling of common configuration options and define…
mcopik May 14, 2022
ac5382e
[system] Fix a typo
mcopik May 14, 2022
7141066
[system] Updating the resource definition in preparation for improved…
mcopik May 14, 2022
9e1a15e
[benchmarks] [aws] Add first version of P2P benchmakr for AWS S3
mcopik May 14, 2022
7b38dd0
[system] Add first, incomplete version of P2P experiment
mcopik May 14, 2022
9b15b8f
[experiments] Add first, incomplete version of P2P experiment
mcopik May 14, 2022
1dd2421
[experiments] Polish the output format and control over messages in P…
mcopik May 14, 2022
2ed1f29
Merge branch 'comm_benchmarks' of github.com:spcl/serverless-benchmar…
mcopik May 14, 2022
91ae119
[system] Fix a typo
mcopik May 14, 2022
766b680
[experiments] Process data from P2P experiment
mcopik May 14, 2022
e465db3
[experiments] Support many sizes in communication p2p benchmark
mcopik May 15, 2022
c4368fe
[aws] Handle Lambda library triggers with long timeouts
mcopik May 15, 2022
bf808a6
[aws] Add missing config initizatlion
mcopik May 15, 2022
20959e2
[aws] Extend permissions of SeBS role
mcopik May 15, 2022
694e95c
[experiments] Support key-value storage for communication
mcopik May 15, 2022
35d1775
[aws] Add key-value wrapper for C++ benchmarks
mcopik May 15, 2022
d463cbd
Merge branch 'cpp_benchmarks' into comm_benchmarks
mcopik May 15, 2022
3124beb
[bechmarks] Add DynamoDB benchmark
mcopik May 15, 2022
edda7a8
[system] Add caching of key-value tables
mcopik May 15, 2022
e014c3b
[benchmarks] Linting
mcopik May 15, 2022
c046490
Merge branch 'cpp_benchmarks' into comm_benchmarks
mcopik May 15, 2022
96b4619
[aws] Fix a typo in role name
mcopik May 15, 2022
d36d30d
[benchmarks] Increase timeout of the benchmark function
mcopik May 15, 2022
41ed692
[experiments] Add configuration of Redis to communication experiment
mcopik May 15, 2022
de87302
[system] Add logging of C++ build steps
mcopik May 15, 2022
8e53993
[aws] Add Redis wrappers for C++
mcopik May 15, 2022
8846844
Merge branch 'cpp_benchmarks' into comm_benchmarks
mcopik May 15, 2022
93ba402
[benchmarks] Add communication P2P benchmark for Redis
mcopik May 15, 2022
a4c7f02
[experiments] Process Redis results
mcopik May 15, 2022
42132ac
[system] Add Docker image for TCPunch dependency
mcopik May 15, 2022
372459d
[aws] Add tcpunch to Docker build image
mcopik May 15, 2022
27212a5
[benchmarks] Adjust Redis to not leave empty messages
mcopik May 15, 2022
c858549
[aws] Add TCP wrapper
mcopik May 15, 2022
2ee3567
[aws] Add TCP wrapper to installation scripts
mcopik May 15, 2022
b76168d
[aws] Add TCP wrapper
mcopik May 15, 2022
1210020
[benchmarks] Improve handling of Redis cleanup
mcopik May 15, 2022
76619b9
[benchmarks] Add TCP P2P benchmark
mcopik May 15, 2022
0ee4938
[experiments] Minor code improvements
mcopik May 15, 2022
6b2eb39
Merge branch 'comm_benchmarks' of github.com:spcl/serverless-benchmar…
mcopik May 15, 2022
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
2 changes: 1 addition & 1 deletion benchmarks/000.microbenchmarks/010.sleep/config.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"timeout": 120,
"memory": 128,
"languages": ["python", "nodejs"]
"languages": ["python", "nodejs", "cpp"]
}
21 changes: 21 additions & 0 deletions benchmarks/000.microbenchmarks/010.sleep/cpp/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@

#include <aws/core/Aws.h>
#include <aws/core/utils/json/JsonSerializer.h>
#include <aws/lambda-runtime/runtime.h>

#include <thread>
#include <iostream>
#include <tuple>

std::tuple<Aws::Utils::Json::JsonValue, int> function(Aws::Utils::Json::JsonView json)
{
int sleep = json.GetInteger("sleep");

std::chrono::seconds timespan(sleep);
std::this_thread::sleep_for(timespan);

Aws::Utils::Json::JsonValue val;
val.WithObject("result", std::to_string(sleep));
return std::make_tuple(val, 0);
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"timeout": 900,
"memory": 2048,
"languages": ["cpp"],
"deployment": {
"package": {
"build_dependencies": {
"cpp": {
"common": ["boost"],
"aws": ["sdk"]
}
}
},
"image": null
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"package": {
"common": ["boost"],
"aws": ["sdk"]
},
"image": null
}
153 changes: 153 additions & 0 deletions benchmarks/000.microbenchmarks/051.communication.storage/cpp/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@

#include <aws/core/Aws.h>
#include <aws/core/utils/logging/LogLevel.h>
#include <aws/core/utils/logging/ConsoleLogSystem.h>
#include <aws/core/utils/logging/LogMacros.h>
#include <aws/core/utils/json/JsonSerializer.h>
#include <aws/core/utils/HashingUtils.h>
#include <aws/core/platform/Environment.h>
#include <aws/s3/S3Client.h>
#include <aws/lambda-runtime/runtime.h>

#include <vector>
#include <thread>
#include <cstdint>
#include <iostream>
#include <tuple>

#include "storage.hpp"
#include "utils.hpp"

std::tuple<Aws::Utils::Json::JsonValue, int> function(Aws::Utils::Json::JsonView json)
{
Storage client = Storage::get_client();

auto bucket = json.GetString("bucket");
auto key = json.GetString("key");
auto role = json.GetString("role"); // producer or consumer
auto size = json.GetInteger("size");
auto invoc = json.GetObject("invocations");
int reps = invoc.GetInteger("invocations");
int iteration = invoc.GetInteger("iteration");
int warmup_reps = invoc.GetInteger("warmup");
bool with_backoff = invoc.GetBool("with_backoff");
int offset = invoc.GetInteger("offset");
std::cout << "Invoked handler for role " << role << " with file size " << size
<< " and " << reps << " messages per lambda " << std::endl;

char* pBuf = new char[size];
memset(pBuf, 'A', sizeof(char)*size);

std::string data_key = client.key_join({key, "messages"});
std::string results_key = client.key_join({key, "results"});

std::vector<uint64_t> times;
std::vector<uint64_t> retries_times;
int retries = 0;
if (role == "producer") {

for(int i = 0; i < warmup_reps; ++i) {

std::string prefix = std::to_string(size) + "_" + std::to_string(i + offset);
std::string new_key = client.key_join({data_key, prefix});
std::string new_key_response = client.key_join({data_key, prefix + "_response"});
client.upload_file(bucket, new_key, size, pBuf);
int ret = client.download_file(bucket, new_key_response, retries, with_backoff);
if(ret == 0) {
std::cerr << "Failed download " << i << '\n';
break;
}
}

for(int i = warmup_reps; i < reps + warmup_reps; ++i) {

std::string prefix = std::to_string(size) + "_" + std::to_string(i + offset);
std::string new_key = client.key_join({data_key, prefix});
std::string new_key_response = client.key_join({data_key, prefix + "_response"});
auto beg = timeSinceEpochMillisec();
client.upload_file(bucket, new_key, size, pBuf);
int ret = client.download_file(bucket, new_key_response, retries, with_backoff);
auto end = timeSinceEpochMillisec();
times.push_back(end - beg);
retries_times.push_back(retries);

if(ret == 0) {
std::cerr << "Failed download " << i << '\n';
break;
}
}

std::stringstream ss;
ss << times.size() << '\n';
for(size_t i = 0; i < times.size(); ++i)
ss << times[i] << '\n';
std::stringstream ss2;
ss2 << retries_times.size() << '\n';
for(size_t i = 0; i < retries_times.size(); ++i)
ss2 << retries_times[i] << '\n';

auto times_str = ss.str();
char* data = new char[times_str.length() + 1];
strcpy(data, times_str.c_str());

auto retries_times_str = ss2.str();
char* data2 = new char[retries_times_str.length() + 1];
strcpy(data2, retries_times_str.c_str());

std::string new_key = client.key_join({results_key, "producer_times_" + std::to_string(size) + "_" + std::to_string(iteration) + ".txt"});
client.upload_file(bucket, new_key, times_str.length(), data);
new_key = client.key_join({results_key, "producer_retries_" + std::to_string(size) + "_" + std::to_string(iteration) + ".txt"});
client.upload_file(bucket, new_key, retries_times_str.length(), data2);

delete[] data;
delete[] data2;
} else if (role == "consumer") {

std::this_thread::sleep_for(std::chrono::milliseconds(1000));
for(int i = 0; i < warmup_reps; ++i) {

std::string prefix = std::to_string(size) + "_" + std::to_string(i + offset);
std::string new_key = client.key_join({data_key, prefix});
std::string new_key_response = client.key_join({data_key, prefix + "_response"});
int ret = client.download_file(bucket, new_key, retries, with_backoff);
client.upload_file(bucket, new_key_response, size, pBuf);
if(ret == 0) {
std::cerr << "Failed download " << i << '\n';
break;
}
}

for(int i = warmup_reps; i < reps + warmup_reps; ++i) {

std::string prefix = std::to_string(size) + "_" + std::to_string(i + offset);
std::string new_key = client.key_join({data_key, prefix});
std::string new_key_response = client.key_join({data_key, prefix + "_response"});
int ret = client.download_file(bucket, new_key, retries, with_backoff);
client.upload_file(bucket, new_key_response, size, pBuf);
retries_times.push_back(retries);
if(ret == 0) {
std::cerr << "Failed download " << i << '\n';
break;
}

}

std::stringstream ss2;
ss2 << retries_times.size() << '\n';
for(int i = 0; i < retries_times.size(); ++i)
ss2 << retries_times[i] << '\n';
auto retries_times_str = ss2.str();
char* data = new char[retries_times_str.length() + 1];
strcpy(data, retries_times_str.c_str());
std::string new_key = client.key_join({results_key, "consumer_retries_" + std::to_string(size) + "_" + std::to_string(iteration) + ".txt"});
client.upload_file(bucket, new_key, retries_times_str.length(), data);
delete[] data;
}

delete[] pBuf;

Aws::Utils::Json::JsonValue val;
val.WithObject("result", std::to_string(size));
return std::make_tuple(val, 0);
}

12 changes: 12 additions & 0 deletions benchmarks/000.microbenchmarks/051.communication.storage/input.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@

size_generators = {
'test' : 1,
'small' : 100,
'large': 1000
}

def buckets_count():
return (0, 0)

def generate_input(data_dir, size, input_buckets, output_buckets, upload_func):
return { 'sleep': size_generators[size] }
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"timeout": 540,
"memory": 2048,
"languages": ["cpp"],
"deployment": {
"package": {
"build_dependencies": {
"cpp": {
"common": ["boost"],
"aws": ["sdk"]
}
}
},
"image": null
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"package": {
"common": ["boost"],
"aws": ["sdk"]
},
"image": null
}
Loading