The most basic and most oft-repeated task that a DBA has to accomplish is to look at slow logs and filter out queries that are suboptimal, that consume lots of unnecessary resources and that hence slow down the database server. This post looks at why and how VIEWs can help against such suboptimal operations.
There are multiple metrics that are really useful for read workload analysis, that should all be tracked and looked at in performance-critical environments.
The most commonly used is of course Questions (or ‘Queries’, ‘COM_Select’) – this is probably primary finger-pointing metric that can be used in communication with different departments (“why did your qps go up by 30%?”) – it doesn’t always reveal actual cost, it can be increase of actual request rates, it can be new feature, it can be fat fingers error somewhere in the code or improperly handled cache failure.
Another important to note is Connections – MySQL’s costly bottleneck. Though most of users won’t be approaching ~10k/s area – at that point connection pooling starts actually making sense – it is worth to check for other reasons, such as “maybe we connect when we shouldn’t”, or needlessly reconnect, or …
[Read more]Some time ago I wrote about MySQL 5.5 semi-synchronous replication. Since then, I have wanted to benchmark the overhead of semi-synchronous replication with a decent server. Now the occasion presented itself, thanks to some related business that I had to benchmark, and thus I did a few simple runs with and without semi-synchronous replication enabled, to see the impact of this feature on performance. If you haven't read the article on semi-synchronous replication, the bottom line is that, with this feature enabled, the master waits until at least one slave has acknowledged receipt for the data before returning a positive result to the client. This means that for each commit there are two network calls between master and slave. My gut feeling was that this feature would be costly in terms of query response time, although I was not prepared to …
[Read more]
Shard-Query is an open source tool kit which helps
improve the performance of queries against a MySQL database by
distributing the work over multiple machines and/or multiple
cores. This is similar to the divide and conquer approach that
Hive takes in combination with Hadoop.
Shard-Query applies a clever approach to parallelism which allows
it to significantly improve the performance of queries by
spreading the work over all available compute resources. In this
test, Shard-Query averages a nearly 6x (max over 10x) improvement
over the baseline, as shown in the following graph:
One significant advantage of Shard-Query over Hive is that it works with existing MySQL data sets and queries. Another advantage is that it works with all MySQL …
[Read more]Note: We said this was episode 44, but it's really episode 43!
In this episode we give the basics of how replication works, giving knowledge about the fundamentals about replication to better understand why it has certain limitations and benefits.
Slave IO thread states in SHOW
PROCESSLIST
mk-table-checksum
MIXED binary log format defaults to STATEMENT,
unless certain conditions apply, which are listed at that link.
This week we talk about what's new in MySQL 5.6 and the return of labs.mysql.com. We also feature people's reactions to the 5.6 announcement and a special song by Solomon Chang (lyrics below).
Show notes:
If you want to see it for youreslf, there is a video
from the O'Reilly Conference of Tomas Ulin's Keynote, "State
of the Dolphin".
Olav Sandstå's blog post on index condition pushdown optimization.
…
[Read more]
MySQL’s SHOW PROFILES
command and its profiling
support is something that I can’t believe I hadn’t spotted before
today.
It allows you to enable profiling for a session and then record
performance information about the queries executed. It shows
details of the different stages in the query execution (as
usually displayed in the thread state output of SHOW
PROCESSLIST
) and how long each of these stages took.
I’ll demonstrate using an example. First within our session we need to enable profiling, you should only do this in sessions that you want to profile as there’s some overhead in performing/recording the profiling information:
mysql> SET profiling=1; Query OK, 0 rows affected (0.00 sec)
Now let’s run a couple of regular SELECT queries
mysql> SELECT COUNT(*) FROM myTable WHERE extra LIKE '%zkddj%'; +----------+ | COUNT(*) | +----------+ | 0 | …[Read more]
Following up to my previous blog on graphing statement execution in performance_schema, Sunny Bains on the InnoDB team pointed out that in looking at the INSERT graph, he didn’t think I had atomic operations enabled within my build.
Particularly here (from trunk):
225 /******************************************************************//** 226 Increments lock_word the specified amount and returns new value. 227 @return lock->lock_word after increment */ 228 UNIV_INLINE 229 lint 230 rw_lock_lock_word_incr( 231 /*===================*/ 232 rw_lock_t* lock, /*!< in/out: rw-lock */ 233 ulint amount) /*!< in: amount of increment */ 234 { 235 #ifdef …[Read more]
MySQL is the most popular open source SQL database. The ever-increasing performance demands of web-based services have generated significant interest in providing NoSQL access methods to MySQL. Today, MySQL is announcing the preview of the NoSQL to InnoDB via memcached. This offering provides users with the best of both worlds – maintain all of the advantages of rich SQL query language, while providing better performance for simple queries via direct access to shared data.
In this preview release, memcached is implemented as a MySQL plugin daemon, accessing InnoDB directly via the native InnoDB API:
Features provided in the current release:
- Memcached as a daemon plugin of mysqld: both mysqld and memcached are running in the same process space, with very low latency access to data …
For those interested in InnoDB internals, this post tries to explain why the global kernel mutex was required and the new mutexes and rw-locks that now replace it. Along with the long term benefit from this change.
InnoDB’s core sub-systems up to v5.5 are protected by a global mutex called the Kernel mutex. This makes it difficult to do even some common sense optimisations. In the past we tried optimising the code but it would invariably upset the delicate balance that was achieved by tuning of the code that used the global Kernel mutex, leading to unexpected performance regression. The kernel mutex is also abused in several places to cover operations unrelated to the core e.g., some counters in the server thread main loop.
The InnoDB core sub-systems are:
- The Locking sub-system
- The Transaction sub-system
- MVCC views …