# General speed/performance on large Craft build

Looking for hints and tips on speeding up and streamlining performance of a Craft site as we prepare for launch.

The database is approaching 100MB and whilst it is a fairly large and complex build (multiple locales with fairly extensive use of Matrix) this seems fairly excesive and page load times can be slow. Have looked at the Patrick Pohler post but any general, system level wins would be great as site is crawling a fair bit.

Am getting some performance increase through use of {% cache %} tags but then hitting DeleteStaleTemplateCaches issue qiute regularly which is stopping tasks running.

Any help appreciated!

• what kind of server specs are you running on? – Steven Grant Dec 14 '15 at 15:41
• VPS with Memset using 2 x 0.80 GHz/4 GB Ram but similar problems running locally on Mamp (1.86 GHz/4 GB Ram) – Cole Henley Dec 14 '15 at 15:50
• Do you have any logged in users? if your content is fairly static, nginx would help you immensely. – RitterKnight Dec 14 '15 at 16:00

We are constantly seeing the deleting stale template cache timeout problem on our servers - try increasing the time PHP can execute for to something very long. It seems like clearing the caches counts as one PHP request and not a bunch of tasks, so they can time out.

Good use of cache tags helps, and caching globally can also help - but other than that all I've found to make complex Craft builds faster is using something like Varnish or nginx. Neither of which are simple and both of which I've avoided so far.

PHP7 will help a lot, but I'm not aware of any distro that has PHP7 available yet.

• If you don't mind running PPAs and use Ubuntu or Debian, Andrej Sury's PHP PPAs are popular and updated regularly. – RitterKnight Dec 14 '15 at 15:58

You probably already know and have done everything I'm about to say. Our site is not that large, on shared hosting, and has been, not consistently, but frequently, VERY SLOW (60 seconds!) to load pages and especially to make any kind of edits on the control panel. So I just did the following in our cPanel:

Changed from PHP 5.5 to 7.0
Increased max_execution_time from 60 to 90
Increased mem_limit from 128M to 256M
Increased upload_max_filesize from 2M to 8M
Increased post_max_size from 8M to 16M.


UPDATE: OK, some not-too-scientific stats:

PHP 7.0, mem_limit 256M
HomePage initial GETs(on F5 refresh): 870ms 1.03s 1.11s 938ms
CP SaveAndContinueEditing inital POSTs: 10.47s 3.92s 3.18s 2.37s 3.57s 4.54s

PHP 5.5, mem_limit 256M
HomePage initial GETs(on F5 refresh): 1.23s 1.08s 1.28s 1.42s
CP SaveAndContinueEditing initial POSTs: 8.52s 4.06s 4.1s 5.15s 5.08s 3.63s

PHP 5.5, mem_limit 128M
HomePage initial GETs(on F5 refresh): 1.04s 1.44s 1.14s 1.25s
CP SaveAndContinueEditing initial POSTs: 4.15s 5.21s 4.33s 6.41s 4.31s 3.9s


I am not able to duplicate the incredibly slow responses I had previously, in which I frequently could walk away from the computer and come back and it hadn't loaded yet. When I said zippy, I meant a second or two instead of 30 seconds.

• Do you have some graphs about the "Zipiness" of your site 5.5 vs 7.0 ? – KSPR Feb 2 '16 at 13:32
• FWIW, most benchmarks I've seen have PHP 7 executing almost twice as fast as 5.6. A lot of db calls will slow that down but I just did a new server build with PHP 7 and my local Mac on 5.6. The server—even over the Internet—is quite noticeably faster. Makes you wonder what PHP 5.x is doing. – RitterKnight Feb 2 '16 at 17:15