Skip to content

Commit 068adfd

Browse files
committed
[aws] Fix various bugs for C++ benchmarks, as pointed out during review
1 parent b7ab8e4 commit 068adfd

File tree

8 files changed

+24
-14
lines changed

8 files changed

+24
-14
lines changed

benchmarks/wrappers/aws/cpp/handler.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#include <chrono>
2+
#include <cstdlib>
13

24
#include <aws/core/Aws.h>
35
#include <aws/lambda-runtime/runtime.h>
@@ -36,10 +38,6 @@ aws::lambda_runtime::invocation_response handler(aws::lambda_runtime::invocation
3638
Aws::Utils::Json::JsonValue body;
3739
body.WithObject("result", ret);
3840

39-
// Switch cold execution after the first one.
40-
if(cold_execution)
41-
cold_execution = false;
42-
4341
auto b = std::chrono::duration_cast<std::chrono::microseconds>(begin.time_since_epoch()).count() / 1000.0 / 1000.0;
4442
auto e = std::chrono::duration_cast<std::chrono::microseconds>(end.time_since_epoch()).count() / 1000.0 / 1000.0;
4543
body.WithDouble("begin", b);
@@ -50,6 +48,10 @@ aws::lambda_runtime::invocation_response handler(aws::lambda_runtime::invocation
5048
body.WithString("container_id", container_id);
5149
body.WithString("cold_start_var", cold_start_var);
5250

51+
// Switch cold execution after the first one.
52+
if(cold_execution)
53+
cold_execution = false;
54+
5355
Aws::Utils::Json::JsonValue final_result;
5456
final_result.WithObject("body", body);
5557
return aws::lambda_runtime::invocation_response::success(final_result.View().WriteReadable(), "application/json");

benchmarks/wrappers/aws/cpp/key-value.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11

2-
#include <memory>
2+
#include <chrono>
3+
#include <thread>
34

45
#include <aws/core/auth/AWSCredentialsProvider.h>
56
#include <aws/core/client/ClientConfiguration.h>

benchmarks/wrappers/aws/cpp/redis.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11

2+
#include <chrono>
3+
#include <iostream>
24
#include <string>
5+
#include <thread>
36

47
#include <aws/core/Aws.h>
58

benchmarks/wrappers/aws/cpp/storage.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11

22
#include <memory>
3+
#include <iostream>
4+
#include <sstream>
35

46
#include <aws/core/auth/AWSCredentialsProvider.h>
57
#include <aws/core/client/ClientConfiguration.h>
@@ -13,11 +15,8 @@
1315

1416
Storage Storage::get_client() {
1517
Aws::Client::ClientConfiguration config;
16-
// config.region = "eu-central-1";
1718
config.caFile = "/etc/pki/tls/certs/ca-bundle.crt";
1819

19-
std::cout << std::getenv("AWS_REGION") << std::endl;
20-
2120
char const TAG[] = "LAMBDA_ALLOC";
2221
auto credentialsProvider =
2322
Aws::MakeShared<Aws::Auth::EnvironmentAWSCredentialsProvider>(TAG);

dockerfiles/aws/cpp/Dockerfile.dependencies-runtime

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ ENV WORKERS=${WORKERS}
55

66

77
RUN yum install -y cmake3 curl libcurl libcurl-devel git gcc gcc-c++ make tar gzip
8-
RUN git clone https://github.com/awslabs/aws-lambda-cpp.git\
8+
RUN git clone --branch v0.2.10 https://github.com/awslabs/aws-lambda-cpp.git\
99
&& cmake3 -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=OFF -DCMAKE_INSTALL_PREFIX=/opt -B aws-lambda-cpp/build -S aws-lambda-cpp\
1010
&& cmake3 --build aws-lambda-cpp/build --parallel ${WORKERS} --target install
1111

dockerfiles/aws/cpp/Dockerfile.dependencies-sdk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ ARG WORKERS
44
ENV WORKERS=${WORKERS}
55

66
RUN yum install -y cmake3 curl libcurl libcurl-devel git gcc gcc-c++ make zlib-devel openssl-devel
7-
RUN git clone --recurse-submodules https://github.com/aws/aws-sdk-cpp.git\
7+
RUN git clone --recurse-submodules --branch 1.11.590 https://github.com/aws/aws-sdk-cpp.git\
88
&& cd aws-sdk-cpp && mkdir build && cd build\
99
&& cmake3 -DCMAKE_BUILD_TYPE=Release -DBUILD_ONLY="s3;dynamodb;sqs" -DENABLE_TESTING=OFF -DCMAKE_INSTALL_PREFIX=/opt/ ..\
1010
&& cmake3 --build . --parallel ${WORKERS} --target install

dockerfiles/cpp_installer.sh

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
#!/bin/bash
22

33
mkdir -p /mnt/function/build
4-
cmake3 -DCMAKE_BUILD_TYPE=Release -S /mnt/function/ -B /mnt/function/build > /mnt/function/build/configuration.log
5-
VERBOSE=1 cmake3 --build /mnt/function/build --target aws-lambda-package-benchmark > /mnt/function/build/compilation.log
6-
4+
cmake3 -DCMAKE_BUILD_TYPE=Release -S /mnt/function/ -B /mnt/function/build >/mnt/function/build/configuration.log || {
5+
echo "CMake configuration failed. Check configuration.log for details." >&2
6+
exit 1
7+
}
8+
VERBOSE=1 cmake3 --build /mnt/function/build --target aws-lambda-package-benchmark >/mnt/function/build/compilation.log || {
9+
echo "CMake build failed. Check compilation.log for details." >&2
10+
exit 1
11+
}

sebs/types.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def deserialize(val: str) -> Language:
3232
for member in Language:
3333
if member.value == val:
3434
return member
35-
raise Exception(f"Unknown language type {member}")
35+
raise Exception(f"Unknown language type {val}")
3636

3737

3838
class NoSQLStorage(str, Enum):

0 commit comments

Comments
 (0)