Solved

Speeding up Cakephp-based site

Posted on 2011-03-23
4
451 Views
Last Modified: 2013-11-10
Hi, our site is built by using CakePhp framework, the problem is that the response speed is quite slow. Memcached did not help a lot. Is there any way to generate static html files and serve them automatically? are there any other guides for optimizing cakephp?
0
Comment
Question by:darkbluegr
  • 2
  • 2
4 Comments
 
LVL 12

Accepted Solution

by:
Phil Phillips earned 300 total points
ID: 35200853
CakePHP has some caching mechanisms, but they don't generate static html files. Matt Curry wrote a plugin that you can use that writes out pure HTML: https://github.com/mcurry/html_cache
The source includes a readme with some instructions on how to get started.  With his implementation, you will need some kind of job scheduler to clear out the "cache".

As far as optimizing, one place to start is with your SQL queries.  If you set CakePHP's debug level to 2 ( modify config/core.php ), you should see all of the SQL run by a page, plus the time each query took.  This should be done in a test environment.  If the SQL debug output is messing with your styling too much, you can hide the SQL output using the following CSS (and view the source to see it):
.cakeSqlLog { display: none; }

Open in new window

0
 

Author Comment

by:darkbluegr
ID: 35325121
Thank you for the response Decorum,

The specific section we would like to speed up is this: www.iamexpat.nl/read-and-discuss

If you go to this link and click on any of the news articles, it will take a while for them to load.

Do you believe the plugin from Matt Curry will help in this case or should we go through a full refactoring of existing code/server upgrade?

0
 
LVL 12

Expert Comment

by:Phil Phillips
ID: 35325279
I think the plugin will help since it seems that there is something on the serverside that is taking a while to process the page.  The plugin will eliminate processing and serve static content.

Still, it doesn't hurt to take a look at the code too. You may not need a full refactoring... like I said, I would start with SQL debugging on and see if there are any horrendous queries slowing you down.  If so, then try tuning the queries first.
0
 

Author Closing Comment

by:darkbluegr
ID: 35326982
Thank you decorum, please send me a message if you are able to have a look at the debug logs on a freelance basis.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit (http://en.wikipedia.org/wiki/PHPUnit) and similar technologies have enjoyed wide adoption, making it possib…
This article discusses how to create an extensible mechanism for linked drop downs.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now