Skip to content

Slaffcheff's place

System administration / DevOps / Life

  • About

Tag: toolkit

Detecting locked queries with pt-stalk utility.

Posted on July 17, 2017 - April 2, 2018 by Rosen Slavchev

Yo,

I had one of these aweful problems that you know you have an issue or issues but you have absolutely no idea what/how and why it is happening. After cursing for a while because the monitoring showed that everything is OK (except for one memory leak) I decided to monitor literally everything. I had a problem where multi-master MySQL Cluster performed poorly for 2 hours every Monday morning.

So, firstly, I checked all system parameters – RAM, CPU, hdd. All good.

Then I checked all crontabs. I walked through all scheduled scripts that are set to run Sunday evening or Monday morning. Again simple tasks that I ran manually and they took <1 sec.

I checked for deadlocks but I knew that’s not the problem. If there was a deadlock, the whole DB whould have been frozen. So .. yeah. The last thing that came up on my mind – processlist of queries. That’s where pt-stalk (Percona utility) stepped in. That’s how I discovered where my issue came from. I had so many locked queries .. But never midn, I wrote the whole thing just to provide you with the script I used.

wget http://bit.ly/1ltoZtk -O pt-stalk

chmod +x pt-stalk

mkdir -p /var/lib/pt-stalk/

/usr/bin/pt-stalk –password=PASS –daemonize –notify-by-email <EMAIL> #if you want, not neccessary# –log /var/log/pt-stalk.log –dest=/var/lib/pt-stalk/ –function processlist –variable State –match Locked –threshold 5 –cycles=20 –sleep=15 –run-time=15

Posted in Linux, MySQLTagged database, deadlock, mysql, percona, pt-stalk, query, sql, toolkit

Recent Posts

  • Segmentation fault on openSUSE Leap 15.0
  • Подпишете петицията ПРОТИВ чл. 13.
  • Free image stock and graphical resources
  • Българският mirror на openSUSE
  • openSUSE в България с 2 събитие за този месец!

Archives

  • October 2019
  • November 2018
  • June 2018
  • April 2018
  • March 2018
  • January 2018
  • October 2017
  • August 2017
  • July 2017
  • July 2016
  • September 2015
  • August 2015
  • March 2015
  • February 2015

Categories

  • Automation
  • Cyber security
  • Hacking
  • Linux
  • MySQL
  • openSUSE
  • Phrack
  • Quicks
  • Scripting
  • Uncategorized
  • Up to date
  • Web Freedom
  • Windows Server
Proudly powered by WordPress | Theme: micro, developed by DevriX.