Skip to content
This repository has been archived by the owner on Jan 22, 2019. It is now read-only.

Performance

shish edited this page Jun 28, 2012 · 5 revisions

Server

First of all, if you are using Apache it would advisable to switch to something more lightweight such as nginx or lighttpd.

PHP can be used via FastCGI with either of these two servers; PHP-FPM is the recommended PHP FastCGI interface.

Furthermore, if you are trying to squeeze as much as you can out of Shimmie try looking into the Alternative PHP Cache module PHP APC.

Varnish

Varnish makes everything better. The default behavior of "anons see cached pages that are up to two minutes old, logged in users get fresh data" is pretty close to perfect, though you may want to increase the TTL for some pages (image lists / search results may change often, individual images not so much)

Note that this behaviour works correctly because shimmie only sets a session cookie when a user is logged in, no cookie for anonymous users; the front-end settings cookies are prefixed with ui- and are then removed by a regex in the config file. If you modify shimmie to add new cookies, you'll also need to modify the Varnish config to ignore them too.

Example default.vcl

Software tweaks

In config.php, define("SPEED_HAX", true); will enable a bunch of potentially risky optimisations - the main risk being that users see out-of-date data; for example, in speed hax mode the giant tag cloud will be generated once and saved to disk, and the tag cloud will stay the same until the cached version is cleaned by hand.

CDN support

If serving images and thumbs from a set of mirrors, one can load balance by setting eg: the image url to http://mirror-{1,2,3}.mysite.com/_images/$hash/$id - $tags.$ext. Shimmie will then spread the load over those three servers, using a consistent hash for distribution (consistent meaning that if you add or remove a server from the list, as many URLs as possible will stay the same)

Clone this wiki locally