Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Speeding up Cakephp-based site

Posted on 2011-03-23
4
Medium Priority
?
466 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 15

Accepted Solution

by:
Phil Phillips earned 1200 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 15

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

[Webinar] Cloud Security

In this webinar you will learn:

-Why existing firewall and DMZ architectures are not suited for securing cloud applications
-How to make your enterprise “Cloud Ready”, and fix your aging DMZ architecture
-How to transform your enterprise and become a Cloud Enabler

Question has a verified solution.

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

Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
This article discusses how to implement server side field validation and display customized error messages to the client.
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.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses

972 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