danielgormly / statamic-nginx-docker

Basic Statamic & Nginx Docker Setup
29 stars 9 forks source link

Incredibly Slow on Mac #7

Open Sylk opened 4 years ago

Sylk commented 4 years ago

I'm not sure if it's a Docker problem or it's this docker container particularly. But I'm trying to get this to run and a single login request takes 4.1 seconds to process.

What can I do to increase the speed of this? At this point I'm considering Valet instead of the Docker approach.

smlparry commented 4 years ago

Hey @Sylk, I was having the same issue as you, turns out its a docker issue where I/O assess is very slow on Mac

I used this article to setup an nfs mounted volume, and now Im getting much faster speeds, highly recommend: https://medium.com/@sean.handley/how-to-set-up-docker-for-mac-with-native-nfs-145151458adc

rizkysyazuli commented 4 years ago

As mentioned before. The file sync operation between your mac's file system and the container is very slow. The trick is to enable the delegated or cached flags when mounting your volumes.

nginx:
    volumes:
      - './statamic:/var/www/statamic-site:delegated'

The default is consistent, this means perfect consistency between the host and container files. Which takes a lot of resources. But those two flags allows for some delays. Read more about it here.

And.. you might also want to increase the CPU amount in the Resource settings.

EDIT: honestly, i use Valet on my Mac. The above trick helps, but the speed of development is still slower than native/locally installed servers.

smlparry commented 4 years ago

Yeah, I ended up going with valet too. I would prefer docker, but yeah the performance is miles better with Valet.

Thats interesting though! Ive never seen that before, thanks!

oranges13 commented 3 years ago

Docker on Mac has been having a ton of issues since they updated to 3.x -- highly suggest you downgrade to 2.5.0.1 as that was the last stable version. So this isn't an issue with this repo, but an issue with Docker for Mac recently.

See https://github.com/docker/for-mac/issues/5406, https://github.com/docker/for-mac/issues/4957