upload on 2014.12 [ten important tips of MySQL database design for better performance] Download this PDF
There are few easy ticks to see what is stuck inside MySQL instance. All these techniques will not give you whole picture, but might help to find queries that block performance. Let’s start from what exactly doing your MySQL server right now.
Which queries are running now?
This will give you an idea what’s running right now so you can find long running queries which slowing down MySQL and/or causing replication lag:
mysql -e "SHOW PROCESSLIST" | grep -v -i "sleep"
It is more convenient than just run “SHOW PROCESSLIST” as it’s hiding all connected threads in “Sleep” state so you’ll get a clean output. Also you can get same output but updating each second:
watch -n1 'mysql -e "SHOW FULL PROCESSLIST" | grep -v -i "Sleep"'
What to look for? This is complex output but you can start with Time and State columns. When you see a query running for more …
[Read more]
When I talk about troubleshooting I like to repeat: "Don't grant
database access to everybody!" This can sound a bit weird having
one can give very limited read-only access.
But only if ignore the fact what even minimal privileges in MySQL
allows to change session variables, including those which control
server resources. My favorite example is "Kill MySQL server with
join_buffer_size". But before version 5.7 I could only recommend
this, but not demonstrate. Now, with help of memory summary
tables in Performance Schema, I can show how unprivileged user
can let your server to use great amount of swap.
At first lets create a user account with minimal privileges and
login.
$../client/mysql -ulj -h127.0.0.1 -P13001
Welcome to the MySQL monitor. Commands end with ; or
\g.
Your MySQL connection id is 10
Server version: 5.7.6-m16-debug-log Source distribution
…
High season is coming, how do you make sure that MySQL will handle the increased load? Stress tests could help with that, but it’s not a good idea to run them in a production environment. In this case Select_scan, Select_full_join and other MySQL counters could quickly give you an idea of how many queries are not performing well and could cause a performance degradation as the load goes up.
Select_scan from SHOW GLOBAL STATUS indicates how many full table scans were done since last MySQL restart. Scanning the entire table is a resource intensive operation. It also forces MySQL to store unnecessary data in the buffer pool, wasting memory and IO resources.
Full scan of a tiny table would be quite fast so missing indexes could stay invisible until the load rises or the dataset grows up. This could also be the case for developers who work with too small data sets on their dev boxes. To prevent performance issues all newly added …
[Read more]November 14, 2014 By Severalnines
Thanks to everyone who attended and participated in this week's webinar on '9 DevOps Tips for Going in Production with Galera Cluster for MySQL'. If you missed the sessions or would like to watch the webinar again & browse through the slides, they are now available online.
In this webinar, Severalnines CTO Johan Andersson discussed 9 key aspects to consider before taking Galera Cluster for MySQL into production:
- 101 Sanity Check
- Operating System
- Backup Strategies
- Galera Recovery
- Query Performance
- Schema changes
- Security / Encryption
- Reporting
- Protecting from Disasters
Watch the replay 9 DevOps Tips for Going in …
[Read more]Yesterday, I got the basics going for MySQL Cluster on POWER. Today, I finished up a couple more patches to improve performance and ran some benchmarks.
This is on a 3.7Ghz POWER8 machine with non-balanced memory (only 2 of the 4 NUMA nodes have memory, so we have less total memory bandwidth than we could have, plus I’m going to bind ndbmtd to the CPUs in these NUMA nodes)
With a setup of a single replica and two data nodes on the one machine (each bound to a specific NUMA node), running the flexAsync benchmark on MySQL Cluster 7.3.7, I could get around:
- 3.2 million reads/sec
- 2.6 million deletes/sec
- 2.4 million updates/sec
- 2.4 million inserts/sec.
So, that’s at least in the right ballpark for a first go.
(I’m running this on a big endian host …
[Read more]After some grueling IO testing on 7200rpm disks, I got my hands on some shiny new Samsung 840 SSDs and wanted to share the performance results in similar fashion.
Dell r630, E5-2630 v3 @ 2.40GHz (16 cores), 256GB RAM, Samsung 840 EV SSD 960GB.
Testing was sysbench, fileio-rndrw, async+direct io, 16 threads, 5.5TB RAID-6 using XFS mounted with noatime,inode64 and using the deadline scheduler.
Write Policy | Read Policy | xfs options | Transfer/s | Requests/s | Avg/Request | 95%/Request |
WB | ADRA | sunit=16, swidth=576 blks | 357.31Mb/sec | 22868.08 | 0.17ms | 0.70ms |
I had a few more suggestions thrown out at me before I could wrap this one up.
- Try disabling the RAID controller read-ahead
- Try a few custom options to XFS
- Try RAID-10
First, my final “best” state benchmarks for comparison:
FS | Raid | Size | Mount Options | Transfer/s | Requests/s | Avg/Request | 95%/Request |
xfs | 6 | 4T | noatime,nodiratime,nobarrier | 28.597Mb/sec | 1830.24 | 0.51ms | 2.06ms |
ext4 | 6 | 4T | … |
The MySQL Server 5.7.5 Development Milestone Release, which was published recently, contains some significant changes to the metadata locking (MDL) subsystem and to the usage of the THR_LOCK manager for InnoDB tables. This post provides more information about these changes, which resulted in nice improvements in both scalability and performance.
Sometime during the development cycle of MySQL 5.6 we realized that locks used in the metadata locking subsystem (MDL) implementation can become a scalability bottleneck when many short statements were executed in @autocommit=1 mode against InnoDB tables.
Bug #66473 is a good example (8-table Sysbench POINT_SELECT/InnoDB test). In this particular case the bottleneck was the mutex protecting the MDL_map hash which …
[Read more]Following my previous post, I got some excellent feedback in the forms of comments, tweets and other chat. In no particular order:
- Commenter Tibi noted that ensuring I’m mounting with noatime, nodiratime and nobarrier should all improve performance.
- Commenter benbradley pointed out a missing flag on some of my sysbench tests which will necessitate re-testing.
- Former co-worker @preston4tw suggests looking at different IO schedulers. For all tests past, I used deadline which seems to be best, but re-testing with noop could be useful.
- Fellow DBA @kormoc encouraged me to try many smaller partitions to limit the number of concurrent fsyncs.
There seem to be …
[Read more]