SpeedOptimizations

Summary: How to tune PmWiki and its environment for speed
Version: N/A
Prerequisites:
Status:
Maintainer: Petko
Users: (View? / Edit?)
Categories: Administration, PHP55, PHP72
License: PD

Questions answered by this recipe

  • How do I make my wiki run faster?

Description

Tips for improving your wiki's performance.

PmWiki is quite fast for most setups and needs, however some customizations can slow performance:

  • Anything that reads pages from disk slows the processing - e.g. Conditional Markup, Markup Expressions, or Custom Markup that calls the functions PageVar, ReadPage, RetrieveAuthPage, PageTextVar, CondAuth...
  • PageLists can slow performance. For example, a menu/sidebar with a static bullet list is much faster than a menu populated dynamically by a pagelist -- and as a menu doesn't change often, it is usually better to update it by hand.
    • Adding a group=Main or a name=Main.*-Talk filter to a pagelist speeds it up.
    • A dynamic wiki trail from a pagelist is slower than a normal Wiki Trail, same as the menus.
  • $EnablePageListProtect = 0; speeds significantly pagelists. Look at the docs though, before setting this: PagelistVariables
  • Including other pages and PTVs from other pages require opening the disk files of the other pages -- so use sparingly.
  • If you don't often change a site header/footer, it will be faster to have the content in the skin template instead of in wiki pages.
  • Some recipes such as realtime visitor counters read and write to disk files on every page view -- that could be significantly slower.
  • If a recipe manipulates session data, a session file is read/written. Reading a file takes time, writing to a file usually takes much more time.
  • Using too many recipes requires opening all their cookbook *.php files, which adds some milli-seconds.
  • Using Rewrite Rules/CleanUrls is slightly slower than not using it.
  • $EnableIMSCaching = 1; makes everything faster, in the period between one edit and another edit (in the whole wiki) -- so if you have such long periods and many visitors between them, it may be useful.
  • Loading javascripts, pictures and counters from external websites (for example Ads or Google Analytics) often makes a site "feel" slower.
  • Loading external content - for example inline RSS feeds, Flickr/Twitter updates, Weather, Maps etc. -- is slower unless the recipe caches the remote data for a while and displays the cached version to many visitors.
  • PmWiki on PHP 5 runs noticeably faster than on PHP 4, and even faster on PHP 7.
  • There are recipes (FastCache...) which speed the processing and the wiki should run faster for non-logged-in visitors.

If you run a dedicated hardware server and have some expertise (or can afford to hire an expert), you can do even more optimizations:

  • Use a local hard disk rather than network storage.
  • Use a faster filesystem such as Reiser4 or a less-CPU-intensive one such as JFS.
  • Use fast SSD hard-disks -- even a Flash memory card with the program files could improve speeds (only use for limited, rarely modified files, not for wiki.d or uploads; needs testing - speed could also be worse).
  • Use not Apache but a smaller/faster http server such as Nginx.
  • Use PHP with FastCGI.
  • Use a PHP cache such as APC. (See http://en.wikipedia.org/wiki/PHP_accelerator.)
  • Copy all the program files, skins, css... into the RAM of the server and run the wiki from there.

Notes

See also

Contributors

  • This page was started after this post by Petko (5ko [snail] 5ko [period] fr).
  • If this recipe helps you or saves you time, you can help support its continued development by .

Comments

See discussion at SpeedOptimizations-Talk?

User notes? : If you use, used or reviewed this recipe, you can add your name. These statistics appear in the Cookbook listings and will help newcomers browsing through the wiki.