Search code examples
javapostgresqldockerdocker-composedocker-for-windows

Docker volume mapping + windows = incredible slow?


I am currently trying to copy data from my postgres, which runs within a docker-container, to my windows host. For this purpose I implemented a java application (also within a docker container) that uses the postgres-jdbc driver and its CopyManager in order to copy specific data to the host in mapped volume.

Problem: When I copy the data to the mapped windows directory, it becomes very slow. (Writing 1 GB of data takes about 40 minutes - without volume mapping only 1 minute)

Docker-compose:

  exportservice:
    build: ./services/exportservice
    volumes:
      - samplePath:/export_data

I have already read that it's a known problem, but I haven't found a suitable solution. My services have to run in a production environment that is based on Windows. So what's the way to solve this issue? WSL2?

Looking forward to your advice!


Solution

  • Use WSL2 instead of WSL and use the Linux file system. But you could also reduce your write cycles in order to reduce the writing overhead. This could be achieved by using a BufferedWriter in Java.