Skip to content
Merged

aa #29

Show file tree
Hide file tree
Changes from all commits
Commits
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: 0 additions & 2 deletions frameworks/C++/cppcms/benchmark_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,8 @@
"notes": ""
},
"postgres": {
"json_url": "/json",
"db_url": "/db",
"fortune_url": "/fortunes",
"plaintext_url": "/plaintext",
"cached_query_url": "/cached-worlds/",
"port": 8080,
"approach": "Realistic",
Expand Down
4 changes: 0 additions & 4 deletions frameworks/C++/lithium/benchmark_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,10 @@
"versus": "None"
},
"postgres": {
"json_url" : "/json",
"db_url" : "/db",
"query_url" : "/queries?N=",
"fortune_url" : "/fortunes",
"update_url" : "/updates?N=",
"plaintext_url" : "/plaintext",
"cached_query_url": "/cached-worlds?N=",
"port": 8080,
"approach": "Realistic",
Expand All @@ -51,12 +49,10 @@
"versus": "None"
},
"postgres-beta": {
"json_url" : "/json",
"db_url" : "/db",
"query_url" : "/queries?N=",
"fortune_url" : "/fortunes",
"update_url" : "/updates?N=",
"plaintext_url" : "/plaintext",
"cached_query_url": "/cached-worlds?N=",
"port": 8080,
"approach": "Realistic",
Expand Down
20 changes: 18 additions & 2 deletions frameworks/C/h2o/h2o.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@ RUN apt-get -yqq update && \
g++ \
libbrotli-dev \
libcap-dev \
libicu-dev \
libnuma-dev \
libpq-dev \
libreadline-dev \
libssl-dev \
libtool \
libuv1-dev \
Expand All @@ -25,6 +26,7 @@ RUN apt-get -yqq update && \
libz-dev \
make \
ninja-build \
patch \
pkg-config \
systemtap-sdt-dev

Expand Down Expand Up @@ -52,6 +54,20 @@ RUN curl -LSs "https://github.com/x86-64/mustache-c/archive/${MUSTACHE_C_REVISIO
CFLAGS="-flto -march=native -mtune=native -O3" ./autogen.sh && \
make -j "$(nproc)" install

ARG POSTGRESQL_VERSION=7b7fa85130330128b404eddebd4f33c6739454b0

WORKDIR /tmp/postgresql-build
RUN curl -LSs "https://github.com/postgres/postgres/archive/${POSTGRESQL_VERSION}.tar.gz" | \
tar --strip-components=1 -xz && \
curl -LSs "https://www.postgresql.org/message-id/attachment/146614/v2-0001-Add-PQsendSyncMessage-to-libpq.patch" | \
patch -Np1 && \
CFLAGS="-flto -march=native -mtune=native -O3" ./configure \
--includedir=/usr/local/include/postgresql \
--prefix=/usr/local \
--with-ssl=openssl && \
make -j "$(nproc)" -C src/include install && \
make -j "$(nproc)" -C src/interfaces/libpq install

ARG H2O_APP_PREFIX
WORKDIR /tmp/build
COPY CMakeLists.txt ../
Expand All @@ -72,11 +88,11 @@ ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get -yqq update && \
apt-get -yqq install \
libnuma1 \
libpq5 \
libyajl2
ARG H2O_APP_PREFIX
COPY --from=compile "${H2O_APP_PREFIX}" "${H2O_APP_PREFIX}/"
COPY --from=compile /usr/local/lib/libmustache_c.so "${H2O_APP_PREFIX}/lib/"
COPY --from=compile /usr/local/lib/libpq.so.5.16 "${H2O_APP_PREFIX}/lib/libpq.so.5"
ENV LD_LIBRARY_PATH="${H2O_APP_PREFIX}/lib"
EXPOSE 8080
ARG BENCHMARK_ENV
Expand Down
44 changes: 30 additions & 14 deletions frameworks/C/h2o/src/database.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ typedef struct {
} prepared_statement_t;

static h2o_socket_t *create_socket(int sd, h2o_loop_t *loop);
static int do_execute_query(db_conn_t *conn, db_query_param_t *param);
static int do_execute_query(db_conn_t *conn, db_query_param_t *param, bool flush);
static void error_notification(db_conn_pool_t *pool, bool timeout, const char *error_string);
static void on_database_connect_error(db_conn_t *conn, bool timeout, const char *error_string);
static void on_database_connect_read_ready(h2o_socket_t *sock, const char *err);
Expand Down Expand Up @@ -104,7 +104,7 @@ static h2o_socket_t *create_socket(int sd, h2o_loop_t *loop)
return ret;
}

