Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

No. Docker volumes aka bind mounts have little or no overhead. You don't want to run a database in an ephemeral "cattle" container without some kind of HA because you'd lose data.


    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 docker

26% decrease, with a bind mount on ubuntu 18.04


Docker introduces all kinds of performance issues. I for example noticed higher latency even with just pgbouncer. It was very visible when running integration tests, which normally took 15 minutes, but as a container it was 45min - 1h.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: