Welcome Guest, Not a member yet? Register   Sign In
lots of traffic mysql side
#1

Hello

I am not a programmer by any means but right now I am involved in the stress load of a website and I see thousands of the following two statements coming in

Query SET NAMES utf8
Init DB testDB

by that I mean, 40k /minute.

I suspect this might be causing issues on mysql but the programming team tells me this is normal and set in the core files of codeigniter so there is nothing they can do

I see it as a waste of cpu cycles to send 40k /minute the same thing (its always going to be the same stuff)

any ideas ? (and thank you all for reading )
Reply
#2

I don't know if what I tell you might resolve the problem but it would be a good idea to initialize the database library only if needed. I encountered a problem where a website was often down because at every visit it would make a database connection, even though I used caching. That was happening because the database library was "autoloading" on every visit. Also look at this: http://stackoverflow.com/questions/21594...8-in-mysql
Reply
#3

Why not encode the db stuff in utf8 ?

for every query to call " set names " is not the best idea it think. if you use pdo you can tell the connection the charset you need

$dsn = 'mysql:host=localhost;dbname=db;charset=utf8';

With mysqli you can also connect with a charset http://php.net/manual/en/mysqli.set-charset.php

Reply
#4

In the codeigniter core file (system\database\drivers\pdo\subdrivers\pdo_mysql_driver.php) below is the line in the code.

Code:
/* Prior to PHP 5.3.6, even if the charset was supplied in the DSN
         * on connect - it was ignored. This is a work-around for the issue.
         *
         * Reference: http://www.php.net/manual/en/ref.pdo-mysql.connection.php
         */
        if ( ! is_php('5.3.6') && ! empty($this->char_set))
        {
            $this->options[PDO::MYSQL_ATTR_INIT_COMMAND] = 'SET NAMES '.$this->char_set
                .(empty($this->dbcollat) ? '' : ' COLLATE '.$this->dbcollat);
        }

Can you make sure that the web server is having php version > 5.3.6?
Reply
#5

I have vague memories that the default database configuration for pconnect is set to true and this has caused problems for some folks.

I had a link in my database.php regarding this problem but it is now broken Sad
// http://codeigniter.com/forums/viewthread/189761/



// http://www.codeigniter.com/user_guide/da...ation.html

pconnect - TRUE/FALSE (boolean) - Whether to use a persistent connection.

If your pconnect configuration is set to true then try setting it to false.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB