2

For the past few years, I have been using a Linux system installed on VirtualBox as my work environment. This allowed me to do two important things:

  • I can install specific versions of any library and softwares that I need for that specific project without impacting my host machine
  • I can save that on usb and in the cloud, which allows to work with any machine as long as it is powerful enough and has VirtualBox installed.

I am quite happy with that setup except for the fact that it's extremely power hungry. Even when I am not doing anything, the simple fact of running it uses two cores on my powerful host, and this means that I cannot use this on standard hardware, let alone ancient ones. I had to install a lightweight DE too (xfce), as even my workstation was sluggish otherwise.

I have several programs running in there, at a minimum: the web server, the DB server, FF, VS Code, a software to look into the DB.

Would there be lighter alternatives which would retain the advantages listed above, while running on more standard hardware?

Alternatively, would switching from LMDE (debian mint) towards a lighter (alpine? bunsenlabs?) one bring a significant amelioration with the same programs running?

Edit: here is an illustration of my resource usage

You can see that even when nothing special is running:

  • in my VM, among the 4 cores allocated to it, one is at 10% and the others at 0 => fine!
  • on my host machine, when the VM is stopped all the cores are almost 0% with the busiest one around 4%, but when the VM is running, one core is at ~30%, another ~20%, and two more between 10 and 20%. I am assuming, perhaps wrongly, that this discrepancy implies that for those 4 cores assigned to the VM, most processor power is used up by VirtualBox itself (my idle server inside the VM uses only 10 of those 70-80 per 400).
  • 1
    If your virtual machine then use the top command to determine why your VM uses so much CPU – cybernard Jun 9 '17 at 2:48
  • I added a screenshot and some info on that. Actually the memory usage in the VM is only 2.7GB now only because I killed FF which was sucking up too much RAM and CPU. I can allocate 8GB of ram on my workstation, but again if I have to work with a standard computer with only 4 or 8GB then it becomes impossible for me to do so as with FF and everything else RAM usage raises so quickly. I know that there are no magical way around that but I'd like to remove as much CPU and RAM fat from my solution... – Shautieh Jun 9 '17 at 3:37
  • As I am thinking about it, maybe it would be worth it to have two different virtualised systems: Virtualbox as it's usable on every platform, and a lighter one specific to Linux (as 99% of the time I'll be on Linux with a VM running Linux), with conf and code files synced through the cloud (or in shared partition) so I can use one or the other easily. Has anyone tried something like this? Would it be worth it? – Shautieh Jun 9 '17 at 3:46
  • 2
    docker and lxc and others. You could pace the web server and DB server into separate docker instances and then limit resource usage individually. For you DB are you using mysql/mariadb with libmysql as your client library? Am I correct in assuming VS code is visual studio? – cybernard Jun 9 '17 at 3:51
  • Have you considered ditching the desktop, in the VM, completely writing a HTML/HTML5 gui via perl,php.python or etc. Then using firefox externally to open VM ip address and activate your php or etc. Adminer and myphp admin, or webmin can take advantage of HTML to give you access to your DB in FF. – cybernard Jun 9 '17 at 3:54
1

No issues w/ VBox here. Mint 18.x as host, have 4 Debian "servers" running (dhcp, router/gateway, dns, samba), 2 instances of the Mint 18 live cd, 3 FreeBSD machines (router/gateway, dhcp, dns), and a copy of Win7 professional. The servers all have the daemons running, the LiveCDs and Win7 are sitting with firefox open on the default homepages. Host machine is an i5 w/ 8gb ram and not quite 5gb swap.

$ top -b -n 1 | head
top - 12:54:47 up 2 days, 23:06,  1 user,  load average: 0.44, 0.79, 1.90
Tasks: 234 total,   1 running, 226 sleeping,   0 stopped,   7 zombie
%Cpu(s):  4.7 us,  1.1 sy,  0.0 ni, 93.9 id,  0.3 wa,  0.0 hi,  0.0 si,  0.0 st
KiB Mem :  8106392 total,   688896 free,  6907100 used,   510396 buff/cache
KiB Swap:  4881404 total,  3307080 free,  1574324 used.   840268 avail Mem 

To help your issue - I would config your set up so that you can connect to the VMs via network. Use the browser on your host machine, ssh in and export your display to run the IDE, connect to the db server via network as well (mysqlworkbench, phpmyadmin, etc) or use X over ssh for that as well.

Doing this will reduce all of the overhead of the desktop, the virtualization of graphics output, etc.

  • I think the issue come from my dev tools indeed, and not the server side of it. I tried to dev from my host via local bridge or something in the beginning but had some trouble at the time, then got used of working from inside the VM. I really appreciate the fact that I can pause what I am doing any time, shutdown my PC, then when I open the VM again I can start hacking right away! I think I will have to chose between this ease of use and performance though, as there are probably no silver bullet... – Shautieh Jun 11 '17 at 6:08
  • Before going this way I will try to create a new VM with a lighter Linux and setup i3 window manager. I hope it will give me more slack on older computers... – Shautieh Jun 11 '17 at 6:11
1

Might just be time to purchase dedicated hardware since you're trying to run several servers that will devour RAM. Databases and Web servers are not nice to RAM, and I think you're also trying to compile code and run other software, which will also eat RAM. Which I'm confident you're well aware of that. I honestly don't believe that even running your VM as a server without a GUI would do much for you since you're running so many demanding services.

From the picture you attached, it looks like you're using so much memory that swap is being activated which will then increase disk IO and CPU % use which explains the increase in CPU. So it's not really VirtualBox, but the software you're running inside of the VM.

I would recommend purchasing used/refurbed server towers like HP or Dell. Then you can remote to the server freeing up your desktop and giving you a much better environment. A quad-core processor would probably suffice, but you will need a computer that will support a lot of RAM, and server motherboards offer that and sometimes a slot for 2 processors.

0

Friend virtualbox is the best software available for visualisation .a software consisting all features and a good user interface is offered by Oracle and still you want a lighter version there may be a lot of lot of virtual ization software out there some of them are expensive. In case of Linux it is the best software that you're can get

  • Thanks for your input, and I must say I have been using it because it's supposed to be so good, but for my solution it is not good enough IMHO. That's why I am looking for advice, or solutions to make it better, and your answer is not really helping. – Shautieh Jun 11 '17 at 6:01
  • no poblem hope you have luck – vyshnav vyshu Jun 11 '17 at 10:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.