CodeIgniter Forums
Core/Loader 346 Issue - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24)
+--- Thread: Core/Loader 346 Issue (/showthread.php?tid=1279)



Core/Loader 346 Issue - isaiahfrom3r - 02-25-2015

Hi,

I am currently using CI version '2.1.3'.

Our issue is that almost every night when site traffic is higher than normal we run into a Core/Loader : 346 error. I am at a loss as to what to do or check because when that happens the site can be down for up to 30 minutes. If anyone has some insight as to why during heavy use we would get this error I would love to hear from you.


Thanks in Advance.


RE: Core/Loader 346 Issue - Nichiren - 02-25-2015

Do you have the full error from your log? If that means line 346 from system/core/Loader.php then it would reference

PHP Code:
// Load the DB class
$CI->db =& DB($params$active_record); 

Without looking too deeply into it (and someone more knowledgeable than I can chime in), I'd hazard a guess and say your database (or connections) is getting overloaded from the traffic spikes. I can't be sure without actually seeing your system but try checking your database error logs and/or activating your database slow log to see if there are any egregiously slow queries whose effects can be exacerbated by high traffic loads. Otherwise, I'd start checking the webserver error logs for anything out of the ordinary and be on the lookout for connection errors to help lead you to a culprit. This is all just a guess and I could be way off but it wouldn't hurt to check.


RE: Core/Loader 346 Issue - isaiahfrom3r - 02-25-2015

Actually your pretty much spot on from what I can tell. I would assume most sites don't put as much pressure their database servers. I spent most of the day reworking some of our data feed crons to help lower the pressure a bit. Our site revolves around sports so during events it gets hit really hard.

Thanks for your help you have given me a place to start digging.

(02-25-2015, 02:08 PM)Nichiren Wrote: Do you have the full error from your log? If that means line 346 from system/core/Loader.php then it would reference


PHP Code:
// Load the DB class
$CI->db =& DB($params$active_record); 

Without looking too deeply into it (and someone more knowledgeable than I can chime in), I'd hazard a guess and say your database (or connections) is getting overloaded from the traffic spikes. I can't be sure without actually seeing your system but try checking your database error logs and/or activating your database slow log to see if there are any egregiously slow queries whose effects can be exacerbated by high traffic loads. Otherwise, I'd start checking the webserver error logs for anything out of the ordinary and be on the lookout for connection errors to help lead you to a culprit. This is all just a guess and I could be way off but it wouldn't hurt to check.



RE: Core/Loader 346 Issue - Nichiren - 02-25-2015

Glad to help. I work on a few high volume sites myself and have gotten pretty used to issues like this. If your database is really getting hammered, I would highly suggest a caching layer like Redis or memcached especially if you have spare memory lying around unused somewhere. This is one of the first things I did when I hit a wall and it got me pretty far. I don't remember what the state of the CI2 cache drivers are but a quick solution for Redis (to me) is to install phpredis (as recommended in CI 3) and use its methods directly. Good luck.


RE: Core/Loader 346 Issue - silentium - 02-25-2015

I would recommend taking a look at the database config file and see if you have "pconnect" set to TRUE or FALSE.

With "pconnect" set to true CI uses persistent connections to the database, and this can cause database overload on high traffic sites. This option is set to true as default.

I have solved many database issues on high traffic sites (millions of visits a month) just by changing this option to false. However, I would also recommend caching of the database queries when ever possible.


RE: Core/Loader 346 Issue - isaiahfrom3r - 02-26-2015

Thanks for all of the help... I though it was going to work last night but we ended up in the same boat.

I will give what Nichiren said a shot but here is a little more information about our situation.

We are running a spots site that is hitting several data feeds every 3 minutes to update live NBA statistics. Yesterday I made several performance tweaks to make our php scripts run fast and smoother but still ended up hitting a wall. We are noticing it start to happen roughly around the second half.

My initial thought was that maybe some of the database data inserts are backing up on each other to the point where the system ends up crashing. I will have to keep a closer monitor on it tonight and check to see how our DB servers CPU is handling the work load.


If that has given you any more ideas then feel free to post them. Any advice is welcomed.


RE: Core/Loader 346 Issue - silentium - 02-26-2015

It sounds like the issue is due to writing to the database and not read due to high traffic of visits. So caching the database would not really help here. (if the writes are the problem, caching is still always good practice for reading whenever possible)

How many is "several data feeds"? And are you triggering them all at the same time? If you do, I highly recommend to change that to start with to run one or two script at a time. Implement a locking, an example here https://stackoverflow.com/questions/5428631/php-preventing-collision-in-cron-file-lock-safe

Other things to consider could be.