Solved

Speeding up Cakephp-based site

Posted on 2011-03-23
4
450 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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Both Easy and Powerful How easy is PHP? http://lmgtfy.com?q=how+easy+is+php (http://lmgtfy.com?q=how+easy+is+php)  Very easy.  It has been described as "a programming language even my grandmother can use." How powerful is PHP?  http://en.wikiped…
Part of the Global Positioning System A geocode (https://developers.google.com/maps/documentation/geocoding/) is the major subset of a GPS coordinate (http://en.wikipedia.org/wiki/Global_Positioning_System), the other parts being the altitude and t…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
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.

708 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

11 Experts available now in Live!

Get 1:1 Help Now