EDIT: For QTS 4.2 onwards use this guide which includes the right package.
For too long I’ve been struggling against my Semantic Mediawiki performance running on a QNAP machine. Pages were taking 10+ seconds be generated and new pages could take around 30s. Although those were certainly not the most simple of wikis, judging for the number of semantic properties and templates associated, those times were simply unacceptable, even for an Atom based hardware.
After trying to improve QNAP’s Mysql performance, and upgrading to the latest available php 5.5 on QNAP (which already supports OPCache by default), all without much success, my last attempt was with Memcached, and the results are stunning: On a restricted access wiki (only allowed logins can access any content), page access time were reduced from around 10 to 15s to 400ms. Page creation or editing time were reduced from 20+ seconds to about 2 seconds.
This is easily explained by how MediaWiki works: even for a new page around 70% of all queries can be cached (or at least that’s the hit rate reported by Memcached) and to access any page, then the hit rate is around 100%. Thus, this performance increase can be explained.
Now, the trouble is, Memcached isn’t readily available on QNAP hardware, and specifically the version present on QTS UI simply is non-working. So, here goes how to install Memcached:
- Install IPKG, using QNAP’s own applications manager
- Login on the NAS using SSH and manually install Memcached with IPKG:
ipkg -v 2 install memcached
- Add a new startup script. Create the file /opt/etc/init.d/S21Memcached with the following content:
case "$1" in
/opt/bin/memcached -d -m 128 -p 11211 -u httpdusr
stop) killall memcached
- Edit the file /etc/config/qpkg.conf and add the following lines at the end:
Name = Memcached-AutoStart
Class = null
Status = complete
Desktop = 1
Version = 1.0
Author = Technedigitale
QPKG_File = Memcached.qpkg
Date = 2015-04-21
Shell = /opt/etc/init.d/S21Memcached start
Install_Path = /share/MD0_DATA/.qpkg/Memcached
WebUI = /phpmem
RC_Number = 181
Enable = TRUE
Et voila, now you have a very fast SMW environment.