docker run --rm \
--name postgresql \
-e POSTGRES_PASSWORD=postgres \
-d \
-p 5432:5432 \
--cpuset-cpus="0-1" \
--cpus 2.0 \
-m=1024m \
--mount type=bind,source=$HOME/docker/volumes/postgres,target=/var/lib/postgresql/data \
postgres:12.2
native results on a digitalocean VM: $ pgbench -c 100 -j 2 -T 60 postgres
starting vacuum...end.
transaction type: <builtin: TPC-B (sort of)>
scaling factor: 1
query mode: simple
number of clients: 100
number of threads: 2
duration: 60 s
number of transactions actually processed: 17660
latency average = 342.761 ms
tps = 291.748482 (including connections establishing)
tps = 291.791293 (excluding connections establishing)
in a docker container: starting vacuum...end.
transaction type: <builtin: TPC-B (sort of)>
scaling factor: 1
query mode: simple
number of clients: 100
number of threads: 2
duration: 60 s
number of transactions actually processed: 13014
latency average = 466.928 ms
tps = 214.165822 (including connections establishing)
tps = 214.199201 (excluding connections establishing)
214tps in docker, 291tps outside of docker26% decrease, with a bind mount on ubuntu 18.04