To begin with, you're doing a few things wrong here. Your say_hello
action doesn't belong in AppController. And the query method is not
the best approach, either.

Also, if you're testing Cake for speed, ensure that debug is set to 0
and you've implemented caching.

On Tue, Jan 15, 2013 at 2:23 PM, Quoc Lam <lvq...@gmail.com> wrote:
> Hi there,
>
> I am new to CakePHP and is trying to setup my first "Hello World" project.
> When working on that, I experienced a very slow response from CakePHP when
> performing a simple query to the DB.
>
> Here are the steps that I have done:
>
> Download the CakePHP framework (2.3.0 RC1)
> Create a Test DB with an empty table named "tests" inside it.
> Edit the default AppController.php as following
>
> class AppController extends Controller {
>     var $uses = array('Test');
>
>     function say_hello() {
>         $this->Test->query("select * from test where id=0");
>         echo "hello";
>     }
> }
>
> After that, I accessed the link http://localhost/app/say_hello, it took more
> than 1 second to response. If I commented out the query statement as
> following:
>
> class AppController extends Controller {
>     var $uses = array('Test');
>
>     function say_hello() {
>         //$this->Test->query("select * from test where id=0");
>         echo "hello";
>     }
> }
>
> Then, the link http://localhost/app/say_hello only took around 60ms to
> response.
>
> This doesn't seems right to me as performing a very simple query on an empty
> table should not take 940ms. I also tried doing the debug with DebugKit and
> it showed that more than 1s of time were spending on the ControllerAction
> which is pretty simple in this case. I am not what is causing the slowness
> of the response here.
>
> Can any of the CakePHP experienced members shed me something on how to solve
> this slowness issue?
>
> Thanks,
>
> Quoc
>
> --
> Like Us on FaceBook https://www.facebook.com/CakePHP
> Find us on Twitter http://twitter.com/CakePHP
>
> ---
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com.
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.com.
> Visit this group at http://groups.google.com/group/cake-php?hl=en.
>
>

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com.
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.


Reply via email to