Welcome Guest, Not a member yet? Register   Sign In
Pages suddenly taking 50-100 secs to load. Other sites on server are fine
#1

[eluser]surfgatinho[/eluser]
I built my first CI app about a month ago and it has run fine until today. Now it has started running incredibly slowly.
It's not on all pages though. It's obviously database related as it is the pages running a few more queries that really drag.

It's weird because it is across a range of models and controllers that worked fine yesterday

I'm running Freakauth Light as the user system, so I don't know if there are any known issues here.
I cleared the ci_sessions tables as that had around 30,000 rows. But still so slow

Anyway, any ideas would be greatly appreciated as I'm expecting the client to phone any moment!
#2

[eluser]Derek Allard[/eluser]
When things were working fine, and you didn't touch anything, and suddenly they start acting like that, its almost always due to a change on the server. Contact your host and ask them if they changed anything, and ask if their logs reveal anything.

Is it possible that you've maxed out your mysql storage?
#3

[eluser]surfgatinho[/eluser]
OK, here's the next bit of the puzzle. If I load the model the speed is still OK. However when I call the view that loads that part of the page it all slows down.
The view is only calling a foreach on the result set.

It might even be any view calling a foreach on the result set - although I haven't tested this yet. What's going on?!

[quote author="Derek Allard" date="1217004681"]When things were working fine, and you didn't touch anything, and suddenly they start acting like that, its almost always due to a change on the server. Contact your host and ask them if they changed anything, and ask if their logs reveal anything.
Is it possible that you've maxed out your mysql storage?[/quote]
Afraid its a dedicated server managed by me! Absolutely loads of spare capacity and no updates recently
#4

[eluser]surfgatinho[/eluser]
It seems the culprit is @GetImageSize(image_name). Odd because I've been using this since the site was set up and now it appears to be dragging everything down.
#5

[eluser]Eric Cope[/eluser]
If I recall correctly, @ suppresses errors. What errors are you suppressing? That may be a clue.
php documentation site
#6

[eluser]Matthieu Fauveau[/eluser]
And @ is slow so if it's in a foreach...
#7

[eluser]surfgatinho[/eluser]
I fixed it by using @GetImageSize(path_to_file) instead of @GetImageSize(file_url)
Now the page load is about .4 seconds as oppposed to 100 before.

I'm just trying to think what might have changed.
#8

[eluser]Eric Cope[/eluser]
I would still consider removing the @. That has potential to cause scalability and stability issues later if your application grows. Its better to handle the errors accurately than ignore them. Thats why cars have fuel and temperature gauges.
#9

[eluser]surfgatinho[/eluser]
It seems that getimagesize throws an error when the image does not exist. As this was a test for whether the image exists or not that's a problem.
I used it originally as getimagesize will take a remote or local URL as an argument.

I think I'd probably use file_exists and the full path in future
#10

[eluser]Eric Cope[/eluser]
[quote author="surfgatinho" date="1217094508"]It seems that getimagesize throws an error when the image does not exist. As this was a test for whether the image exists or not that's a problem.
I used it originally as getimagesize will take a remote or local URL as an argument.

I think I'd probably use file_exists and the full path in future[/quote]

I would recommend using both in the future.
Code:
if(file_exists)
{
    if(getimagesize > 0)
    {
        do_some_stuff;
    }
    else
        throw_another_error;
}
else
    throw_error;

its always good to check if a file exists and then check the type/contents of the file.




Theme © iAndrew 2016 - Forum software by © MyBB