Skip to content

Commit 8b37a5e

Browse files
author
Vasilyev Dmitriy Viktorovich
committed
npgsql batch research
2 parents d11916c + 125a3f5 commit 8b37a5e

File tree

8 files changed

+98
-23
lines changed

8 files changed

+98
-23
lines changed

.github/workflows/build-packages.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ jobs:
4545
wget -q https://static.rust-lang.org/dist/rust-1.84.1-x86_64-unknown-linux-gnu.tar.gz -O /tmp/rust.tar.gz &&
4646
cd /tmp && tar xf rust.tar.gz && ./rust-*-x86_64-unknown-linux-gnu/install.sh
4747
- name: Build binaries in release mode
48-
run: cargo build --release
48+
run: JEMALLOC_SYS_WITH_MALLOC_CONF="dirty_decay_ms:30000,muzzy_decay_ms:30000,background_thread:true,metadata_thp:auto" cargo build --release
4949
- name: Prepare output dir
5050
run: mkdir -p ./build_package/usr/bin && install ./target/release/pg_doorman ./build_package/usr/bin && mkdir -p ./out/
5151
- name: Check versions
@@ -88,7 +88,7 @@ jobs:
8888
wget -q https://static.rust-lang.org/dist/rust-1.84.1-x86_64-unknown-linux-gnu.tar.gz -O /tmp/rust.tar.gz &&
8989
cd /tmp && tar xf rust.tar.gz && ./rust-*-x86_64-unknown-linux-gnu/install.sh
9090
- name: Build binaries in release mode
91-
run: cargo build --release
91+
run: JEMALLOC_SYS_WITH_MALLOC_CONF="dirty_decay_ms:30000,muzzy_decay_ms:30000,background_thread:true,metadata_thp:auto" cargo build --release
9292
- name: Prepare output dir
9393
run: mkdir -p ./build_package/usr/bin && install ./target/release/pg_doorman ./build_package/usr/bin && mkdir -p ./out/
9494
- name: Check versions

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
# 1.8.1 (Apr 06th, 2025)
2+
3+
### Fixed
4+
5+
- fix config value of prepared_statements #21.
6+
- close declared cursors #23.
7+
- proxy server parameters #25.
8+
19
# 1.8.0 (Mar 20th, 2025)
210

311
### Fixed

Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ install: build
1919

2020
test:
2121
cargo test
22-
./tests/tests.sh
2322

2423
clippy:
2524
cargo clippy -- --deny "warnings"
25+
26+
include docker-compose-tests.mk

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ With docker compose:
6060
2. Run `cargo build --release` to get better benchmarks.
6161
3. Adjust the configuration in `pg_doorman.toml` to match your setup (this step is optional, given next).
6262
4. Execute `cargo run --release`. You're now ready to go!
63+
5. Also, you can use `make docker-compose-test-all` for testing with docker.
6364

6465
### Benchmarks
6566

docker-compose-tests.mk

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
docker-compose-test-all: docker-compose-test-go docker-compose-test-dotnet docker-compose-test-nodejs docker-compose-test-python docker-compose-test-ruby
2+
echo ok
3+
4+
docker-compose-up:
5+
docker compose down --remove-orphans
6+
docker compose up -d
7+
sleep 2
8+
9+
docker-compose-test-go: docker-compose-up
10+
docker compose exec -T go_test /bin/bash -ec ' \
11+
cd /tests && source ./env && \
12+
go test -v .'
13+
14+
docker-compose-test-python: docker-compose-up
15+
docker compose exec -T python_test /bin/bash -ec ' \
16+
cd /tests && \
17+
python ./test_async.py && \
18+
python ./test_psycopg2.py && \
19+
python ./test_session_cursors.py'
20+
21+
docker-compose-test-nodejs: docker-compose-up
22+
docker compose exec -T nodejs_test /bin/bash -ec ' \
23+
cd /tests && npm install pg && \
24+
nodejs ./run.js'
25+
26+
docker-compose-test-ruby: docker-compose-up
27+
docker compose exec -T ruby_test /bin/bash -ec ' \
28+
cd /tests && bundle config path ruby && cd ruby && bundle install && \
29+
bundle exec ruby test.rb && \
30+
install /usr/bin/pg_doorman /tests/ && \
31+
bundle exec rspec *_spec.rb'
32+
33+
docker-compose-test-dotnet: docker-compose-up
34+
docker compose exec -T dotnet_test /bin/bash -ec 'mkdir -p /tests/prj && cd /tests/prj && \
35+
rm -rf ./batch && mkdir -p ./batch && cd ./batch && dotnet new sln --name Batch && dotnet new console --output . && dotnet add package Npgsql && cp -av ../../data/batch.cs ./Program.cs && dotnet run Program.cs && \
36+
cd .. && rm -rf ./prepared && mkdir -p ./prepared && cd ./prepared && dotnet new sln --name Prepared && dotnet new console --output . && dotnet add package Npgsql && cp -av ../../data/prepared.cs ./Program.cs && dotnet run Program.cs && \
37+
cd .. && rm -rf ./pbde2 && mkdir -p ./pbde2 && cd ./pbde2 && dotnet new sln --name PBDE2 && dotnet new console --output . && dotnet add package Npgsql && cp -av ../../data/PBDE_PBDE_S.cs ./Program.cs && dotnet run Program.cs'

