Optimizations stories

Start

A zope and plone 25 bulk will be our testLand

Test procedure:

  • Make some changes

  • Run and store the following ab2 test:

    /usr/sbin/ab2 -n 100 http://hostt/> a_filename

Errors levels

  • debug off

  • error level -> error

  • Setted in the buildout.cfg

    [project]
    log-level = ERROR
    debug = off
    session-timeout-minutes = 90
    

ZODB

Try to change the cache size from 5000 to 10000 & see

<zodb_db main>
    # Main database
    cache-size 10000
# FileStorage database
    <filestorage>
      path /home/kiorky/projects/zope/minitage-0.4/zope/test-perfs/var/filestorage/Data.fs
    </filestorage>
    mount-point /
</zodb_db>

result : 3,47, little improvment nothing wonderfull

Http cache

Metadata files

Adding .metadata for images and static content:

title=$(basename "$filep" "$ext")
echo "Generating metadata for $filep"
echo "[default]"       >  "$filep".metadata
echo "title=$title"    >> "$filep".metadata
echo "cache=HTTPCache" >> "$filep".metadata

Http headers control

Test on “parts/plone/MimetypesRegistry/skins/mimetypes_icons/quicktime.png” which has no metadata by default Without:

(minitage-documenter) (minitage-0.4)~>wget -S    http://localhost:8080/z/quicktime.png
--12:24:46--  http://localhost:8080/z/quicktime.png
           => `quicktime.png'
Résolution de localhost... 127.0.0.1
Connexion vers localhost|127.0.0.1|:8080...connecté.
requête HTTP transmise, en attente de la réponse...
  HTTP/1.0 200 OK
  Server: Zope/(Zope 2.9.8-final, python 2.4.4, linux2) ZServer/1.1 Plone/2.5.5
  Date: Tue, 24 Jun 2008 10:24:47 GMT
  Last-Modified: Wed, 05 Dec 2007 03:33:42 GMT
  Content-Length: 693
  Content-Type: image/png
  Connection: Keep-Alive
Longueur: 693 [image/png]

100%[===============================================================================================================================================================================================>] 693           --.--K/s

12:24:47 (100.67 MB/s) - « quicktime.png » sauvegardé [693/693]

With:

--12:29:44--  http://localhost:8080/z/quicktime.png
           => `quicktime.png.14'
Résolution de localhost... 127.0.0.1
Connexion vers localhost|127.0.0.1|:8080...connecté.
requête HTTP transmise, en attente de la réponse...
  HTTP/1.0 200 OK
  Server: Zope/(Zope 2.9.8-final, python 2.4.4, linux2) ZServer/1.1 Plone/2.5.5
  Date: Tue, 24 Jun 2008 10:29:44 GMT
  Content-Length: 693
  Expires: Tue, 24 Jun 2008 11:29:44 GMT
  Last-Modified: Tue, 24 Jun 2008 10:29:44 GMT
  Connection: Keep-Alive
  Cache-Control: max-age=3600
  Content-Type: image/png
Longueur: 693 [image/png]

100%[===============================================================================================================================================================================================>] 693           --.--K/s

12:29:44 (86.02 MB/s) - « quicktime.png.14 » sauvegardé [693/693]

Python optimize mode

We must set the PYTHONOPTIMIZE envrionment variable to 1.

RAMCACHE

  • This is a very good manner to cache python scripts.
  • Add a ramcache to the site and associate content types with it.
  • We can add also templates and etc and tweak the cache key with the http request variables.

Cachefu

  • Set up various plne settings for caching policies. Its a great product.
  • things important to know is that cachefu can run in a standalone mode or run behind a classical http cache proxy like squid.
  • It monkeypatches several products to wrap the methods against its caching ones.
  • We can add easily rules throught the plone back office too.
  • As an example, locally, Cache fu in zope only mode == x30