CodeIgniter Forums
Backend php application (CodeIgnitor performance vs Baseline PHP) - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21)
+--- Thread: Backend php application (CodeIgnitor performance vs Baseline PHP) (/showthread.php?tid=10603)



Backend php application (CodeIgnitor performance vs Baseline PHP) - El Forum - 08-06-2008

[eluser]Joozt[/eluser]
Hello,
I have a question about php frameworks.
In the past I used the codeignitor framework a lot, but the new project that I am gone work on is a lot different from my previews projects.

I am at the start of a new project on which we will develop two applications:
1.PHP server application with a mySQL database
2.Client desktop application written in C++

The only thing the client application does is send (url) requests to the (php) server on which the server replies with text or XML.

So php server application doesn’t really use (browser) views, the only thing it does is manage data from the database and send it back to the client application in text or XML.

When the project is finished, there will be a lot of client applications running at the same time which all connect to the PHP server application, so there will be a lot of traffic and the server needs to be really fast handling the traffic.

I am left with 2 options:
1.Choose a really fast framework (maybe conignitor)
2.Don’t use a framework at all (which I don’t prefer)

I was wondering if there is any PHP framework out there specially designed for backend server applications?

Does anyone know if the codeignitor framework can handle this task?

Any input will be greatly appeared.
Thanks in advance!

J.B. Horstman


Backend php application (CodeIgnitor performance vs Baseline PHP) - El Forum - 08-06-2008

[eluser]Developer13[/eluser]
XML-RPC and XML-RPC Server Classes


Backend php application (CodeIgnitor performance vs Baseline PHP) - El Forum - 08-06-2008

[eluser]Joozt[/eluser]
[quote author="Developer13" date="1218049099"]XML-RPC and XML-RPC Server Classes[/quote]

Yea that seems really usefull, I already read that before my first post, but thanks anyway! Smile

I came to the conclusion that codeignitor is probably the fastest framework out there (which i already expected)

Link to some peformance framework comperason: (codeIgnitor kicks ass! Big Grin )
http://www.avnetlabs.com/php/php-framework-comparison-benchmarks

The thing is baseline PHP still seems to be alot faster.

And the application I am gone build has to be as fast as possible.

Does anyone have any suggestions on how to improve the performance of the CodeIgnitor framework?

I think I am gone build some peaces of the application in baseline PHP and in CodeIgnitor so I can compare the performance.

Thanks alot in advance for the replies!


Backend php application (CodeIgnitor performance vs Baseline PHP) - El Forum - 08-06-2008

[eluser]Tom Glover[/eluser]
One way is to remove all the files that are not needed, and to only call the db when required, not automatically connecting to it.


Backend php application (CodeIgnitor performance vs Baseline PHP) - El Forum - 08-06-2008

[eluser]vlad_ci[/eluser]
Quote:I think I am gone build some peaces of the application in baseline PHP and in CodeIgnitor so I can compare the performance


Please keep us updated here on the forum. I am interested in your results as well.

I was always of the opinion that for typical web-serving applications
there are 5 top factors that have end-user
noticeable impact on performance (in this priority) -- assuming the 'algorithms' are optimized.

1) network latency/bandwith limitations between server and clients

2) Data access (meaning that accessing data residing on the disk
is slow -- as it involved mechanical movement of disk heads)

3) memory management routines (meaning that when large amounts
of data is cached and/or objects are frequently allocated/deallocated
-- the memory management task of the application or its underlying
runtime system becomes very noticeable especially in garbage-collected
systems )

4) Process forking/startup times of a given process/function

5) cost of 'function' invocation within the system


It seems to be that if everything else is equivalent between
your use of PHP-base and code igniter, then the only difference
would be the item 5) which represents the performance degradataion

when using 'abstractions' that cause more 'function invocations'
to accomplish the same task.

I would think that compared to the first 4 items, item 5) performance
difference between base-php and codeigniter would be negligeable
and not noticeable at all.


So if you take care of 1)
by making sure the data you send back/forth is compressed and small
and optimizing the number of network trips
design patterns here: client caching, compressing, batching requests,
closer co-locating server data and clients


of 2) by caching DB data in memory,
using bulk SQL,
reducing the amount of data in a given DB table by table or database partioning