docker-compose.yaml

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@ services:
1212
- POSTGRES_HOST_AUTH_METHOD=trust
1313
volumes:
1414
- ./tests/fixture.sql:/docker-entrypoint-initdb.d/fixture.sql
15-
ports:
16-
- "5432:5432"
1715
healthcheck:
1816
test: [ "CMD-SHELL", "pg_isready -U postgres" ]
1917
interval: 30s
@@ -25,8 +23,6 @@ services:
2523

2624
pg_doorman:
2725
network_mode: "host"
28-
ports:
29-
- "6433:6433"
3026
build:
3127
dockerfile: tests/pg_doorman.Dockerfile
3228
working_dir: /
@@ -42,35 +38,38 @@ services:
4238
dockerfile: tests/go_cache.Dockerfile
4339
working_dir: /
4440
network_mode: "host"
45-
profiles:
46-
- tests
47-
- tests-go
4841
volumes:
4942
- ./tests/go:/tests
50-
command: /bin/bash -ec 'cd /tests && source ./env && go test -v .'
51-
restart: no
43+
command: /bin/sleep infinity
5244

5345
python_test:
5446
build:
5547
dockerfile: tests/python_cache.Dockerfile
5648
network_mode: "host"
57-
profiles:
58-
- tests
59-
- tests-python
6049
volumes:
6150
- ./tests/python:/tests
62-
command: /bin/bash -ec 'cd /tests && python ./test_async.py && python ./test_psycopg2.py && python ./test_session_cursors.py'
63-
restart: no
51+
command: /bin/sleep infinity
52+
53+
nodejs_test:
54+
build:
55+
dockerfile: tests/nodejs_test.Dockerfile
56+
network_mode: "host"
57+
volumes:
58+
- ./tests/nodejs:/tests
59+
command: /bin/sleep infinity
60+
61+
ruby_test:
62+
build:
63+
dockerfile: tests/ruby_test.Dockerfile
64+
network_mode: "host"
65+
volumes:
66+
- ./tests:/tests
67+
command: /bin/sleep infinity
6468

6569
dotnet_test:
6670
build:
6771
dockerfile: tests/dotnet_test.Dockerfile
6872
network_mode: "host"
69-
profiles:
70-
- tests
71-
- tests-dotnet
7273
volumes:
7374
- ./tests/dotnet:/tests
74-
command: /bin/bash -ec 'cd /tests/prj &&
75-
rm -rf ./batch && mkdir -p ./batch && cd ./batch && dotnet new sln --name Batch && dotnet new console --output . && dotnet add package Npgsql && cp -av ../../data/batch.cs ./Program.cs && dotnet run Program.cs'
76-
restart: no
75+
command: /bin/sleep infinity

tests/nodejs_test.Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
FROM node:23-bookworm

tests/ruby_test.Dockerfile

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
FROM rust:1.75.0-slim-bookworm AS builder
2+
3+
RUN apt-get update && \
4+
apt-get install -y build-essential pkg-config libssl-dev
5+
6+
# cache
7+
COPY Cargo.toml Cargo.lock ./
8+
COPY patches ./patches
9+
RUN mkdir src && echo "fn main() {}" > src/main.rs
10+
RUN cargo fetch
11+
RUN cargo build --release
12+
RUN rm -rf src
13+
14+
# build doorman
15+
COPY src ./src
16+
RUN cargo build --release
17+
18+
FROM ubuntu:24.04
19+
20+
RUN apt-get update && apt-get install -y ruby-bundler ruby-dev build-essential \
21+
bison openssl curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev \
22+
libxml2-dev autoconf libc6-dev ncurses-dev automake libtool postgresql-server-dev-all
23+
WORKDIR /tests
24+
RUN bundle config path ruby
25+
COPY ./tests/ruby/Gemfile .
26+
RUN bundle install
27+
28+
COPY --from=builder /target/release/pg_doorman /usr/bin/pg_doorman

0 commit comments

Comments
 (0)