• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Core/Loader 346 Issue

#1
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.
Reply

#2
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.
Reply

#3
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.
Reply

#4
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.
Reply

#5
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.
Reply

#6
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.
Reply

#7
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/5428...-lock-safe

Other things to consider could be.
  • Check execution time for the scripts. If they take more the 3 min to complete, a new instance will start before the old is completed, and that way use up more and more resources. Again, locking feature is good here.
  • Check what MySQL engine you use. For write heavy databases, InnoDB is recommended as it only do row level locking while the default MyISAM do table level locking on writes. Here is some good information on this https://stackoverflow.com/questions/1567...and-innodb
  • Maybe upgrade to MySQL replication Master - Slave setup. More info about that http://www.rackspace.com/knowledge_cente...asterslave But this is a project of it self to update all code to support it.
  • Also, what type of data are the feeds returning. XML or JSON formatted? I would recommend JSON if you don't already use it, and the feeds supports it, as it is faster in most cases to decode in PHP (https://stackoverflow.com/questions/4288...ml-parsing)
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.