static int do_execute_query(db_conn_t *conn, db_query_param_t *param)
static int do_execute_query(db_conn_t *conn, db_query_param_t *param, bool flush)
{
assert(conn->query_num);
assert((conn->queries.head && conn->query_num < conn->pool->config->max_pipeline_query_num) ||
Expand Down Expand Up @@ -132,19 +132,21 @@ static int do_execute_query(db_conn_t *conn, db_query_param_t *param)
return 1;
}

if (!PQpipelineSync(conn->conn)) {
LIBRARY_ERROR("PQpipelineSync", PQerrorMessage(conn->conn));
if (!PQsendSyncMessage(conn->conn)) {
LIBRARY_ERROR("PQsendSyncMessage", PQerrorMessage(conn->conn));
return 1;
}

const int send_status = PQflush(conn->conn);
if (flush) {
const int send_status = PQflush(conn->conn);

if (send_status < 0) {
LIBRARY_ERROR("PQflush", PQerrorMessage(conn->conn));
return 1;
if (send_status < 0) {
LIBRARY_ERROR("PQflush", PQerrorMessage(conn->conn));
return 1;
}
else if (send_status)
h2o_socket_notify_write(conn->sock, on_database_write_ready);
}
else if (send_status)
h2o_socket_notify_write(conn->sock, on_database_write_ready);

if (!conn->queries.head && !(conn->flags & (EXPECT_SYNC | IGNORE_RESULT))) {
assert(!h2o_timer_is_linked(&conn->timer));
Expand Down Expand Up @@ -527,8 +529,8 @@ static void prepare_statements(db_conn_t *conn)
iter = iter->next;
} while (iter);

if (!PQpipelineSync(conn->conn)) {
LIBRARY_ERROR("PQpipelineSync", PQerrorMessage(conn->conn));
if (!PQsendSyncMessage(conn->conn)) {
LIBRARY_ERROR("PQsendSyncMessage", PQerrorMessage(conn->conn));
on_database_connect_error(conn, false, DB_ERROR);
return;
}
Expand All @@ -547,6 +549,8 @@ static void prepare_statements(db_conn_t *conn)

static void process_queries(db_conn_t *conn)
{
const bool flush = conn->query_num && conn->pool->queries.head;

while (conn->query_num && conn->pool->queries.head) {
db_query_param_t * const param = H2O_STRUCT_FROM_MEMBER(db_query_param_t,
l,
Expand All @@ -559,7 +563,7 @@ static void process_queries(db_conn_t *conn)

conn->pool->queries.head = param->l.next;

if (do_execute_query(conn, param)) {
if (do_execute_query(conn, param, false)) {
param->on_error(param, DB_ERROR);

if (PQstatus(conn->conn) != CONNECTION_OK) {
Expand All @@ -569,6 +573,18 @@ static void process_queries(db_conn_t *conn)
}
}

if (flush) {
const int send_status = PQflush(conn->conn);

if (send_status < 0) {
LIBRARY_ERROR("PQflush", PQerrorMessage(conn->conn));
on_database_error(conn, DB_ERROR);
return;
}
else if (send_status)
h2o_socket_notify_write(conn->sock, on_database_write_ready);
}

if (!conn->queries.head && !(conn->flags & (EXPECT_SYNC | IDLE | IGNORE_RESULT))) {
conn->l.next = conn->pool->conn;
conn->pool->conn = &conn->l;
Expand Down Expand Up @@ -657,7 +673,7 @@ int execute_database_query(db_conn_pool_t *pool, db_query_param_t *param)
assert(conn->flags & IDLE);
assert(!(conn->flags & (EXPECT_SYNC | IGNORE_RESULT)));
pool->conn = conn->l.next;
ret = do_execute_query(conn, param);
ret = do_execute_query(conn, param, true);

if (ret) {
if (PQstatus(conn->conn) == CONNECTION_OK) {
Expand Down
5 changes: 1 addition & 4 deletions frameworks/Haskell/ihp/ihp.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,8 @@ WORKDIR /ihp
RUN nix-env -i cachix
RUN cachix use digitallyinduced

# Warmup docker build cache
RUN nix-shell -j auto --cores 0 --command "echo ok"

# Build
RUN nix-build
RUN nix-build -j auto --cores 0

# Setup
ENV DATABASE_URL=postgres://benchmarkdbuser:benchmarkdbpass@tfb-database:5432/hello_world
Expand Down
2 changes: 1 addition & 1 deletion frameworks/Haskell/ihp/src/default.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
let
ihp = builtins.fetchGit {
url = "https://github.com/digitallyinduced/ihp.git";
ref = "refs/tags/v0.20.0";
ref = "refs/tags/v1.0.1";
};
haskellEnv = import "${ihp}/NixSupport/default.nix" {
ihp = ihp;
Expand Down
2 changes: 1 addition & 1 deletion frameworks/Java/micronaut/gradle.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
micronautVersion = 3.9.0
micronautVersion = 3.9.1
2 changes: 1 addition & 1 deletion frameworks/PHP/mark/composer.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"require": {
"mark-php/mark": "^1.1"
"mark-php/mark": "^v2"
}
}
1 change: 1 addition & 0 deletions frameworks/PHP/mark/mark.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ ADD ./ /mark
WORKDIR /mark

RUN composer install --optimize-autoloader --classmap-authoritative --no-dev --quiet
RUN sed -i "s|opcache.jit=off|opcache.jit=tracing|g" /etc/php/8.2/cli/conf.d/10-opcache.ini

EXPOSE 8080

Expand Down
4 changes: 3 additions & 1 deletion frameworks/PHP/mark/start.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

$api = new App('http://0.0.0.0:8080');

$api->name = "Mark";

$api->count = (int) shell_exec('nproc');

$api->any('/plaintext', function () {
Expand All @@ -27,7 +29,7 @@

$date = gmdate('D, d M Y H:i:s').' GMT';

$api->onWorkerStart = function () {
$api->onWorkerStart = static function () {
Timer::add(1, function () {
global $date;
$date = gmdate('D, d M Y H:i:s').' GMT';
Expand Down
6 changes: 3 additions & 3 deletions frameworks/PHP/php-ngx/php-ngx-async.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ RUN LC_ALL=C.UTF-8 add-apt-repository ppa:ondrej/php > /dev/null && \
RUN apt-get update -yqq > /dev/null && \
apt-get install -yqq wget git libxml2-dev systemtap-sdt-dev \
zlib1g-dev libpcre3-dev libargon2-0-dev libsodium-dev \
php8.1-cli php8.1-dev libphp8.1-embed php8.1-mysql > /dev/null
php8.2-cli php8.2-dev libphp8.2-embed php8.2-mysql > /dev/null

ADD . .

ENV NGINX_VERSION 1.24.0

RUN git clone -b v0.0.26 --single-branch --depth 1 https://github.com/rryqszq4/ngx_php7.git > /dev/null
RUN git clone -b v0.0.27 --single-branch --depth 1 https://github.com/rryqszq4/ngx_php7.git > /dev/null

RUN wget -q http://nginx.org/download/nginx-${NGINX_VERSION}.tar.gz && \
tar -zxf nginx-${NGINX_VERSION}.tar.gz && \
Expand All @@ -28,7 +28,7 @@ RUN wget -q http://nginx.org/download/nginx-${NGINX_VERSION}.tar.gz && \
--add-module=/ngx_php7/third_party/ngx_devel_kit \
--add-module=/ngx_php7 > /dev/null && \
make > /dev/null && make install > /dev/null
RUN sed -i "s|opcache.jit=off|;opcache.jit=off|g" /etc/php/8.1/embed/conf.d/10-opcache.ini
RUN sed -i "s|opcache.jit=off|;opcache.jit=off|g" /etc/php/8.2/embed/conf.d/10-opcache.ini

EXPOSE 8080

Expand Down
4 changes: 2 additions & 2 deletions frameworks/PHP/php-ngx/php-ngx-mysql.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ RUN LC_ALL=C.UTF-8 add-apt-repository ppa:ondrej/php > /dev/null && \
RUN apt-get update -yqq > /dev/null && \
apt-get install -yqq wget git libxml2-dev systemtap-sdt-dev \
zlib1g-dev libpcre3-dev libargon2-0-dev libsodium-dev \
php8.1-cli php8.1-dev libphp8.1-embed php8.1-mysql > /dev/null
php8.2-cli php8.2-dev libphp8.2-embed php8.2-mysql > /dev/null
ADD . .

ENV NGINX_VERSION 1.24.0

RUN git clone -b v0.0.26 --single-branch --depth 1 https://github.com/rryqszq4/ngx-php.git > /dev/null
RUN git clone -b v0.0.27 --single-branch --depth 1 https://github.com/rryqszq4/ngx-php.git > /dev/null

RUN wget -q http://nginx.org/download/nginx-${NGINX_VERSION}.tar.gz && \
tar -zxf nginx-${NGINX_VERSION}.tar.gz && \
Expand Down
6 changes: 3 additions & 3 deletions frameworks/PHP/php-ngx/php-ngx-pgsql.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ RUN LC_ALL=C.UTF-8 add-apt-repository ppa:ondrej/php > /dev/null && \
RUN apt-get update -yqq > /dev/null && \
apt-get install -yqq wget git libxml2-dev systemtap-sdt-dev \
zlib1g-dev libpcre3-dev libargon2-0-dev libsodium-dev \
php8.1-cli php8.1-dev libphp8.1-embed php8.1-pgsql > /dev/null
php8.2-cli php8.2-dev libphp8.2-embed php8.2-pgsql > /dev/null
ADD . .

ENV NGINX_VERSION 1.24.0

RUN git clone -b v0.0.26 --single-branch --depth 1 https://github.com/rryqszq4/ngx-php.git > /dev/null
RUN git clone -b v0.0.27 --single-branch --depth 1 https://github.com/rryqszq4/ngx-php.git > /dev/null

RUN wget -q http://nginx.org/download/nginx-${NGINX_VERSION}.tar.gz && \
tar -zxf nginx-${NGINX_VERSION}.tar.gz && \
Expand All @@ -32,7 +32,7 @@ RUN sed -i "s|app.php|app-pg.php|g" /deploy/nginx.conf

RUN export WORKERS=$(( 4 * $(nproc) )) && \
sed -i "s|worker_processes auto|worker_processes $WORKERS|g" /deploy/nginx.conf
RUN sed -i "s|opcache.jit=off|opcache.jit=function|g" /etc/php/8.1/embed/conf.d/10-opcache.ini
RUN sed -i "s|opcache.jit=off|opcache.jit=function|g" /etc/php/8.2/embed/conf.d/10-opcache.ini
EXPOSE 8080

CMD /nginx/sbin/nginx -c /deploy/nginx.conf
6 changes: 3 additions & 3 deletions frameworks/PHP/php-ngx/php-ngx.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ RUN LC_ALL=C.UTF-8 add-apt-repository ppa:ondrej/php > /dev/null && \
RUN apt-get update -yqq > /dev/null && \
apt-get install -yqq wget git libxml2-dev systemtap-sdt-dev \
zlib1g-dev libpcre3-dev libargon2-0-dev libsodium-dev \
php8.1-cli php8.1-dev libphp8.1-embed php8.1-mysql > /dev/null
php8.2-cli php8.2-dev libphp8.2-embed php8.2-mysql
ADD . .

ENV NGINX_VERSION 1.24.0

RUN git clone -b v0.0.26 --single-branch --depth 1 https://github.com/rryqszq4/ngx-php.git > /dev/null
RUN git clone -b v0.0.27 --single-branch --depth 1 https://github.com/rryqszq4/ngx-php.git > /dev/null

RUN wget -q http://nginx.org/download/nginx-${NGINX_VERSION}.tar.gz && \
tar -zxf nginx-${NGINX_VERSION}.tar.gz && \
Expand All @@ -27,7 +27,7 @@ RUN wget -q http://nginx.org/download/nginx-${NGINX_VERSION}.tar.gz && \
--add-module=/ngx-php/third_party/ngx_devel_kit \
--add-module=/ngx-php > /dev/null && \
make > /dev/null && make install > /dev/null
RUN sed -i "s|opcache.jit=off|;opcache.jit=off|g" /etc/php/8.1/embed/conf.d/10-opcache.ini
RUN sed -i "s|opcache.jit=off|;opcache.jit=off|g" /etc/php/8.2/embed/conf.d/10-opcache.ini

EXPOSE 8080

Expand Down
2 changes: 2 additions & 0 deletions frameworks/PHP/spiral/.env
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@ DB_DSN=mysql:host=tfb-database:3306;charset=utf8;dbname=hello_world;user=benchma

# Set to application specific value, used to encrypt/decrypt cookies and etc.
ENCRYPTER_KEY=def00000f6f989c4ba99b5eec3dcd4f5b0fb7e5fbbf95d3cacb6b7ed049e22b4a931db7ad59085225b36d051fb06530c8a41b83d10761439326656536293473c2472d911

TOKENIZER_CACHE_TARGETS=true
2 changes: 1 addition & 1 deletion frameworks/PHP/spiral/.rr.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: '2.7'
version: '3'

rpc:
listen: tcp://127.0.0.1:6001
Expand Down
6 changes: 3 additions & 3 deletions frameworks/PHP/spiral/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ Benchmark code is located in `app/src/Controllers/BenchmarkController.php`.

## Infrastructure and Versions
The tests were run with:
* [Spiral Framework Version 2](https://github.com/spiral/framework/)
* [Spiral Framework Version 3.7](https://github.com/spiral/framework/)
* [Spiral/Stempler](https://github.com/spiral/stempler) as template engine
* [Cycle ORM 2.*](https://github.com/cycle/orm)
* [RoadRunner 2.*](https://roadrunner.dev/)
* [PHP Version 8.0.*](http://www.php.net/) in CLI mode with OPCache
* [RoadRunner 2023.*](https://roadrunner.dev/)
* [PHP Version 8.2.*](http://www.php.net/) in CLI mode with OPCache

## Test URLs
Test | URL
Expand Down
Loading