Skip to content

Commit a61b871

Browse files
committed
2 parents d4bfde6 + c39cf23 commit a61b871

File tree

367 files changed

+4789
-3472
lines changed

Some content is hidden

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

367 files changed

+4789
-3472
lines changed

frameworks/C++/userver/README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,11 @@
22

33
This is the [userver](https://github.com/userver-framework/userver) portion of a [benchmarking test suite](https://github.com/TechEmpower/FrameworkBenchmarks) comparing a variety of web development platforms.
44

5-
This benchmarks comes in two configurations: **userver** and **userver-bare**, where both configurations use exactly the same handlers code, but **userver-bare** replaces default http implementation of **userver** with custom one.
6-
You see, **userver** being feature-rich framework widely used in production comes with a lot of useful functionality built-in (metrics, dynamic configuring, logging/tracing, congestion control etc...) none of which is of any use in benchmarks; although most of that can be disabled via configs, some parts remain, and these parts aren't free.
7-
The aim of **userver-bare** is to explore practical limits of lower-level **userver** functionality when performance is an absolute must, while still being idiomatic userver code.
8-
95
### Test Type Implementation Source Code
106

117
* [Plaintext](userver_benchmark/controllers/plaintext/handler.cpp)
128
* [Json](userver_benchmark/controllers/json/handler.cpp)
9+
* [Fortunes](userver_benchmark/controllers/fortunes/handler.cpp)
1310
* [Single Database Query](userver_benchmark/controllers/single_query/handler.cpp)
1411
* [Multiple Database Queries](userver_benchmark/controllers/multiple_queries/handler.cpp)
1512
* [Database Updates](userver_benchmark/controllers/updates/handler.cpp)
@@ -24,6 +21,10 @@ http://localhost:8080/plaintext
2421

2522
http://localhost:8080/json
2623

24+
### Fortunes
25+
26+
http://localhost:8080/fortunes
27+
2728
### Single Database Query
2829

2930
http://localhost:8080/db

frameworks/C++/userver/benchmark_config.json

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -25,30 +25,6 @@
2525
"display_name": "userver",
2626
"notes": "",
2727
"versus": "None"
28-
},
29-
"bare": {
30-
"json_url": "/json",
31-
"plaintext_url": "/plaintext",
32-
"db_url": "/db",
33-
"query_url": "/queries?queries=",
34-
"update_url": "/updates?queries=",
35-
"cached_query_url": "/cached-queries?count=",
36-
"fortune_url": "/fortunes",
37-
"port": 8081,
38-
"approach": "Realistic",
39-
"classification": "Micro",
40-
"database": "postgres",
41-
"framework": "userver",
42-
"language": "C++",
43-
"flavor": "None",
44-
"orm": "Micro",
45-
"platform": "None",
46-
"webserver": "None",
47-
"os": "Linux",
48-
"database_os": "Linux",
49-
"display_name": "userver[bare]",
50-
"notes": "",
51-
"versus": "None"
5228
}
5329
}
5430
]

frameworks/C++/userver/config.toml

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -18,21 +18,3 @@ orm = "Micro"
1818
platform = "None"
1919
webserver = "None"
2020
versus = "None"
21-
22-
[bare]
23-
urls.plaintext = "/plaintext"
24-
urls.json = "/json"
25-
urls.db = "/db"
26-
urls.query = "/queries?queries="
27-
urls.update = "/updates?queries="
28-
urls.cached_query = "/cached-queries?count="
29-
urls.fortune = "/fortunes"
30-
approach = "Realistic"
31-
classification = "Micro"
32-
database = "Postgres"
33-
database_os = "Linux"
34-
os = "Linux"
35-
orm = "Micro"
36-
platform = "None"
37-
webserver = "None"
38-
versus = "None"

frameworks/C++/userver/userver-bare.dockerfile

Lines changed: 0 additions & 29 deletions
This file was deleted.

frameworks/C++/userver/userver.dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ RUN mkdir build && cd build && \
1414
-DUSERVER_FEATURE_UTEST=0 \
1515
-DUSERVER_FEATURE_POSTGRESQL=1 \
1616
-DUSERVER_FEATURE_ERASE_LOG_WITH_LEVEL=warning \
17-
-DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS="-march=native -flto=thin" -DCMAKE_C_FLAGS="-march=native -flto=thin" \
17+
-DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS="-march=native" -DCMAKE_C_FLAGS="-march=native" \
1818
-DCMAKE_CXX_COMPILER=clang++-16 -DCMAKE_C_COMPILER=clang-16 -DUSERVER_USE_LD=lld-16 \
1919
-DUSERVER_LTO=0 .. && \
2020
make -j $(nproc)

