This document introduces some common considerations and tips on improving performance of ownCloud. Speed of ownCloud is important - nobody likes to wait and often, what is just slow for a small amount of data will become unusable with a large amount of data. Please keep these tips in mind when developing for ownCloud and consider reviewing your app to make it faster.
The database plays an important role in ownCloud performance. The general rule is: database queries are very bad and should be avoided if possible. The reasons for that are:
We can reduce the load on the database by:
There a several ways to monitor which queries are actually executed on the database.
With MySQL it is very easy with just a bit of configuration:
If you put this into your my.cnf file, every query that takes longer than one second is logged to a logfile:
log_slow_queries = 1
log_slow_queries = /var/log/mysql/mysql-slow.log
long_query_time=1
If a query takes more than a second we have a serious problem of course. You can watch it with tail -f /var/log/mysql/mysql-slow.log while using ownCloud.
If you reduce the long_query_time to zero then every statement is logged. This is super helpful to see what is going on. Just do a tail -f on the logfile and click around in the interface or access the WebDAV interface:
log_slow_queries = 1
log_slow_queries = /var/log/mysql/mysql-slow.log
long_query_time=0
If you increase the long_query_time to 100 and add log-queries-not-using-indexes, all the queries that are not using an index are logged. Every query should always use an index. So ideally there should be no output:
log-queries-not-using-indexes
log_slow_queries = 1
log_slow_queries = /var/log/mysql/mysql-slow.log
long_query_time=100
If you do bigger changes in the architecture or the database structure you should always double check the positive or negative performance impact. There are a few nice small scripts that can be used for this.
The recommendation is to automatically do 10000 PROPFINDs or file uploads, measure the time and compare the time before and after the change.
If you need help with performance or other issues please ask on our mailing list or on our IRC channel #owncloud-dev on irc.freenode.net.