This are the few important points to be considered to speedup and optimize the website:
1. Upgrade the cakephp versions to latest one. To do this first upgrade to most recent one then so on.
2. Optimize the queries:
a) If data not required from multiple tables that are bind together make recurise -1.
b) Specify the fields in the query.
Eg: $this->User->find('first', array(
'fields'=>array('Name', 'Email'),
'recursive'=>-1
));
c) Use Limit in the query or use pagination if large number records are there.
d) Try not to put the query in the loops.\
e)Cache the query results this can be done using cakephp cache. Other method of caching is to convert the array data in the json format as this can also be consumed in the webservices.
After then save it in the file in some folder with specific path. Now when data required the fetch from cache file stored in the joson format.Run a cron to update the cache files at specific interval.
f) Keep your db normalized, use cake php nomenclatures while designing the schema.
g) Index the db fields that are mostly used.
3.Check that debug mode is off while the work is not done on the site.
Syntax:Configure::write('debug',0);
4. Try to load specific models only in the action that is required not load all the unnecessary models.
5. Follow cakephp conventions i.e follow proper mvc structure.
Comments
Post a Comment