frameworks/C++/userver/userver_benchmark/userver_techempower.cpp

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -46,20 +46,6 @@ class NoopTracingManager final
4646
userver::server::http::HttpResponse&) const final {}
4747
};
4848

49-
class MinimalMiddlewarePipelineBuilder final
50-
: public userver::server::middlewares::PipelineBuilder {
51-
public:
52-
static constexpr std::string_view kName{
53-
"minimal-middleware-pipeline-builder"};
54-
using userver::server::middlewares::PipelineBuilder::PipelineBuilder;
55-
56-
private:
57-
userver::server::middlewares::MiddlewaresList BuildPipeline(
58-
userver::server::middlewares::MiddlewaresList) const override {
59-
return {"userver-unknown-exceptions-handling-middleware"};
60-
}
61-
};
62-
6349
int Main(int argc, char* argv[]) {
6450
auto component_list =
6551
userver::components::MinimalServerComponentList()
@@ -78,10 +64,9 @@ int Main(int argc, char* argv[]) {
7864
.Append<cached_queries::WorldCacheComponent>() // cache component
7965
.Append<cached_queries::Handler>()
8066
.Append<fortunes::Handler>()
81-
// tracing and metrics tweaks
67+
// tracing tweaks
8268
.Append<NoopTracingManager>()
83-
.Append<MinimalMiddlewarePipelineBuilder>()
84-
// bare
69+
// bare (not used in the benchmark currently)
8570
.Append<bare::SimpleRouter>()
8671
.Append<bare::SimpleServer>();
8772

frameworks/C++/userver/userver_configs/static_config.yaml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ components_manager:
1313
thread_name: main-worker # OS will show the threads of this task processor with 'main-worker' prefix.
1414
worker_threads: 48
1515
guess-cpu-limit: true
16-
task-processor-queue: work-stealing-task-queue
1716

1817
fs-task-processor: # Make a separate task processor for filesystem bound tasks.
1918
thread_name: fs-worker
@@ -29,7 +28,6 @@ components_manager:
2928
handler-defaults:
3029
set_tracing_headers: false
3130
server-name: us
32-
middleware-pipeline-builder: minimal-middleware-pipeline-builder
3331
simple-router:
3432
simple-server:
3533
port: 8081
@@ -63,7 +61,6 @@ components_manager:
6361
noop-tracing-manager:
6462
tracing-manager-locator:
6563
component-name: noop-tracing-manager
66-
minimal-middleware-pipeline-builder:
6764

6865
plaintext-handler:
6966
path: /plaintext

frameworks/C/h2o/h2o.dockerfile

Lines changed: 27 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,28 @@ FROM "ubuntu:${UBUNTU_VERSION}" AS compile
66

77
ARG DEBIAN_FRONTEND=noninteractive
88
RUN apt-get -yqq update && \
9+
apt-get -yqq install \
10+
ca-certificates \
11+
curl \
12+
lsb-release && \
13+
install -dm755 /usr/share/postgresql-common/pgdg && \
14+
curl --fail -LSso /usr/share/postgresql-common/pgdg/apt.postgresql.org.asc \
15+
"https://www.postgresql.org/media/keys/ACCC4CF8.asc" && \
16+
sh -c 'echo "deb [signed-by=/usr/share/postgresql-common/pgdg/apt.postgresql.org.asc] \
17+
https://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > \
18+
/etc/apt/sources.list.d/pgdg.list' && \
19+
apt-get -yqq update && \
920
apt-get -yqq install \
1021
autoconf \
1122
bison \
1223
cmake \
13-
curl \
1424
flex \
1525
g++ \
1626
libbpfcc-dev \
1727
libbrotli-dev \
1828
libcap-dev \
19-
libicu-dev \
2029
libnuma-dev \
21-
libreadline-dev \
30+
libpq-dev \
2231
libssl-dev \
2332
libtool \
2433
libuv1-dev \
@@ -57,18 +66,6 @@ RUN curl -LSs "https://github.com/x86-64/mustache-c/archive/${MUSTACHE_C_REVISIO
5766
CFLAGS="-flto -march=native -mtune=native -O3" ./autogen.sh && \
5867
make -j "$(nproc)" install
5968

60-
ARG POSTGRESQL_VERSION=a37bb7c13995b834095d9d064cad1023a6f99b10
61-
62-
WORKDIR /tmp/postgresql-build
63-
RUN curl -LSs "https://github.com/postgres/postgres/archive/${POSTGRESQL_VERSION}.tar.gz" | \
64-
tar --strip-components=1 -xz && \
65-
CFLAGS="-flto -march=native -mtune=native -O3" ./configure \
66-
--includedir=/usr/local/include/postgresql \
67-
--prefix=/usr/local \
68-
--with-ssl=openssl && \
69-
make -j "$(nproc)" -C src/include install && \
70-
make -j "$(nproc)" -C src/interfaces/libpq install
71-
7269
ARG H2O_APP_PREFIX
7370
WORKDIR /tmp/build
7471
COPY CMakeLists.txt ../
@@ -85,15 +82,28 @@ RUN cmake \
8582

8683
FROM "ubuntu:${UBUNTU_VERSION}"
8784

85+
ARG POSTGRESQL_VERSION=17
86+
8887
ARG DEBIAN_FRONTEND=noninteractive
8988
RUN apt-get -yqq update && \
89+
apt-get -yqq install \
90+
ca-certificates \
91+
curl \
92+
lsb-release && \
93+
install -dm755 /usr/share/postgresql-common/pgdg && \
94+
curl --fail -LSso /usr/share/postgresql-common/pgdg/apt.postgresql.org.asc \
95+
"https://www.postgresql.org/media/keys/ACCC4CF8.asc" && \
96+
sh -c 'echo "deb [signed-by=/usr/share/postgresql-common/pgdg/apt.postgresql.org.asc] \
97+
https://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > \
98+
/etc/apt/sources.list.d/pgdg.list' && \
99+
apt-get -yqq update && \
90100
apt-get -yqq install \
91101
libnuma1 \
92-
libyajl2
102+
libyajl2 \
103+
"postgresql-client-${POSTGRESQL_VERSION}"
93104
ARG H2O_APP_PREFIX
94105
COPY --from=compile "${H2O_APP_PREFIX}" "${H2O_APP_PREFIX}/"
95106
COPY --from=compile /usr/local/lib/libmustache_c.so "${H2O_APP_PREFIX}/lib/"
96-
COPY --from=compile /usr/local/lib/libpq.so.5.17 "${H2O_APP_PREFIX}/lib/libpq.so.5"
97107
ENV LD_LIBRARY_PATH="${H2O_APP_PREFIX}/lib"
98108
EXPOSE 8080
99109
ARG BENCHMARK_ENV

frameworks/CSharp/appmpower/src/appMpower.Orm/Data/DbCommand.cs

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,6 @@ public DbCommand(string commandText, DbConnection dbConnection)
2020
_dbConnection = dbConnection;
2121
}
2222

23-
public DbCommand(string commandText, DbConnection dbConnection, bool keyed)
24-
{
25-
_odbcCommand = dbConnection.GetCommand(commandText, CommandType.Text, keyed);
26-
_dbConnection = dbConnection;
27-
}
28-
2923
public DbCommand(string commandText, CommandType commandType, DbConnection dbConnection)
3024
{
3125
_odbcCommand = dbConnection.GetCommand(commandText, commandType);
@@ -175,14 +169,19 @@ public IDataReader ExecuteReader()
175169

176170
public async Task<int> ExecuteNonQueryAsync()
177171
{
178-
return await (_odbcCommand as System.Data.Common.DbCommand).ExecuteNonQueryAsync();
172+
return await _odbcCommand.ExecuteNonQueryAsync();
179173
}
180174

181175
public IDataReader ExecuteReader(CommandBehavior behavior)
182176
{
183177
return _odbcCommand.ExecuteReader(behavior);
184178
}
185179

180+
public async Task<System.Data.Common.DbDataReader> ExecuteReaderAsync(CommandBehavior behavior)
181+
{
182+
return await _odbcCommand.ExecuteReaderAsync(behavior);
183+
}
184+
186185
#nullable enable
187186
public object? ExecuteScalar()
188187
{
@@ -197,8 +196,7 @@ public void Prepare()
197196

198197
public void Dispose()
199198
{
200-
if (_dbConnection._keyed) _dbConnection._keyedOdbcCommands.TryAdd(_odbcCommand.CommandText, _odbcCommand);
201-
else _dbConnection._odbcCommands.Push(_odbcCommand);
199+
_dbConnection.Release(_odbcCommand);
202200
}
203201
}
204202
}

0 commit comments

Comments
 (0)