[mod_python] Session class or Memcache to reduce load?

Graham Dumpleton graham.dumpleton at gmail.com
Mon Aug 6 05:25:09 EDT 2007

On 06/08/07, Alec Matusis <matusis at matusis.com> wrote:
> Hello, I am sorry if my question is too basic. I would like to reduce the
> load on apache 2.0 (on 2.6.9 linux) that is running with prefork MPM.
> There are two main things that are causing the load:

How do you know that these two things are causing the load?

> a) Thumbnail images that are requested repeatedly

Are you serving up the thumbnails from Python code dynamically or
allowing Apache to serve them up form a static file?

> b) A simple DB query is necessary to locate an image file after the request.
> The result of the query does not change. DB is located on another machine.
> My first question, do we need to cache \thumbnail images at all, or the
> file-caching by the OS is sufficient?

OS file caching probably will not make much difference. Where one can
waste a lot of cycles though is by using Python code to serve up the
images. Thus, if Python is involved in serving up the images, how is
it being done?

> Second question, to cache the results of the query, should we use
> mod_python's Session class ( wich will use DbmSession since we are using
> prefork MPM), or memcache?

Traditionally people use memcached for this.

> For certain reasons in the application logic we cannot use apache's
> mod_cache.

What reasons?


More information about the Mod_python mailing list