Personal tools
You are here: Home Documentation How-tos Running Plone on a system with limited memory
Support

Get Help

Join our chat rooms or support forums if you have more specific questions.

Plone Training
Learn how to design, build, and deploy a website in Plone through one of the numerous Plone training sessions around the world.
Find Plone training…
 
Document Actions

Running Plone on a system with limited memory

This How-to applies to: Any version.
This How-to is intended for: Server Administrators

Gives some pointers and tools on how to run Plone on a system with little memory - typically 512MB or less.

Purpose

If you have a Virtual Private Server (VPS) account, it often comes with limited memory - 512 Megabytes or less. If you try to run an out-of-the-box Plone installation on this, chances are that you will get a phone-call from the VPS administrator, yelling at you because you just used all the available memory on the server. Well, relax: here are some very simple steps you need to take to use less memory. I have been running a VPS with 10 low-traffic sites on it for a year - and I rarely use more than 300 Meg (well, at least since I got that call from the VPS admin).

Preliminary note 1: If you have a high-traffic/high-volume site you should probably skip this right away and get a high-performance server instead.

Preliminary note 2: I am explaining the hows, not the whys in this howto (whys are for scientists with funding, hows are for people with real jobs ;-) ).

Prerequisities

I assume you know the basics of Plone and Zope setup, including Zope configuration types and CacheFu. I am also assuming you are running it all on some sort of Linux server, but you don't need to be an experienced Linux user.

Step by step

Checking what uses memory

You need a way to check how much memory you use and which apps are using it. There is an excellent command for this: top

Start that, then hit SHIFT-M to sort the rows after memory usage. If your Zope is running, you should have a "python" command at the top. The real amount of memory you are using is in the RES column (See below for a little script which can tally up all the memory you use on a VPS). 

Memory Cache

The single thing I found out that ate all of the available memory - however I configured it - was the page cache. With cache-fu installed, this is very easy to turn off: just go to the memory tab in the Cache Configuration Tool and turn page cache off.

ZODB cache and ZEO client cache

If you run a ZEO client (which you should, but look elsewhere for the howto), you want to tweak those settings a bit. Usually it looks something like this:

<zodb_db main>
    # Main database
    cache-size 5000
# ZEOStorage database
    <zeoclient>
      server 8100
      storage 1
      name zeostorage
      var /usr/local/www/greenpages/parts/client0/var
      cache-size 300MB
    </zeoclient>
    mount-point /
</zodb_db>

The first one is representing number of objects, while the second one represents (as it says) Megabytes.

I have set first one down to 300 and the second one to 1MB for each of my ZEO mounts. If you only have one ZEO mount you can probably increase this some.

Further information

"Total Memory I use" script

A neat little shell-script you can use to tally up all the memory you use on a VPS. Cut and paste it into a shell script

#!/bin/bash
# Get total memory used by all processes
let Y=0;for X in `ps aux | awk '{print $6}'`; do let Y=$Y+$X; done; echo $Y

Total Memory Munin plugin

Munin (http://munin.projects.linpro.no/) is a really cool piece of monitoring software which you can run on your server to keep track on how things are going. Using the script above, I have also created a munin plugin for it (the shell script above is the "/usr/bin/memtotal" in the code below)

#!/usr/local/bin/python
import sys, os
if len(sys.argv) > 1 and sys.argv[1] == 'config':
    print "graph_title Total memory I use"
    print "graph_vlabel Count / 5 min."
    print "graph_category Finn"
    print "graph_info The amount of memory I use on the vps"
    print "memory.label Memory in bytes"
else:
    f = os.popen('/usr/bin/memtotal')
    a = f.readline()
    f.close()
    print "memory.value %s" % a.strip()
by Finn Arild Aasheim last modified March 14, 2008 - 15:37 All content is copyright Plone Foundation and the individual contributors.

For any issues with the web site functionality, please file a ticket.

Please consult the policy on plone.org content if you want your content published on this site.

Servers and hosting by