May 25, 2012

Comment: Too many connections? No problem!

… website develop in PHP with MYSQL, these are MYSQL values: datadir=/data/mysql socket=/data/mysql/mysql.sock max_connections = 600 wait_timeout = 60 interactive_timeout=1800 skip-name-resolve skip-bdb default-time-zone=America/Caracas log-slow-queries… of connections and so remains for a few minutes, but then so sopresiva connections to the database increases reaching the maximum of connections

Post: Debugging sleeping connections with MySQL

… Services are slow or not available and you’re not dealing with timeouts properly. Or may be you have several connections to…:3306 ESTABLISHED 28540/php-cgi As you can see in this case we can find php-cgi is holding connection in question (this… know any debugger which can connect to PHP process or apache with mod_php and provide backtrace in PHP terms not the one for…

Post: Impact of the number of idle connections in MySQL

… 4` do numconn=$((i*20)) echo “Doing $numconn idle connectionsphp ./make_conn.php $numconn & cat dbt2.sql | mysql -h 10.2.2… connections, the drop is already of 40%. I also verified the laptop (running dbt2) was not slowed down by handling all those connections. I tried generating the idle connections from a third box and…

Post: Why do you need many apache children ?

… ? Well, because they are fat and ugly. Seriously with modern PHP applications each apache children may require 64MB of memory, sometimes… requiring a lot of connections to the database and then if database slows down all these hundreds of connections may start running queries…. Disabling bot is easy however the fact single bot on slow connection may affect things so dramatically is uneasy. This thing remind…

Post: Database problems in MySQL/PHP Applications

… also note for many PHP applications abstraction layer is not the main performance problem, also benefit from persistent connections can be much… which may do very little work and formating, so database connection may become the issue. Caching should be good help in… EXPLAIN for your queries, especially if you see them in slow query log. If you have trouble understanding EXPLAIN or optimizing…

Comment: Why do you need many apache children ?

connections in sleep state for so long time(wait_timeout). Original timeout was set to default (300 seconds). Some terribly slow http connection… not overloaded. So mysql connection opened in slow HTTP connection reaches to wait_timeout and MySQL aborts those mysql connections. There were about 200… me that the main bottleneck of web server only serving php scripts is CPU not RAM. Modern best dual CPUs can…

Post: Handling big result sets

slow down things a bit. So script with prepared statements: < ?php $mysqli = new mysqli(“localhost”, “root”, “”, “test”); /* check connection */ if (mysqli_connect_errno()) { printf(“Connect failed: %s\n”, mysqli_connect_error()); exit(); } $query…

Comment: Debugging sleeping connections with MySQL

… this occurring due to every apache connection opening a mysql connection (as is common in a PHP driven website). If there is a… slow queries increase 4. apache connections start to wait on slow mysql queries 5. apache connections take longer to close 6. more apache connections are… mysql connection is made 8. mysql & apache reach max_connections 9. server slows to a crawl Solution: – Reduce the time a mysql connection is…

Comment: Database problems in MySQL/PHP Applications

… also note for many PHP applications abstraction layer is > not the main performance problem, also benefit from persistent > connections can be much… which may do very little work and formating, so > database connection may become the issue. Caching should be > good help in… EXPLAIN for your queries, especially > if you see them in slow query log. If you have trouble understanding > EXPLAIN or optimizing…

Post: On Good Instrumentation

… of transaction – getting only transactions which are slow is not helpful as we might want …would prefer to split “mysql time” in the “connect time” and “query time” as there are … framework for instrumentation, check out instrumentation for PHP – It has everything mentioned by tracing which …