Memory allocation peace of mind with running a Dreamhost VPS

Date: Fri Apr 25 2014 Dreamhost

One way to get better performance on Dreamhost is to use their VPS solution. VPS (or Virtual Private Server) is a hosting solution for higher performance website needs. What Dreamhost brings to the table is a semi-managed VPS solution rather than the raw Linux VPS solution offered by other hosting providers. That's one of the advantages of using Dreamhost, another is that they allow dynamically resizing the VPS memory allocation on the fly any time you want. And they offer an API so that software can change things such as memory allocation.

The way this helps is that if (when) you have a traffic burst the memory requirement on your server goes up. Enough traffic and the memory requirement can go through the roof. But are you going to chain yourself to the computer monitoring traffic all day every day to adjust the memory allocation as traffic comes and goes? No, that's not practical. So you're going to set the memory allocation at some level and at some times of the day the memory allocation is too much and other times it'll not be enough.

What would be cool is to have software that uses the dreamhost VPS API to track memory requirements and automatically adjust the allocation as needs change.

Enter PsManager: http://www.7is7.com/software/dreamhost/psmanager.html

It's real simple to install and the instructions on the website is pretty straightforward.

  • a) get an API key via your dreamhost control panel
  • b) download the source code, mkdir ~/bin, unpack the tarball in ~/bin
  • c) edit a psmanager.conf file and the main thing to put in is your API key
  • d) setup a crontab entry to run psmanager every minute
  • e) profit

For example here's a snippet from the log on my server:

201103261428	1459	811	647	607	1597	0
201103261430 1459 764 694 575 1607 0
201103261433 1459 766 692 577 1613 0
201103261435 1459 761 697 578 1616 0
201103261438 1459 752 706 566 1624 0
201103261440 1459 738 720 567 1633 0
201103261443 1459 707 751 536 1637 1637
201103261445 1637 702 934 534 1642 0
201103261448 1637 585 1051 420 1643 0
201103261450 1637 505 1131 426 1636 0
201103261452 1637 576 1060 460 1632 0
201103261455 1637 834 802 520 1656 0
201103261458 1637 1085 551 541 1695 0
201103261500 1637 1000 636 568 1727 0
201103261503 1637 1062 574 574 1825 0
201103261505 1637 982 654 546 1914 0
201103261508 1637 930 706 522 1979 0
201103261510 1637 841 795 524 1992 0
201103261513 1637 847 789 528 2010 0
201103261515 1637 768 868 529 2001 2001
201103261518 2001 446 1554 318 1996 0
201103261520 2001 784 1216 436 2004 0
201103261523 2001 722 1278 439 1999 0
201103261525 2001 649 1351 440 1992 0
201103261528 2001 841 1159 519 1992 0

The columns are a) timestamp, b) current memory, c) used, d) free, e) cache, f) optimal, g) memory changes

So you can see the optimal memory going up and down, and every so often it changes the allocation.

It means you can have adjusting memory, and not have to baby-sit the server, and it happens automatically. Way cool.

Highly recommended.

If you're interested in Dreamhost's hosting plans, there's a link at the left side of the page.