Welcome Guest, Not a member yet? Register   Sign In
Performance Issues
#1

[eluser]jgberg[/eluser]
I'm running codeigniter 1.5.4 under apache 2.2 on my windows laptop, along with mysql... I've got a browser app that makes repeated ajax calls. Each call results in the running of an ajax function in codeigniter controller, and all it does is a small update into a mysql table.

When I insert PHP microtime() statements into my ajax handler I see that handler does all it's work in about .06 seconds (based on subtracting the end-start microtimes). But Codeigniter dumps into the log that it took, 1.4 to 2.4 or more seconds... Thats about 50 times longer! What is Codeigniter doing that is taking all the rest of the time?

When I time the request from the client side, I'm seeing responses that take 1.6-2.6 seconds, which is on order of what Codeigniter reports.

So am I experiencing a Codeigniter issue? Or an Apache issue or what?

Thanks!
jeffrey
#2

[eluser]gunter[/eluser]
you say log...
are you using log_message() to write the time ?
thats slow - that´s normal...
#3

[eluser]jgberg[/eluser]
When I log the results of my timing I use log_message, and CI logs it's results that same way.
Are you saying the log_message function is massively slow... I don't believe that.

What I'm saying is that my function takes .06 seconds and that 1.5 seconds are coming from somewhere else, and there's no way that's from the logging function itself I'd assume.

j
#4

[eluser]gunter[/eluser]
Oh, then I can´t help you.
In my case, if I switch off the logging in the config.php then the controller needs under 0,06 - 0,1 seconds
now I enabled it, just for fun - and it takes 1,0 to 3 seconds... measured with the profiler
#5

[eluser]jgberg[/eluser]
wow... I'm going to see if I can confirm your results.
#6

[eluser]jgberg[/eluser]
holy moly! Logging SUCKS!!!! It's abominbly slow! ok!

So it performs much better... intead of 1.5 second response, I get .176 second response.

Well that should noted in the config file... man!
#7

[eluser]Derek Allard[/eluser]
File reading and writing is quite slow... agreed. This is an input vs output thing.
Quote:Well that should noted in the config file… man!
line 175 of config
Quote:| For a live site you'll usually only enable Errors (1) to be logged otherwise
| your log files will fill up very fast.
#8

[eluser]jgberg[/eluser]
the warning on line 175 does not identify the speed issue which I suggest it really should, let alone the disk space issue.

I'm thinking that a much better log system implementation to be considered, unless it's fundamentally a PHP problem (which I doubt).
#9

[eluser]Derek Allard[/eluser]
I guess... but it kind of begs the question of how much a framework should do, and how much the programmer is responsible for knowing? Where do we draw the line? File writing is slow (this is not a fault of PHP or CodeIgniter... just a limitation of the way data storage works). If a programmer relies of flat file storage for large quantities of information it will be slow. I think you'd agree it would be inappropriate to put a warning about this in the file helper.

There is absolutely no need to use the built in CI logging system. CI allows for anything a developer wants. Disabling logging is as easy as setting a zero in the config, and from there you could do any type of logging you want. The hooks feature makes this doubly easy.

On topic, but off of this direct point, we've (EllisLab) released a series of developer guidelines that might be of interest to anyone reading this thread. Included are Performance Guidelines, and security guidelines.
#10

[eluser]gunter[/eluser]
another idea/possibility is to extend the original log library so each message line is added to an array, and after the controller has fulfilled his work all the message lines can be written at once - that should be fast... (it is fast, I tried it now...)




Theme © iAndrew 2016 - Forum software by © MyBB