of 3) by using smart memory management techniques
(such as LRU queues, cache expiration, inmemory-btrees,
controlling garbage collection/etc)

of 4) by making sure you do not fork processes that when not needed


--- you should not see any performance problems using code igniter

(this is just my uneducated opinion -- as I am just beginner
in web frameworks/etc)


Backend php application (CodeIgnitor performance vs Baseline PHP) - El Forum - 08-06-2008

[eluser]llbbl[/eluser]
The Avnetlabs test is interesting, thanks for posting it. Not using Active Record on the CI tests did help our scores greatly.


Backend php application (CodeIgnitor performance vs Baseline PHP) - El Forum - 08-06-2008

[eluser]Xeoncross[/eluser]
Codeignter is great for rendering non-browser based views like XML and JSON because unlike other Frameworks and ALL CMS's - there is no default layout file or anything that the $content is placed into. CI comes out of the box ready for only sending data that is NOT to be placed within a main layout file.

Also, as far as speed:
From my research I dropped Zend framework because CI was 3x faster.
With a couple core hacks you can disable some of the more useless stuff like URI routing and things if this is just a hidden request thing from a desktop.


Backend php application (CodeIgnitor performance vs Baseline PHP) - El Forum - 08-06-2008

[eluser]Xeoncross[/eluser]
[quote author="vlad_ci" date="1218061909"]
I would think that compared to the first 4 items, item 5) performance
difference between base-php and codeigniter would be negligeable
and not noticeable at all.
[/quote]

I built my own Framework/CMS thing that was (and is) a full featured blog. You can see an older test of it on my own site.

In the time it takes a new CI install to render the welcome page, my system can render 5 full index pages with the recent comments, new posts, links, nav, etc. And my system took only 2Mb to do all this while CI takes 3MB just for the welcome (no db stuff at all).

Baseline PHP vs frameworks is very noticeable, I was spoiled using my system and I can't stand using sites like this that take 2.1716 - 0.434 seconds to load.

We are talking about something like 331 requests per second to 21.5 with a framework.


Backend php application (CodeIgnitor performance vs Baseline PHP) - El Forum - 08-06-2008

[eluser]vlad_ci[/eluser]
@xeoncross

Ok, I think I understand the scenario you refered to:

without PHP framework: all code is in one or two PHP scripts
(which is what is used in the article you refered to)

with a PHP framework all the functions are split into many PHP files


if both use the same database access, which accounts probably for
less than 20% of the overall time (just my guess) in that example

non-framework code will appear to be much faster.


In my mind the scenario I was describing above
is of an application that deals with

Inserts/Updates/Selects on a few tables between 300 to 600 million rows
each, where each 'task' is a single database transaction
that manipulates (reads and updates) about between
30 to 30,000 rows at a time (some times selects must use joins with the large
tables, so some joins must be performed 'in-application' memory or some other
tecnique)

So in that scenario -- in my mind -- a distributed system will be heavily
database bottlenecked, and PHP, especially when pages can be precompiled
with various accellerator tecniques, would not be noticeable.

Perhaps, before making my conclusions in the post above, I should have
known more, where the application of the original poster will spends most of its time.

If it is in PHP function calls that are results of abstraction, then
of course the non-framework code will be much faster.


Backend php application (CodeIgnitor performance vs Baseline PHP) - El Forum - 08-07-2008

[eluser]Joozt[/eluser]
Thanks for all the replies Smile!!!

Now it is time to but it all to the task.

Since the project I am working on is very big, I will put it all to the test.

I will start writing the code and use some scripts to to the requests on various pages and compare the requests per second with baseline PHP and CondeIgnitor (I assume ofcouse that codeIgnitor will be slower, but even so It might not even be noticeble for overal performance)

I will post the code and the results here.

[quote author="Xeoncross" date="1218069362"]
With a couple core hacks you can disable some of the more useless stuff like URI routing and things if this is just a hidden request thing from a desktop.[/quote]

I started to review the codeIgnitor framework code a bit, but I am not sure what I can strip out to boost performance, does anyone have any suggestions what I can strip.

reading up on the functional plan of the project (I still need to write a technical design) It seems I that for the most part the software will consist of mainly database queries and returning plane text or XML to the client application (might use XML-RPC and XML-RPC Server Classes).