June 19, 2013

Comment: Debugging sleeping connections with MySQL

… and kills really old sleeping connections. my.cnf: wait_timeout=180 # = 30min php cron script: #!/usr/bin/php -q 1000 && $row['Command'] == “Sleep“) && ($row['User'] != “Root”)) { $killed

Post: How to debug long-running transactions in MySQL

…-plugin InnoDB versions, you can’t reliably figure out what connection is to blame for blocking others. You can guess, and… status\Gshow full processlist’ > /root/tcpdumps/`date +%s`-innodbstatus pid=$! sleep 30 kill ${pid} fi If this captures anything, then you can simply… server to find idle-in-transaction connections that are just sitting there doing nothing, and kill them if you can’t make…

Post: How to use tcpdump on very busy hosts

… can skew results dramatically. Imagine a situation where a single connection sends two queries and gets two responses, with a response… $TMP/$LOCKFILE # run the tcpdump & write to remote file and sleep for a bit tcpdump -i eth0 -s 65535 -x -n…’ 2>/dev/null \ | ssh $REMOTEHOST — “cat – > $TMP/$TMPfile” & PID=$! sleep $SLEEPTIME kill $PID # set trap to be sure both remote files are…

Post: Analyzing Slow Query Table in MySQL 5.6

…_SET(sql_text, ‘Sleep,Quit,Init DB,Query,Field List,Create DB,Drop DB,Refresh,Shutdown,Statistics,Processlist,Connect,Kill,Debug,Ping,Time,Delayed insert,Change user,Binlog Dump,Table Dump,Connect Out,Register Slave,Prepare…

Post: Apache PHP MySQL and Runaway Scripts

… take Apache Slot, MySQL Connection and other resources. I had discussion today who was thinking Apache would kill the script after “Timeout… simplicity I did not use MySQL, but other system call – sleep() which has similar behavior for sake of experiment: Script which… cleanup work – for example you can open another MySQL connection to kill the query which was running (otherwise query may well continue…

Post: MySQL for Hosting Providers - how do they manage ?

…(“a”,1000000); select sleep(1); SET @a12:=repeat(“a”,1000000); select sleep(1); SET @a13:=repeat(“a”,1000000); select sleep(1); … Causes MySQL… number) Now remove sleep(1) and you will get mysqld quickly running out of memory and being killed by OOM killer or… to select from the table. Any user with permission to connect to MySQL Server can crash it.

Comment: MySQL for Hosting Providers - how do they manage ?

… they are running the same query same connection ID. Kill that connection. That should clear out the deadbeats. If … | | 282 | root | localhost | NULL | Query | 3 | init | select sleep(10) | +—–+——+———–+——+———+——+——-+———————–+ 2 rows in set (0.00 sec) …

Post: Living with backups

…= 1; while(1) { if ($is_running == 0 && $was_running == 1) { kill 19, $pid; $was_running= 0; } if ($is_running == 1 && $was_running == 0) { kill 18, $pid; $was_running= 1; } … my $sth= $dbh->prepare(‘SHOW GLOBAL STATUS LIKE “Threads_connected“‘); … if ($$row…) { last; } sleep(1); } What this script does is to check MySQL status every second and in case the number of connected threads…

Post: Troubleshooting MySQL Memory Usage

… do date >> ps.log ps aux | grep mysqld >> ps.log sleep 60 done Check for Table Cache Related Allocations There are… to connections – orphaned prepared statements, user variables, huge network buffer (can grow up to max_packet_size per connection) are all connection buffers and so if you close connection MySQL can clean them up. Killing connections (or stopping related…

Post: Ultimate MySQL variable and status reference list

…commanual Compressionblogpercona.commanual concurrent_insertblogpercona.commanual connect_timeoutblogpercona.commanual Connectionsblogpercona.commanual consoleblogpercona.commanual…innodb_thread_concurrencyblogpercona.commanual innodb_thread_sleep_delayblogpercona.commanual Innodb_truncated_status_…