Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I think this is a really good question. Here are a couple things I do to speed up cake apps.</p> <ol> <li><p>As mentioned in the comments of the linked article, cutting down on the <code>$uses</code> array helps a little. You can access associated models by going through their associationg. So if City and Address where associated, you could access address by <code>$this-&gt;City-&gt;Address</code> instead of including both in the <code>$uses</code> array</p></li> <li><p>In apache, move the code from your <code>.htaccess</code> into the main server config/vhost/whatever and set <code>AllowOverride None</code>.</p></li> <li><p>In a load balanced environment, move sessions from the DB to memcache. Memcache is easy as hell to setup, and the cake's DB session class leaves much to be desired. In high load application the garbage collection will kill you, as it ends up running every second or so. Also, here's a great little script that gives you stats about your memcache usage (based of apc.php) <a href="http://livebookmark.net/journal/2008/05/21/memcachephp-stats-like-apcphp/" rel="noreferrer">http://livebookmark.net/journal/2008/05/21/memcachephp-stats-like-apcphp/</a></p></li> <li><p>As Mark Story mentions in the comments section of the 8 ways article, compressing your assets is a very good idea. Here is a good script that minifies both js and css files, which can be used to replace the default css.php that comes bundled with cake. <a href="http://www.milesj.me/blog/read/32/CSSJSAsset-Compression-In-CakePHP" rel="noreferrer">http://www.milesj.me/blog/read/32/CSSJSAsset-Compression-In-CakePHP</a></p></li> <li><p>If for some reason people hit alot of images/css/js that don't exist anymore, it might be beneficial to make sure those pages do not generate a cake 404 error, as it has to go through the whole cake dispatching process, generates a session etc. It's as simple as changing this:</p> <pre><code>RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ /index.php?url=$1 [QSA,L] </code></pre> <p>to this:</p> <pre><code>RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_URI} !^/(img|css|js)/(.*)$ RewriteRule ^(.*)$ /index.php?url=$1 [QSA,L] </code></pre></li> </ol>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload