|Showing entries 1 to 10 of 10|
Working as a Percona Support Engineer, every day we are seeing lots of issues related to MySQL replication. One very common issue is slave lagging. There are many reasons for slave lag but one common reason is that queries are taking more time on slave then master. How to check and log those long-running queries? From MySQL 5.1, log-slow-slave-statements variable was introduced, which you can enable on slave and log slow queries. But what if you want to log slow queries on slave in earlier versions like MySQL 5.0? There is a good solution/workaround:[Read more...]
A couple of weeks ago, shortly after Vadim wrote about Percona Cloud Tools and using Slow Query Log to capture the data, Mark Leith asked why don’t we just use Performance Schema instead? This is an interesting question and I think it deserves its own blog post to talk about.
First, I would say main reason for using Slow Query Log is compatibility. Basic Slow query log with microsecond query time precision is available starting in MySQL 5.1, while[Read more...]
Join 8000 others and follow Sean Hull on twitter @hullsean. In the past two years we’ve written a ton of material on scalability. Here’s the greatest hits… Why Generalists Are Better at Scaling the Web The internet stack is a complex infrastructure of interlocking components. An scalability engineer must be adept at Linux, plus webservers, […]
Join 7500 others and follow Sean Hull on twitter @hullsean.
There’s a lot of talk on the web about scalability. Making web applications scale is not easy. The modern web architecture has so many moving parts. How can we grapple with the underlying problem?
The truth that is half right. True there are a lot of moving parts, and a lot to setup. The internet stack made up of Linux, Apache, MySQL & PHP. LAMP as it’s called, was built to be resilient, dynamic, and scalable.[Read more...]
Here’s a little trivia that you might find helpful. Suppose that I have the following in the MySQL slow query log (abbreviated for clarity):
# User@Host: root[root] @ localhost [127.0.0.1] # Time: 100919 17:58:52 # Query_time: 9.648427 Lock_time: 8.648039 select sleep(1) from t limit 1;
To get this into the slow query log, I set the long_query_time to 0 and opened two sessions. In one session I ran
LOCK TABLES t WRITE, and in the other I tried to select from that table. As you can see above, 1) LOCK TABLES contributes to the Lock_time number, and 2) the Query_time is the sum of execution time and lock time.
Now, I’ll set long_query_time = 2 and run the same test. What happens? Nothing shows up in the slow query log, because 3) the[Read more...]
This is my first attempt at creating a plugin for MySQL Workbench. As a first step, I’ve created a plugin that summarizes the slow query log if it’s output to the slow_log table, which is an option available in MySQL version 5.1 or newer. It’s similar to the mysqldumpslow perl script, except that it doesn’t require perl, which should be more convenient on Windows. In my next update, the plugin will provide the same summary statistics for the slow query log file on disk.
While the slow query log reports query time, lock time, rows sent and rows examined for each query; it’s often useful to group and aggregate similar queries for analysis. For example, here’s a sample of the plugin output, which is sorted by count, after just a few clicks on a drupal6 site:[Read more...]
This is a hack, but it is a good one. I was looking at some machines on a new client, and they had the general log turned on. I was surprised, because it was a fairly busy server, and they had had many problems with the server a few months ago. I thought perhaps they had turned on the general log to diagnose a problem and forgotten to turn it off, or something similar.
When I looked at the log on disk, I saw it was a symlink to /dev/null. They were running MySQL 5.0, so I immediately realized that it was a hack to have a general log they could “turn on” without having to restart mysqld.
On a different server, I saw the same link to /dev/null done with a slow query log.
The drawbacks to doing it this way is that MySQL still has the overhead of writing to the log file. The I/O overhead is greatly reduced because the writes are[Read more...]
|Showing entries 1 to 10 of 10|