This question about Topic Markup Language and applications: Answered

High speed Foswiki

How I came to simplify and speed up Foswiki when making Wiki Applications

This topic text is cleaned up, see earlier revs for history.

It's probably not so unusual. One starts up with a nice and fresh web server and Foswiki, start playing, learning about dataforms, linking etc. So after a period of time you have a number for forms and a growing number of topics with data. You also learn new stuff while this thing grows and you see things you would do different now than when you implemented them. I long put off these topics because I didn't want to complicate stuff too much...but now it don't feel that complicated anymore, I just wish there were much more easy to read documentation. Hope this isn't confusing but maybe can help lift an eye.

So in my experience there have been two major enablers for continuing with Foswiki successfully: DBCache and VIEW_TEMPLATE.

DBCache

DBCacheContrib and DBCachePlugin gives much performance when searching. All topics get indexed and cached in a database, and it works very well. You don't have to think of database maintenance and backups etc. The data is in the text files as usual if the cache needs rebuild. DBCachePlugin is very much alike %<nop>SEARCH{ with type="query" except it queries the cache at much better speed.

DBCachePlugin also gives DBDUMP which is fine to examine contents of a topic so that you better can see what parts to query or include. There is also TOPICTITLE and other stuff that is usable.

View Templates

VIEW_TEMPLATE is a preference setting you can set in a topic. It is the same as giving ?template=nicerview as URL parameter. And now there is a plugin that saves you from updating all your existing topics too, the AutoViewTemplatePlugin.

The view template lets you define a template the other topics will be shown through, with their own text and formfield data. Most importantly that means you write a little page where you define common layout and contents that those topics will show, instead of the default rendering of a topic. You then have one page to edit and all topics using that template will render that view. For example you might wish to have just a few formfields at the top of a page and maybe some default text (even included text from some other page).

Now the biggest trick here, for me, was to define the FORM to be empty. Yes, not rendering the default form gave huge speed improvement, and yet the formfield were available in the usual %<nop>FORMFIELD{ Name.... syntax. It is best to learn to use %<nop>BASETOPIC and such macros instead of the normal %<nop>TOPIC% but that's very easy and feels normal quite fast.

There is one more important bit but not so necessary as cache and templates, and that is using AUTOINC in topic names. You miss some readability in the URL but TOPICTITLE can win that back by showing the readable name in the windows title bar, and maybe later it will be default in Foswiki. Maybe. Anyway, I think it is much better to develop wiki applications when the name of a document can be changed without having to rename the topic, and catch all the other topics where the old names was used. It's no problem when it is the topic name as index that is saved. You just have to have a formfield called something you find understandable, or maybe TopicTitle.

If your Foswiki is on the internet or have many users, there are also cache solutions for that. I don't need that after I found this info myself but know that there are other good solutions.

If you are using Foswiki and maybe feeling it being slow then you should consider some of these "advanced" topics. There are documentation and there are people willing to help, so just ask in the support web or on IRC, or even the maillist.

QuestionForm edit

Subject Topic Markup Language and applications
Extension DBCachePlugin
Version Foswiki 1.0.7
Status Answered
Topic revision: r8 - 09 Nov 2009, LarsEik
The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy