Codeigniter is too, too slow. What config is wrong? - codeigniter

My web server was good with codeigniter, but after i move my server on new windows server, it is too slow.
I checked my code step by step, but it is same config and code.
I just wrote simple code in main controller class.
public function testA()
{
$this->output->enable_profiler(TRUE);
}
There is no mysql query, only show profiler data.
But it shows too slow.
Loading Time: Base Classes 8.4310
Controller Execution Time ( Batch / TestA ) 7.7913
Total Execution Time 16.2224
The running time is 16 seconds.
What is wrong with codeigniter?

It is MSE (Microsoft Security Essential) problem. If i turn off real-time protection, then it rans in a 0.1 seconds.

I had a similar problem. I disabled Microsoft Security Essentials or Windows Defender real time protection and it solved the problem.
You can choose to exclude httpd.exe and or mysqld.exe from Windows Defender if you do not wish to disable real time protection.

Related

load duration of web page differs

for testing purposes I measure the time it takes for parsing, db accessing, posting and rendering of one of my web php web pages in the browser (by using Firebug's network tool). When I press F5 after clearing the cache by "Delete recent data" it takes about 5 seconds, when I hit Ctrl-F5 it takes about 20 seconds.
Isn't that the same? What's the difference between them? What is the recommended way to test the performance of php code and db access?
Thank you very much in advance ...
There could be any number of reasons all of which have to do with the implementation of firebug.
You cannot test the performance on the client side since clients differ a lot and also have the network latency which is even harder rule out.
You should do this all on the server side: start a timer when the request reaches your web server and then stop it when it exits. If that is a bit difficult then in the PHP script itself you can run a wrapper script that has a start timer, a require statement for the script you want and a stop timer.

How do i make a Selenium WebDriver run for many hours(CHO) without it causing a crash / OutOfMemory problems?

I am using selenium-2.30.0 to run a single test(on windows) which runs for many hours (~ 8 Hrs). I was using the FF driver, but it runs out of memory after just 45 minutes or less, & the test execution just hangs. I was unable to use HTMLUnitDriver (i thought a pure java solution was the answer) to run the same way as the FF driver (as it needs to wait for page loads & I definitely didn't want to put random thread sleeps in my code or implement any new function by extending the HTMLUnitDriver).
I cannot break the test case to multiple smaller units.
I cannot reload the driver as and when i see heavy memory utilization
Is there any way to get this working?
I found this link:creating-firefox-profile-for-your-selenium-rc-tests, & was quite helpful. Created a new firefox profile with absolute minimal settings, & the test has been running without issues for the last 4 hours. Thanks a lot for the help guys !
What sort of testing are you doing? Selenium is used primarily for Acceptance tests. It sounds like what you're trying to do is more like a soak test on your system.
If that's the case, take a look at JMeter, it's much more suited to this type of work. However, a rather significant difference between the two technologies is that JMeter works at the protocol (HTTP Request) level as opposed to Selenium's use of the rendered HTML.
What does crash, your Java test code or Firefox itself? If it's the Java test code, then are you sure that you're not leaking memory? Or maybe the memory leak is in the server side?

Request Timing in `$.ajax` is sometimes above 1 second and sometimes 30ms

I am using xampp version 1.7.7 on windows 7. I am trying to do that when you click save image it would send information to save_record.php in the background. I do this with
$.ajax({
url: 'save_record.php',
data: values.join("&"),
success: function(data) {
//document.write(data);
}
});
And it is clearly not the issue. The problem is that the response is very slow and I am unable to find the reason for it. Below I add the data I received from chrome speed tracer. Firebug is also showing all responses above 1 second. They come in format like 1055ms or 1035ms which makes me think it gets stuck somewhere for one second. If that was not weird enough, it starts making the requests fast (30-50ms) at some time and that is a perfectly usable application for me. Otherwise that 1 second delay is killing it. I once killed process explorer.exe and added as a new task and it worked. But the next time it didn't. I restarted the pc - it is one second... And while I was typing this question it started doing those fast requests. Once it starts doing them fast it's all good, but when I start xampp (or open my laptop from sleep) it is usually slow (1sec+). This is a somewhat self solving problem after some time (like 5-10mins usually), but it is annoying and both curious as why this is happening :) Hopefully I was clear about the problem.
P.S. I tested and the difference in time from first php tag to last one is ~20 ms, so I assume it is not PHP cache that is acting up?
P.S.2. I would provide any other data needed, just not sure what to look at :) Just name it.
UPDATE: added Chrome's network tab.
UPDATE: after reinstallation of xampp the problem still persists:
Uncommenting the line 127.0.0.1 localhost in C:\Windows\System32\drivers\etc\hosts solved the problem. The speed just jumped up incredibly. I found this advice in here. Actually even the speed of Chrome opening other pages increased a lot o.O
Can you take a screen shot of network > Timing tab of chrome developer tool for the request which takes more than a second and share it. For eg.
You must analyze the time taken for each action mentioned in that tab. And also check the event trace from the speed tracer to get more information.
Try changing the content of save_record.php to <?php die(); ?> and see what happens. I suspect it's some kind of delay in processing the save_record operation on the server-side (could be DB is the bottleneck, could be file I/O, etc).
save_record.php ,
what code have you written if you doing any database operation may the operation is taking to much time can you provide me the code of "save_record.php" the i can able to optimize response or can able solve your query

asmx web service slower after upgrade

I am transferring a C# asp.net asmx web service to windows 2008 and iis7 (64 bit), from ii6 (32 bit). I got an approximate web method performance time of about 160 ms before. On iis7, I'm now getting about 320 ms, even after reducing the web method down to almost no code to execute. I realize there is a compilation time on the first call. This timing is after about 20 calls and the time seems has stabilized.
I would like to reduce the time to run the web method from 320 ms to under 200 ms. This is to help handle the case where several calls would need to be processed. Another problem is when I ramp up 20 calls in 1 second, once in a while one of the calls will take about 3 seconds. This is also not desirable.
I've tried compiling in release mode and removed a debug compilation from the web.config. The .asmx file just references the class to load in the dll binary.
Something that is different is that iis7 is configured to show more detailed error messages to help with setup. However, since this is only when an error occurs I don't see how it could be slowing a regular call down.
I've tried both integrated pipeline mode and the classic pipeline mode and still get similar times. I've also tried setting the default compilation language to C#. I've tried checking the ping time to verify it is not the network. IIS has some database connections setup from the time when there was code in the web service method, but now that it does basically nothing I don't believe that should be an issue.
fyi - The problem was not asmx, iis7, iis6, debug mode, or the pipeline mode. The new IIS7 64 bit server started off with an internal ip address and then graduated to a public ip address. The ip address made a difference due to differences in network routing. The IIS6 test case was based on a public ip. Once I used the public ip for the IIS7 server the times were reasonably similar.

AppEngine response time is slow

I am using a modified version of the TaskCloud example to try and read/write my own data.
While testing on a a deployed version, I've noticed that the round-trip response time is slow.
From my Android device, I have a 100ms ping response to appspot.com.
I have changed the AppEngine application to do nothing (The Google Dashboard shows insignificant Average Latency.
The problem is that the time it takes for HttpClient client .execute(post) is about 3 seconds.
(This is the time when an instance is already loaded)
Any suggestions would be greatly appreciated.
EDIT: I've watched the video of Google I/O showing the CloudTasks Android-AppEngine app, and you can see that refreshing the list (a single call to AppEngine) takes about 3 seconds as well. The guy is saying something about performance which I didn't fully get (debuggers are running at both ends?)
The video: http://www.youtube.com/watch?v=M7SxNNC429U&feature=related
Time location: 0:46:45
I'll keep investigating...
Thanks for your help so far.
EDIT 2: Back to this issue...
I've used shark packet sniffer to find out what is happening. Some of the time is spent negotiating a SSL connection for each server call. Using http (and ACSID) is faster than https (and SACSID).
new DefaultHttpClient() and new HttpPost() are used for each server call.
EDIT 3:
Looking at the sniffer logs again, there is an almost 2 seconds delay before the actual POST.
I have also found out that the issue exists with Android 2.2 (all versions) but is resolved with Android 2.3
EDIT 4: It's been resolved. Please see my answer below.
It's difficult to answer your question since no detail about your app is provided. Anyway you can try to use appstats tool provided by Google to analyze the bottleneck.
After using the Shark sniffer, I was able to understand the exact issue and I've found the answer in this question.
I have used Liudvikas Bukys's comment and solved the problem using the suggested line:
post.getParams().setBooleanParameter(CoreProtocolPNames.USE_EXPECT_CONTINUE, false);
Often the first call to your GAE app will take longer than subsequent calls. You should make yourself familiar with loading and warm-up requests and how GAE handles instances of your app: http://code.google.com/intl/de-DE/appengine/docs/adminconsole/instances.html
Some things you could also try:
make your app handle more than one request per instance (make sure your app is threadsafe!) http://code.google.com/intl/de-DE/appengine/docs/java/config/appconfig.html#Using_Concurrent_Requests
enable always on feature in app admin (this will cost you)

Resources