CodeIgniter Forums

Full Version: shopping for a scalable php framework
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2

El Forum

[eluser]edoornav[/eluser]
Hi,

I am looking for a lightweight php framework in which to build a fast and scalable web application. I've done the tutorials and code igniter seems to be what I'm looking for. My problem is that I'm getting some bad results from simple performance tests. I installed MAMP and ran apache bench on a simple static file containing 'Hello World':

ab -n 1000 -c 5 http://localhost:8888/index.html -> 350 requests per second (my laptop is slow)

Next I ran it on a php file containing '<?php print "hello world" ?>':

ab -n 1000 -c 5 http://localhost:8888/test.php -> 250 requests per second

Next I installed code igniter, and did the blog tutorial up to the point where it just prints "hello world":

ab -n 1000 -c 5 http://localhost:8888/index.php/blog -> 20 requests per second!

Using a view and displaying a single db row gets me down to 15 requests per second. Doing the same thing in a simple script gives me 150 rps.

This seems too high a penalty to pay for MVC. Is this a typical result or might there be something wrong with my configuration? I'm otherwise really impressed with this framework and would definitely use it on a smaller project.

Thanks in advance for any help.

~rvr

El Forum

[eluser]toolwieldingape[/eluser]
508 rps on my macbook (2.16ghz intel duo, 2gb ram) .. I personally don't put too much faith in benchmarks on desktops/laptops, I'd prefer to gauge performance in the intended environment.

El Forum

[eluser]edoornav[/eluser]
Thanks for your reply! I totally agree that it is best to test in target environment. I just thought that these ratios could give me a rough idea of the performance penalty of using the framework. I ran the same series of tests on our development server. It probably have similar capabilities to your macbook. Here's what I got:

static hello world page -> 6500 rps
<?php print "hello world" ?> -> 4000 rps
retrieve one db row -> 1750 rps

CI hello world -> 170 rps
CI retrieve one db row -> 106 rps

I am actually getting comparitively worse performance on the server. Instead of a 10X slowdown, I'm getting more like 20X.

I'm sure there are some configuration things I could be doing. Are you doing anything special to get 500 rps no your laptop, toolwieldingape? Thanks.

~rvr

El Forum

[eluser]Luci3n[/eluser]
You have to remember that you will use page and possibly database caching which will speed up your page loads, look at the site StyleIgnite as this is written with CI (times at bottom of page) and will use caching and possibly eAccelerator or something similar to give you an extra boost. Look at the benchmarks here to compare CI to Cake & Symfony for a hello world comparison.

El Forum

[eluser]Luci3n[/eluser]
use this in your controller

Code:
$this->output->cache(n);

where n is the amount of minutes to cache

El Forum

[eluser]champs[/eluser]
The gaps in performance will shrink pretty quickly once your app starts to do something interesting, and you'll have the bonus of code that isn't complete spaghetti.

El Forum

[eluser]gunter[/eluser]
Luci3n: which caching are you using for styleignite? mysql? Ci view caching?

El Forum

[eluser]woopsicle[/eluser]
Hi gunter,

I am actually the creator of styleignite. There is no CI caching at all. The speeds you see are a results of eAccellerator and some optimized mysql query cache settings... and a pretty good VPS server.

There's always room for improvement ofcourse so if traffic were to be solidly high then I would probably need to look into view caching of some sort - although it is a bit difficult on a purely dynamic site.

El Forum

[eluser]Luci3n[/eluser]
sorry it's not my site it's just an example as it was mentioned here the other day and then it was in delicious hotlist the other day so i remembered it. The code i suggested below is the standard CI chance which is easy to use and also very handy. It's quite a basic caching system but can be implemented very easily.

Code:
$this->output->cache(n);

you got me before i replied


HI woopsicle great site even got to the delicious hotlist

El Forum

[eluser]gunter[/eluser]
thanks both! I tried once the CI view cache, but I needed to use another view layout assembling because I do it normally with an _output method in the controller (or base controller) but the output generated in the _output method was not to see :-S and I did not know how to include the total benchmark into the page...
Pages: 1 2