Instead of showing pages with a script, make them into static HTML files that are re-generated each time the page is edited.
Most of activity on a wiki site is viewing pages – even if users mostly edit, each edit is usually preceded with a view of the page. Thus it might make sense to optimize a wiki engine for this purpose. Web servers are already optimized for serving static web pages – one can take advantage of this to create a wiki engine able to handle very large traffic.
Then again, this can be also achieved using ready solution like proxy caching.
The basic approach is simple: instead of reading the raw text of pages from files or a database and parse it every time, then send it to the user, save the parsed pages into static html files and make those available to the users. Setting default MIME type on the server lets you even skip the .html extension.
Either have a separate script to display the editor, or generate the editor page together with the “viewing” page. One can even put both the rendered page text and the editor on the same page. The only part that necessarily has to be scripted is the “save” routine to which the editor sends its POST data.
Every time a page is edited, you need to at least re-generate that page and the RecentChanges page. If the wiki supports page histories and diffs, and they are also static pages, then they need to be updated too.
If the wiki engine is supposed to show links to non existing pages differently, then you need to update them whenever a page is created or deleted. You can minimize the amount of work done by keeping information about page’s backlinks (even for non existing pages), and only update the pages that were linking to the created/deleted page.
Normally you’d have the links to non-existing pages pointing to a script displaying the page editor and allowing to create the pages (or even have the editor pages generated as soon as the link to non existing page is mentioned anywhere). This is enough if the URLs are considered opaque.
However, many wikizens will edit the URLs directly in the location bar, and expect to create pages this way. To permit this, you need to override the “404 error” page with your own version, a script that displays the editor or some page creation form.
It is possible to move some of the functionality to the client side, using JavaScript of Flash. The raw text of the page can be parsed with a script. The editor can be displayed using a script. Also the 404 handler can be done a static page with some JavaScript then. The user name can be remembered in a cookie and filled in with a script.
An alternative to keeping track of dependencies and regenerating pages would be to allow the pages to be out of date for some time, and update them all once in a while with a global sweep.
The static html files can be used not only as a cache, but even as the only storage for the wiki.
The navigation and logo cannot change without regenerating all the pages.
No way to display breadcrumbs or other dynamic information, unless JavaScript it used.
No logins, unless the HTTP authentication is used.
Wiki:StaticHtml, MeatBall:CacheHTML, MeatBall:GenerateStaticPages, MeatBall:NakedWiki