Very slow sites when running BOA from vagrant

lsolesen's picture

Running VirtualBox 4.2.4 on a MacOS Lion and the BOA instance has 2 GB of RAM and Barracuda 2.04.

I have created a VM with Barracuda setup. I followed these guidelines:

http://larsolesen.dk/node/358

I managed to mount the static directory for my users like this in the Vagrantfile.

  config.vm.share_folder "platforms-o1", "/data/disk/o1/static", "~/workspace/platforms-o1", :extra => "dmode=755,fmode=755,gid=100,uid=110"
  config.vm.share_folder "platforms-o2", "/data/disk/o2/static", "~/workspace/platforms-o2", :extra => "dmode=755,fmode=755,gid=100,uid=112"
  config.vm.share_folder "platforms-o3", "/data/disk/o3/static", "~/workspace/platforms-o3", :extra => "dmode=755,fmode=755,gid=100,uid=113"

The octopus aegir instances are quick an responsive when accessed through the browser. However, the sites themselves are really, really slow.

Here is an output of ressources used while loading the slow site:

top - 13:28:43 up  3:32,  2 users,  load average: 0.43, 0.17, 0.06
Tasks: 115 total,   1 running, 114 sleeping,   0 stopped,   0 zombie
Cpu(s):  2.5%us, 20.9%sy,  0.0%ni, 61.6%id,  0.0%wa, 15.0%hi,  0.0%si,  0.0%st
Mem:   2057452k total,  1664684k used,   392768k free,   122316k buffers
Swap:  1101816k total,     1796k used,  1100020k free,   878832k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND                                                                              
31068 www-data  20   0  348m 180m  94m D   34  9.0   0:11.13 php-fpm                                                                              
1798 mysql     20   0  745m 237m  10m S    0 11.8   5:54.75 mysqld                                                                               
2221 redis     20   0 40280 3660  948 S    0  0.2   2:23.89 redis-server                                                                         
41501 vagrant   20   0 19236 1408 1060 R    0  0.1   0:00.03 top                                                                                  
41635 root      20   0  8280  628  524 S    0  0.0   0:00.01 sleep                                                                                
    1 root      20   0 23692 1872 1300 S    0  0.1   0:01.13 init                                                                                 
    2 root      20   0     0    0    0 S    0  0.0   0:00.01 kthreadd                                                                             
    3 root      RT   0     0    0    0 S    0  0.0   0:00.45 migration/0                                                                          
    4 root      20   0     0    0    0 S    0  0.0   0:00.74 ksoftirqd/0                                                                          
    5 root      RT   0     0    0    0 S    0  0.0   0:00.00 watchdog/0                                                                           
    6 root      RT   0     0    0    0 S    0  0.0   0:00.50 migration/1                                                                          
    7 root      20   0     0    0    0 S    0  0.0   0:00.51 ksoftirqd/1                                                                          
    8 root      RT   0     0    0    0 S    0  0.0   0:00.00 watchdog/1                                                                           
    9 root      20   0     0    0    0 S    0  0.0   0:00.74 events/0                                                                             
   10 root      20   0     0    0    0 S    0  0.0   0:00.57 events/1                                                                             
   11 root      20   0     0    0    0 S    0  0.0   0:00.00 cpuset                                                                               
   12 root      20   0     0    0    0 S    0  0.0   0:00.00 khelper                                                                              
   13 root      20   0     0    0    0 S    0  0.0   0:00.00 netns                                                                                
   14 root      20   0     0    0    0 S    0  0.0   0:00.00 async/mgr                                                                            
   15 root      20   0     0    0    0 S    0  0.0   0:00.00 pm                                                                                   
   17 root      20   0     0    0    0 S    0  0.0   0:00.03 sync_supers                                                                          
   18 root      20   0     0    0    0 S    0  0.0   0:00.04 bdi-default                                                                          
   19 root      20   0     0    0    0 S    0  0.0   0:00.00 kintegrityd/0                                                                        
   20 root      20   0     0    0    0 S    0  0.0   0:00.00 kintegrityd/1                                                                        
   21 root      20   0     0    0    0 S    0  0.0   0:00.06 kblockd/0                                                                            
   22 root      20   0     0    0    0 S    0  0.0   0:00.03 kblockd/1                                                                            
   23 root      20   0     0    0    0 S    0  0.0   0:00.00 kacpid                      

All the sites run correctly on my production server, so I suspect it has something to do with the VM not passing on the data quick enough.

One issue might be proper write permissions to files and private, as the permissions are like this:

Files directory

drwxr-xr-x 1 o2 users 1020 2012-11-21 11:48 files/

Private directory

drwxr-xr-x 1 o2 users 136 2012-11-30 10:13 config/
drwxr-xr-x 1 o2 users 102 2012-11-20 01:17 files/
drwxr-xr-x 1 o2 users 102 2012-11-29 22:39 temp/

Hower, I am not able to change it with:

chown o1:www-data directory

It seems that it is because of the way VirtualBox handles mounted drives. However, I wanted to be able to easily edit the code for my sites. That is why I mounted the static directory.

But I also tried with site which was not on a mounted drive, and it was also really slow while the web interface for the octopus instances works well.

Comments

Use NFS to mount shared folders

adrinux's picture

It's not entirely clear from your post how you are mounting the directories you're sharing. But afaik vagrant uses NFS by default, and it doesn't look like there is proper mapping of your host user uid/gid to the users in the VM.

I have just set up something similar with aegir/vmware using nfs mounts, but not BOA.

Is this not proper

lsolesen's picture

Is this not proper mapping?

config.vm.share_folder "platforms-o1", "/data/disk/o1/static", "~/workspace/platforms-o1", :extra => "dmode=755,fmode=755,gid=100,uid=110"
  config.vm.share_folder "platforms-o2", "/data/disk/o2/static", "~/workspace/platforms-o2", :extra => "dmode=755,fmode=755,gid=100,uid=112"
  config.vm.share_folder "platforms-o3", "/data/disk/o3/static", "~/workspace/platforms-o3", :extra => "dmode=755,fmode=755,gid=100,uid=113"

What was you solution for doing the mounts?

That's vagrantfile syntax,

adrinux's picture

That's vagrantfile syntax, I've no idea whether that's right or not, I'm not using vagrant. I assume that gets used to write to /etc/exports on the host and /etc/fstab on the guest vm, what does it write?

vboxfs versus NFS

grobot's picture

That sounds like it could be slow network mounts, although it's unclear why this issue would then affect the site which isn't on a mounted drive.

It’s a long known issue that VirtualBox shared folder performance degrades quickly as the number of files in the shared folder increases. As a project reaches 1000+ files, doing simple things like running unit tests or even just running an app server can be many orders of magnitude slower than on a native filesystem (e.g. from 5 seconds to over 5 minutes).

:nfs => true is the flag you want to add to your share_folder lines to switch from VboxFS to NFS. I'd be interested to hear your results.

If my comments have helped you, please pay it forward!
Use issue queues to discuss module issues - this will help your questions assist others (including yourself!) in future.
http://twitter.com/grobot ● www.giantrobot.co.nz

BOA

Group organizers

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds:

Hot content this week