Trellis / Vagrant Is terrible slow

Hi.

I’m on MacOs, with i9. And I can see that local sites are terrible slow. I’m using now Parallels, but with VirtualBox was the same.

Even change to:
vagrant_cpus: 8
vagrant_memory: 8192 # in MB

Don’t make the site works better. Comparing to LocalWp it’s 500-1000% slower when navigating admin pages. Is there any way to speed up trellis with other settings rather giving more CPU/RAM to Vagrant?

When working with browser sync, 1/4 times page crash on PHP error, because the refresh is fired but the file is not fully copied to virtual machine and crashes. That makes me crazy.

I was doing some tests on clean Wordpress, without any plugin, and it’s still much slower from LocalWP.

Anyone else have similar issues and a good fix for it? :slight_smile:

Thanks,
Lukas.

The I/O is probably the bottleneck here, same with containers (WSL 2 native-Linux filesystem crossing).

Can you optimize the way the files are mounted into the VirtualBox VM?
Can you use a different VirtualBox provider (hypervisor)?

I’ve had poor localhost performance as well, but have been able to improve quite a bit over time. I have four observations to share:

  1. Balanced CPU/RAM ratios. I tried increasing CPU’s and MB’s as you have, and then I came across an interesting explanation about the deleterious effects of too many procs in this context. I wish I could remember the explanation (or at least have the link to share), but I can’t find that info right now (I’ll add it to this thread if I find it again). The bottom line is that experimenting with the topic a bit, I found that a good balance for me was 1 CPU and 2048 MB. This combo is currently working well for me on a 4 year-old iMac (64 GB RAM), a 10 year-old iMac (12 GB RAM), and a new M1 (64 GB RAM). On the rare occasion I need to grow CPU count, my RAM GB’s are almost always twice the CPU count (or more).

  2. Nginx and PHP settings. I usually start with the following in my group_vars/development/main.yml:

     nginx_fastcgi_buffers: 32 32k
     nginx_fastcgi_buffer_size: 64k
     nginx_fastcgi_read_timeout: 360s
    
     php_max_execution_time: 360
     php_max_input_time: 640
     php_max_input_vars: 2000
     php_memory_limit: 1024M
    
  3. Multiple VM’s running at the same time. Running multiple boxes simultaneously works well with unique IP’s (per VM), but perf improved when I also specified unique host ports by adding something like config.vm.network :forwarded_port, guest: 22, host: 2005, id: "ssh", auto_correct: true …in the… Vagrant.configure('2') do |config| block of my Vagrantfile.

  4. Performance is not consistent throughout the day. Whenever I go through occasional slow periods even though other sessions are quite fast, I look for slow or extraneous processes to shut down. I usually find something running in browser tabs that I don’t need.

Admittedly, I’ve not yet been able to match the performance of certain other tools (including Local), but I’m getting closer (quite close, in fact). If I account for the benefits of this toolset, the remaining (minor) perf challenges are usually acceptable to me.

3 Likes

Time Machine can slow it down.

See also if another service is synchronising, such as iCloud.

I switched to Parallels Desktop Pro and the speed is reasonable.