Some general tips on increasing the speed of queries and decreasing page load times.
Database Configurations
Index search fields
If users commonly search 'product names' you may want to build your own query using the command 'MATCHES'. Matches works in the SQL differntly than LIKE and will only return rows if the search is not in more than half of the records. Simple words like a and or etc., are basically ignored because they are too common.
If you take this approach, make sure that the field uses a FULLTEXT index. This will make searches much faster.
General PHP Configurations
Compress output
- In your php.ini file;
output_buffering = 1
output_handler = ob_gzhandler
Cake 1.1 Configurations
Caching
Models
- Set var $recursive in each Model to -1. You can override this in a controller, action or single query as needed.
Each unnecessary query adds 2-30 milliseconds to the page load time. As your application grows this will get very 'expensive'. - When using CakePHP 1.2, use Containable Behavior, that will do unbind/bindModel only your needed associations.
General HTML Principles
Keep it W3C compliant.
HTML that is W3C compliant is parsed easily by web browsers because they aren\47t busy correcting small formatting issues.
- Cake by default is XHTML Transitional compliant.
- Strict is achievable but will mean regulating links for \47target\47 attributes and other minor discrepancies.
- http://validator.w3.org/ will check your pages(non-recursively)
Keep it small
Just because many people hav high-speed access, doesn't mean your pages should be overloaded with graphics and flash.- Set a KB cap and stick to it.
- Let no single trivial image (icons, buttons, etc.) be larger than 20kb.
Cake 1.2 Configurations