Skip to content

Commit 9722c54

Browse files
authored
Merge pull request #51 from TechEmpower/master
aa
2 parents 2bc4ab8 + 6f02a28 commit 9722c54

1,722 files changed

Lines changed: 38479 additions & 35991 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
installs
22
node_modules/
33
.travis.bak
4-
4+
t.bat
55
# Added for pedestal framework test
66
.lein-deps-sum
77

deployment/vagrant/Vagrantfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ Vagrant.configure("2") do |config|
1313
end
1414

1515
config.vm.network "private_network", ip: "172.16.0.16"
16+
config.vm.network "forwarded_port", guest: 5432, host: 5432
17+
config.vm.network "forwarded_port", guest: 3306, host: 3306
1618

1719
TCP_PORTS = [2001, 3000, 8000, 8080, 8081, 8082, 8085, 9000]
1820

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
cmake_minimum_required(VERSION 3.23)
2+
project(techempower_aeronet CXX)
3+
4+
set(CMAKE_CXX_STANDARD 23)
5+
set(CMAKE_CXX_STANDARD_REQUIRED ON)
6+
7+
# Fetch aeronet from GitHub
8+
include(FetchContent)
9+
10+
set(AERONET_GIT_TAG "main" CACHE STRING "Git tag/branch for aeronet")
11+
12+
FetchContent_Declare(
13+
aeronet
14+
GIT_REPOSITORY https://github.com/sjanel/aeronet.git
15+
GIT_TAG ${AERONET_GIT_TAG}
16+
GIT_SHALLOW TRUE
17+
)
18+
19+
# Configure aeronet with minimal features for TechEmpower
20+
set(AERONET_ENABLE_GLAZE ON CACHE BOOL "" FORCE)
21+
set(AERONET_ENABLE_ASYNC_HANDLERS OFF CACHE BOOL "" FORCE)
22+
set(AERONET_ENABLE_HTTP2 OFF CACHE BOOL "" FORCE)
23+
set(AERONET_ENABLE_BROTLI OFF CACHE BOOL "" FORCE)
24+
set(AERONET_ENABLE_ZLIB OFF CACHE BOOL "" FORCE)
25+
set(AERONET_ENABLE_ZSTD OFF CACHE BOOL "" FORCE)
26+
set(AERONET_ENABLE_OPENSSL OFF CACHE BOOL "" FORCE)
27+
set(AERONET_ENABLE_OPENTELEMETRY OFF CACHE BOOL "" FORCE)
28+
set(AERONET_ENABLE_WEBSOCKET OFF CACHE BOOL "" FORCE)
29+
set(AERONET_BUILD_TESTS OFF CACHE BOOL "" FORCE)
30+
set(AERONET_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)
31+
set(AERONET_BUILD_BENCHMARKS OFF CACHE BOOL "" FORCE)
32+
33+
FetchContent_MakeAvailable(aeronet)
34+
35+
# TechEmpower benchmark executable
36+
add_executable(benchmark_techempower main.cpp)
37+
target_link_libraries(benchmark_techempower PRIVATE aeronet)
38+

frameworks/C++/aeronet/README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Aeronet (TechEmpower Framework Benchmarks)
2+
3+
[aeronet](https://github.com/sjanel/aeronet) is a modern C++23 HTTP/1.1 + HTTP/2 server library focused on low overhead and high throughput. This TechEmpower implementation targets the JSON and Plaintext tests using glaze for fast JSON serialization.
4+
5+
## Test Endpoints
6+
7+
- `GET /json` -> `{"message":"Hello, World!"}`
8+
- `GET /plaintext` -> `Hello, World!`
9+
10+
## Notes
11+
12+
- Built with C++23 and glaze 7.0.2.
13+
- Linux-only (epoll-based).
14+
- HTTP/1.1 keep-alive and pipelining supported.
15+
- TLS, WebSocket, and HTTP/2 supported but not enabled in this benchmark.
16+
- Other endpoints (e.g. database access) not implemented in this benchmark.
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
FROM ubuntu:24.04 AS build
2+
3+
ARG AERONET_GIT_TAG=main
4+
ARG BUILD_MODE=Release
5+
6+
RUN apt-get update && \
7+
apt-get upgrade -y && \
8+
apt-get install -y --no-install-recommends \
9+
build-essential \
10+
ninja-build \
11+
cmake \
12+
git \
13+
ca-certificates && \
14+
rm -rf /var/lib/apt/lists/*
15+
16+
WORKDIR /app
17+
COPY main.cpp CMakeLists.txt ./
18+
19+
RUN mkdir build && cd build && \
20+
cmake -GNinja \
21+
-DCMAKE_BUILD_TYPE=${BUILD_MODE} \
22+
-DAERONET_GIT_TAG=${AERONET_GIT_TAG} \
23+
.. && \
24+
cmake --build . --target benchmark_techempower && \
25+
install -m 0755 benchmark_techempower /app/benchmark_techempower
26+
27+
RUN mkdir -p /deps && \
28+
ldd /app/benchmark_techempower \
29+
| tr -s '[:blank:]' '\n' \
30+
| grep '^/' \
31+
| xargs -I % sh -c 'mkdir -p /deps$(dirname %); cp % /deps%;'
32+
33+
FROM scratch
34+
35+
COPY --from=build /etc/ssl/certs /etc/ssl/certs
36+
COPY --from=build /deps /
37+
COPY --from=build /app/benchmark_techempower /app/benchmark_techempower
38+
39+
EXPOSE 8080
40+
41+
ENTRYPOINT ["/app/benchmark_techempower"]
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"framework": "aeronet",
3+
"maintainers": [ "sjanel" ],
4+
"tests": [
5+
{
6+
"default": {
7+
"json_url": "/json",
8+
"plaintext_url": "/plaintext",
9+
"port": 8080,
10+
"approach": "Realistic",
11+
"classification": "Micro",
12+
"database": "None",
13+
"framework": "aeronet",
14+
"language": "C++",
15+
"orm": "Micro",
16+
"platform": "Linux",
17+
"webserver": "aeronet",
18+
"os": "Linux",
19+
"database_os": "Linux",
20+
"dockerfile": "aeronet.dockerfile",
21+
"notes": "Modern C++23 HTTP server with minimal overhead; JSON via glaze",
22+
"versus": ""
23+
}
24+
}
25+
]
26+
}

frameworks/C++/aeronet/config.toml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
[framework]
2+
name = "aeronet"
3+
4+
[main]
5+
urls.plaintext = "/plaintext"
6+
urls.json = "/json"
7+
approach = "Realistic"
8+
classification = "Micro"
9+
database = "None"
10+
database_os = "Linux"
11+
os = "Linux"
12+
orm = "Micro"
13+
platform = "None"
14+
webserver = "None"
15+
versus = "None"

frameworks/C++/aeronet/main.cpp

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
// SPDX-License-Identifier: MIT
2+
// TechEmpower Framework Benchmarks - Aeronet Implementation
3+
// Implements Test 1 (JSON) and Test 6 (Plaintext) endpoints
4+
5+
#include <aeronet/aeronet.hpp>
6+
#include <aeronet/json-serializer.hpp>
7+
#include <charconv>
8+
#include <cstdlib>
9+
#include <cstring>
10+
#include <glaze/glaze.hpp>
11+
#include <iostream>
12+
#include <optional>
13+
#include <system_error>
14+
15+
// Test 1: JSON message structure
16+
struct MessageResponse {
17+
std::string_view message;
18+
};
19+
20+
// Glaze metadata for JSON serialization
21+
template <>
22+
struct glz::meta<MessageResponse> {
23+
using T = MessageResponse;
24+
static constexpr auto value = glz::object("message", &T::message);
25+
};
26+
27+
int main(int argc, char* argv[]) {
28+
// Enable signal handler for graceful shutdown on Ctrl+C
29+
aeronet::SignalHandler::Enable();
30+
31+
try {
32+
using namespace aeronet;
33+
34+
auto parseEnvUInt = [](const char* envVar) -> std::optional<uint32_t> {
35+
const char* value = std::getenv(envVar);
36+
if (value == nullptr || value[0] == '\0') {
37+
return std::nullopt;
38+
}
39+
uint32_t parsed = 0;
40+
const auto [ptr, errc] = std::from_chars(value, value + std::strlen(value), parsed);
41+
if (errc != std::errc{} || ptr != value + std::strlen(value)) {
42+
return std::nullopt;
43+
}
44+
return parsed;
45+
};
46+
47+
uint16_t port = 8080;
48+
if (argc > 1) {
49+
const auto [ptr, errc] = std::from_chars(argv[1], argv[1] + std::strlen(argv[1]), port);
50+
if (errc != std::errc{} || ptr != argv[1] + std::strlen(argv[1])) {
51+
std::cerr << "Invalid port number: " << argv[1] << "\n";
52+
return EXIT_FAILURE;
53+
}
54+
}
55+
56+
HttpServerConfig config;
57+
config.port = port;
58+
if (const auto threads = parseEnvUInt("AERONET_THREADS"); threads.has_value()) {
59+
config.nbThreads = *threads;
60+
} else if (const auto threads = parseEnvUInt("THREADS"); threads.has_value()) {
61+
config.nbThreads = *threads;
62+
}
63+
64+
Router router;
65+
66+
// Test 6: Plaintext endpoint
67+
// Returns a simple "Hello, World!" text response
68+
router.setPath(http::Method::GET, "/plaintext", [](const HttpRequest& req) {
69+
return req.makeResponse("Hello, World!", "text/plain; charset=UTF-8");
70+
});
71+
72+
// Test 1: JSON endpoint
73+
router.setPath(http::Method::GET, "/json", [](const HttpRequest& req) {
74+
MessageResponse msg{"Hello, World!"};
75+
return req.makeResponse(aeronet::SerializeToJson(msg), "application/json");
76+
});
77+
78+
// Health check endpoint (optional, useful for Docker)
79+
router.setPath(http::Method::GET, "/health",
80+
[](const HttpRequest& req) { return req.makeResponse("OK", "text/plain"); });
81+
82+
// Start the server
83+
std::cout << "Starting TechEmpower benchmark server on port " << port << '\n';
84+
std::cout << " - JSON test (Test 1): GET /json\n";
85+
std::cout << " - Plaintext test (Test 6): GET /plaintext\n";
86+
std::cout << " - Health check: GET /health\n";
87+
88+
HttpServer server(config, std::move(router));
89+
server.run(); // blocking run, until Ctrl+C
90+
91+
} catch (const std::exception& e) {
92+
std::cerr << "Error: " << e.what() << '\n';
93+
return 1;
94+
}
95+
96+
return 0;
97+
}

frameworks/C++/cpoll_cppsp/benchmark_config.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@
5757
"database_os": "Linux",
5858
"display_name": "cpoll-cppsp-raw",
5959
"notes": "",
60-
"versus": "cpoll_cppsp"
60+
"versus": "cpoll_cppsp",
61+
"tags": [ "broken" ]
6162
},
6263
"postgres-raw-threadpool": {
6364
"db_url": "/db_pg_threadpool",

frameworks/C++/cppcms/benchmark_config.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@
4040
"os": "Linux",
4141
"database_os": "Linux",
4242
"display_name": "CppCMS-PostgreSQL-nginx",
43-
"notes": ""
43+
"notes": "",
44+
"tags": [ "broken" ]
4445
}
4546
}]
4647
}

0 commit comments

Comments
 (0)