Welcome Guest, Not a member yet? Register   Sign In
Extremely slow speed on my site using codeignitor... is this normal?

Hey guys, I wanted to revisit this thread again to give everyone some updates on my success so far. I have managed to reduce the queries on each page to less than 40 everywhere. This has given an immediate speed boost to my site and its loading up much more faster. I am still looking to improve it a little more as I have now come accross other issues relating to DB connections.

I now often get TOO MANY CONNECTIONS errors on the site

Warning: mysql_connect() [function.mysql-connect]: Too many connections in /home/voucher/public_html/application/config/config.php on line 19
Not connected : Too many connections

Does this releare to the db not being optimised? The server seems to topple over when there are a few people on the site and requires the DB to be restarted to fix this. Not good!

I wanted to get the best resources to look into how I can optimise the DB. Does optimising the DB require code changes as well?

I am yet to apply Phil's library on the caching. THats a big excersize apparently because it touches every single DB query my developer tells me. Can anyone give me any ideas on how i can acheive the caching with phil's library as a quick win?

Congratulations on optimizing your website.

Make sure you DO NOT have persistent connections enabled. It may be a performance boost in the short term but can rapidly overwhelm your database server.

To see if it is enabled, check your database.php config file. Set it to FALSE.

$config['pconnect'] = FALSE;

There may be a way to keep it on if your database server has been tuned correctly. I'm not the person to give you advice on how to do that. I generally stay away from persistent connections with MySQL because they've given me grief in the past.

I had never used Phil's caching before, so perhaps it does require a code change for every database call. It's not considered great practice, but you could alter your driver files to implement some kind of caching (I recommend using memcached since it seems like you have plenty of RAM on your server.)

You can also cache all the content depending on how dynamic your content needs to be. For example, I've seen some nifty caching where PHP is not even called. Just a static cached file via mod rewrite rules. However, to continue to let the webserver parse PHP, you should get a boost just by enabling op caching like APC right off the bat. IF you're not doing op caching, I strongly advise you to do so.

Here is a great talk by PHP creator, Rasmus Lerdorf, on PHP Performance.

Good luck.


Theme © iAndrew 2016 - Forum software by © MyBB