SlideShare a Scribd company logo
1 of 31
Download to read offline
www.fromdual.com
1 / 31
MariaDB / MySQL Stolperfallen
und wie komme ich da wieder raus?
GNU / LinuxDay im Vorarlberg 2020,
Dornbirn (Austria)
Oli Sennhauser
Senior MariaDB und MySQL Berater, FromDual GmbH
https://www.fromdual.com/presentations
www.fromdual.com
2 / 31
Über FromDual GmbH
Support
remote-DBA
Schulung
Beratung
www.fromdual.com
3 / 31
Inhalt
Stolperfallen
➢
All – Admins und Entwickler
➢
Dev – Entwickler
➢
Adm – Admins
www.fromdual.com
4 / 31
All: MySQL ≠ MariaDB !
●
Up to version 5.5: ~100% "drop-in-replacement" (2010 – 2015)
●
Version 10.0 – 10.2 / 5.6 – 5.7: only "compatible" (2013 – 2017)
●
Since version 10.3 / 8.0: "different" RDBMS (but still similar) (since 2018)
●
MariaDB vs. MySQL ≈ Percona Server (99.99% compatible)
●
Imitations
●
Amazon Aurora – MySQL (RDS) – "fully compatible"
●
"TiDB is fully compatible with the MySQL 5.7 protocol and the common features
and syntax of MySQL 5.7"
●
TDSQL (Tencent) – "Compatible with syntax elements and access API"
●
Strategy
●
Is the application "certified" against my fork?
●
Decision: Support both or only one fork (which one???)?
●
Very good testing!
www.fromdual.com
5 / 31
Consequences in code:
// MySQL/Percona 5.7 ff.
if ( (($aInstanceInfo['branch'] == 'MySQL')
|| ($aInstanceInfo['branch'] == 'Percona')
)
&& ($aInstanceInfo['mr_version'] >= '050700') )
{
// MySQL 5.7.0 - 5.7.99
if ( ($aInstanceInfo['mr_version'] >= '050700')
&& ($aInstanceInfo['mr_version'] <= '050799'))
{
...
}
// MySQL 8.0 DOES support this feature but has different tables!
elseif ( ($aInstanceInfo['mr_version'] >= '080000') ) {
...
}
} // MySQL + Percona 5.7 ff.
// MariaDB and MySQL 5.6 and older
else {
// MariaDB 10.5 and newer
if ( $aInstanceInfo['mr_version'] >= '100500') {
...
}
else {
...
}
} // MariaDB
www.fromdual.com
6 / 31
All: KISS
●
"Keep It Stupid Simple"
●
Design principle by the U.S. Navy, 1960 and others (Wikipedia)
●
"Most systems work best if they are kept simple rather than made complicated"
●
Complicated solutions will break sooner or later!
●
Caution: Software vendors, IT consultants and paper tigers have opposite goals!
●
Strategy:
●
Try to make/keep it simple. Where and why do errors happen?
●
Simplicity should be a key goal in design and unnecessary complexity should
be avoided
●
Reflect the requirements! Can we reduce or adapt the requirements?
●
Take your time to make a sketch (map) to get an overview!
www.fromdual.com
7 / 31
All: non-Kiss
www.fromdual.com
8 / 31
Dev: MyISAM table locking
●
MyISAM was default until about 2013!
●
Old and legacy
●
"Never change a running system" :-(
●
Problem wit MyISAM:
●
NOT crash-safe!!! → Possibility of corrupt data!
●
Table level locks! → Does NOT scale!
●
No transactions... (business problem not DB)
●
Non obvious: Also reads are affected
●
Symptoms: PROCESSLIST:
●
"Waiting for table level lock"
●
Strategy:
●
Think about migrating to InnoDB.
www.fromdual.com
9 / 31
MyISAM table locking
Time State Info
6 Sending data select UserIndex, LastUsedShopLanguage from webshop_user2 wh
6 Waiting for table level lock update webshop_user2 set DataChange=1, LastDataChange=NOW()
6 Waiting for table level lock select UserIndex from webshop_user2 where UserIndex=317249 a
5 Waiting for table level lock update webshop_user2 set DataChange=1, LastDataChange=NOW()
5 Waiting for table level lock select UserIndex from webshop_user2 where UserIndex=1631890
5 Waiting for table level lock select UserIndex from webshop_user2 where UserIndex=695182 a
5 Waiting for table level lock select UserIndex from webshop_user2 where UserIndex=1583223
5 Waiting for table level lock select UserIndex from webshop_user2 where UserIndex=969880 a
5 Waiting for table level lock select Password, UserIndex, SubShop, MainSubShop, State, Adv
3 Waiting for table level lock select Password, UserIndex, SubShop, MainSubShop, State, Adv
3 Waiting for table level lock select UserIndex from webshop_user2 where UserIndex=1661429
3 Waiting for table level lock select UserIndex from webshop_user2 where UserIndex=654008 a
2 Waiting for table level lock select UserIndex from webshop_user2 where UserIndex=795808 a
2 Waiting for table level lock select UserIndex from webshop_user2 where UserIndex=1654024
2 Waiting for table level lock select Password, UserIndex, SubShop, MainSubShop, State, Adv
2 Waiting for table level lock select UNIX_TIMESTAMP(LastDataImport) from webshop_user2 whe
www.fromdual.com
10 / 31
Adm: Big ibdata1
●
ibdata1 is called the System Tablespace
●
Today it contains only "system" data
●
Earlier it also contained "user" data
●
Controlled by innodb_file_per_table = {on | off}
●
Default to on since MariaDB / MySQL 5.5
●
So no more user data in there...?
●
Why ibdata1 can still grow / is still big?
●
Historical user data???
●
Long (read) and/or big (write) transactions
→ many UNDO log segments (ROLLBACK)
●
Big InnoDB Temporary Tables
●
Strategy:
●
Small transactions (anyway a good idea from DB point of view!)
●
UNDO Tablespaces (10.0 / 5.6)
●
InnoDB Temporary Tablespaces (10.2 / 5.7)
●
System Tablespace NEVER shrinks!!!
●
Otherwise only: dump / restore (TTS is too complicated!?!)
www.fromdual.com
11 / 31
All: Noisy Neighbours
●
Problem:
●
Shared and consolidated resources (SAN, network, VM, Container, many
connections, ...)
●
"Others" use "our!" resources
●
→ "We" become slow or even get outages...
●
Examples:
●
Backup times deviate
●
Cloud ping times go suddenly up
●
Unforeseen outages/freezes
●
I/O becomes slow
●
Strategy:
●
Do NOT share (egoistic).
●
Monitor well!
●
Know the "big picture"!
●
Consider, that you are not alone.
Image by Free-Photos on Pixabay
www.fromdual.com
12 / 31
All: Noisy Neighbours
www.fromdual.com
13 / 31
Dev: No BLOBs in a RDBMS
●
One big red database vendor claimed:
●
"You can store now videos in the database!"
●
I also found it cool once... :-(
●
Problem:
●
Query latency higher and
●
Database throughput lower
●
Backup size and time will increase
●
DDL operations will take ages
●
Buffer Pool (cache) is flooded
●
Strategy:
●
Do NOT store BLOBs in the RDBMS but on a filer (Disk,
NAS, SAN). They are made for this task.
www.fromdual.com
14 / 31
Adm: Disk full!
●
Disk full is more or less the worst you can do to your database!
●
DB will stuck
●
Worst case you get corruptions
●
Difficult to make it work again because of lack of free disk space
●
I/O systems become slower if they are filled more than 90% (SAN, SSD, ...)
●
How to find who is the evil?
● df -h; du -hsc; ls -lSr
●
Who is the evil:
●
Mostly Binary Logs (or Relay Logs)
●
Temporary Tables (/tmp?)
●
DB files (*.ibd)
●
Other Logs (error, slow, general → FLUSH LOGS after rm!)
●
ibdata1 not so common any more nowadays
●
Strategy:
●
Monitor your disk space!
●
Try to predict how long it will take until disk is full.
www.fromdual.com
15 / 31
Dev: Locking
●
Locking is caused by the application and is NOT a database problem!!!
●
So search there and not in the database.
●
Your DBA can help you finding your problem...
●
Different type of locks:
●
Explicit locks (LOCK TABLE...)
●
MyISAM Table Level Locks (write AND read!)
●
Metadata Locks (DDL vs. DML + SELECT)
●
InnoDB Row Level Locks (and special case: Deadlock)
●
Galera Cluster Lock (DDL with TOI (default))
●
Galera Cluster Conflict (looks like a deadlock but is not).
●
Strategy:
●
Learn more about locking
●
Avoid: LOCK TABLE and MyISAM
●
Be careful with DDL operations
●
Do fast and small DML operations (smaller chunks and Query Tuning)
www.fromdual.com
16 / 31
Adm: "Crash"
●
There is an inflationary use of the term "Crash"!
●
What we have seen declared as a crash:
●
Lost connection
●
Killed connection (connection_timeout)
●
Stalled system caused by Locks (MyISAM, Query Cache)
●
Refused connections
●
Properly shutdown database (see error log)
●
Killed DB server (Oom Killer) → can be considered as a crash (syslog)
●
You hit a Bug with Stacktrace → this is a real crash! (see error log)
●
Strategy:
●
Find the real cause of the symptom
●
Check MariaDB / MySQL error log (stop sequence, start sequence, stack)
●
Check syslog (Oom killer: Who eats all your memory?)
●
Possibly InnoDB Buffer Pool or max_connections are too big!
●
Or you hit a bug.
www.fromdual.com
17 / 31
Adm: Oom and Restart
Syslog:
...
Out of memory: Kill process 1904 (mysqld) score 39 or sacrifice child
Killed process 1904 (mysqld) total-vm:2855024kB, anon-rss:449640kB, file-rss:0kB
...
NO Shutdown sequence in MariaDB / MySQL error log (kill -9)
MariaDB / MySQL error log:
[Note] bin/mysqld (initiated by: unknown): Normal shutdown
...
[Note] bin/mysqld: Shutdown complete
--
Version: '10.0.19-MariaDB' socket: '/var/lib/mysql/mysql.sock' port: 3306 MariaDB Server
/usr/sbin/mysqld (mysqld 10.0.19-MariaDB) starting as process 4469 ...
...
[Note] Server socket created on IP: '::'.
[Note] bin/mysqld: ready for connections.
www.fromdual.com
18 / 31
Real Crash with Stacktrace
111208 14:35:05 [ERROR] mysqld got signal 11 ;
This could be because you hit a bug. It is also possible that this binary
or one of the libraries it was linked against is corrupt, improperly built,
or misconfigured. This error can also be caused by malfunctioning hardware.
We will try our best to scrape up some info that will hopefully help diagnose
the problem, but since we have already crashed, something is definitely wrong
and this may fail.
...
Thread pointer: 0x0
Attempting backtrace. You can use the following information to find out
where mysqld died. If you see no messages after this, something went
terribly wrong...
stack_bottom = (nil) thread_stack 0x48000
./bin/mysqld(my_print_stacktrace+0x2e) [0xa1195e]
./bin/mysqld(handle_segfault+0x3f6) [0x6340a6]
/lib64/libpthread.so.0 [0x3248e0eb10]
./bin/mysqld(ma_checkpoint_execute+0x42d) [0x83bead]
./bin/mysqld(ma_checkpoint_background+0x23f) [0x83c9af]
/lib64/libpthread.so.0 [0x3248e0673d]
/lib64/libc.so.6(clone+0x6d) [0x32482d40cd]
www.fromdual.com
19 / 31
All: Tables w/o PK
●
Tables without a Primary Key are
●
Bad design in a relational model
●
Possibly worse latency and throughput
●
Causes Slave lagging on UPDATE and DELETE
●
Prevents use of Galera Cluster/InnoDB Cluster!
●
Strategy:
●
Create always Primary Keys on every MariaDB /
MySQL table (also in DWH / Star Model!)
●
AUTO_INCREMENT can be used
www.fromdual.com
20 / 31
Dev: Server has gone away!
●
I was very frightened the first time!
●
Better: "Connection was terminated!"
●
Symptom: Connection from client to server
was terminated.
●
Cause:
●
Connection was killed (by admin?)
●
Retrieved too big results (max_allowed_packet)
●
Server was stopped, killed or crashed
●
Strategy:
●
1. Check if admin has killed your connection (because it harmed
the database)
●
2. Check Error Log for Start/Stop or Crash messages
●
3. Try to reproduce and possibly increase max_allowed_packet
(typically BLOB or TEXT)
Image by FreePhotosART on Pixabay
www.fromdual.com
21 / 31
Adm: NUMA
●
Problem: Big machines:
more than 1 CPU/socket
●
Heavy swapping!
●
Swappiness does NOT help!
●
You must tell the O/S how to behave:
●
Strategy:
●
Avoid such big machines! You mostly do not need them!
● innodb_numa_interleave = ON
●
But: Not in all packages for all distributions for all versions
available! :-(
Stolen from: blog.sqlauthority.com
www.fromdual.com
22 / 31
All: Slave Lag
●
Causes:
●
Long running Query (DML or DDL)
●
Missing Primary Key (UPDATE, DELETE) → Long running Query
●
Weaker Slave than master (RAM, I/O, ...)?
●
Strategy:
●
Do smaller transactions (not possible with DDL)
●
Upgrade MariaDB/MySQL: DDL are online or instantaneous
●
Add Primary Keys on ALL Tables
●
Configure Slave correctly and buy adequate hardware
●
Release hand break: innodb_flush_log_at_trx_commit = 2 / sync_binlog = 0
●
Last alternative: Parallel Replication (since MariaDB 10.0 and MySQL 5.6)
SQL> SHOW SLAVE STATUSG
*************************** 1. row ***************************
...
Slave_IO_Running: Yes
Slave_SQL_Running: Yes
...
Seconds_Behind_Master: 999
www.fromdual.com
23 / 31
All: Slave Lag
www.fromdual.com
24 / 31
Dev: Sending data
●
Also interesting for Admins to find the evil!
●
"Sending data" is NOT "Writing to net"
●
Strategies:
●
→ Appropriate DB Cache configuration (InnoDB Buffer Pool)
Disk I/O?
●
→ Query Tuning
●
→ Change design or architecture
●
→ Or live with it (SISO principle)
SQL> SHOW PROCESSLIST;
+--------+------+-----------+------+------+--------------+------------------------------+
| Id | User | Host | db | Time | State | Info |
+--------+------+-----------+------+------+--------------+------------------------------+
| 577558 | app | 10.0.0.4 | test | 42 | Sending data | SELECT * FROM very_big_table |
+--------+------+-----------+------+------+--------------+------------------------------+
www.fromdual.com
25 / 31
Sending data
SQL-Layer
Handler Interface
InnoDB MyISAM Aria Memory
Storage Engine Layer
Sending data
 read_buffer
 join_buffer
 tmp_table
 read_rnd_buffer read_buffer
 sort_buffer
Threads
Application
Writing data to net
3306
www.fromdual.com
26 / 31
All: Too many connections
●
You reached the database
limit:
● max_connections
● max_user_connections
●
Per Account MAX_USER_CONNECTIONS
●
This is a fuse to protect your database!
●
Cause: Locks, Long running queries, etc.
●
Strategy:
●
Find the reason why you reached the limit!
●
Good starting point: SHOW PROCESSLIST;
Image by Robert Allmann on Pixabay
www.fromdual.com
27 / 31
All: How many connections?
DB
max_connections
= 151
Web-Server
ServerLimit (16)
x ThreadsPerChild (25)
= 400 threads
n x
Java + c3p0
maxPoolSize = 15 x m
15 x m
+ 400 x n
+ others
= max_connections
highly busy: 2 – 6 conn/core
busy system: 10 conn/core
idle system: many conn/core
www.fromdual.com
28 / 31
Dev: Simple Query Tuning
●
Most seen simple errors beside missing indices:
● WHERE col LIKE '%...%';
●
% on the left: Index cannot be taken!
●
Avoid, change business rule or use Solr
● WHERE UNIX_TIMESTAMP(Date) < 12454232423;
●
Function covered column: Index cannot be taken!
●
rewrite Query: Date < FROM_UNIXTIME(1245...)
● WHERE LOWER(email) = LOWER('contact@fromdual.com)
●
MariaDB/MySQL are case INsensitive!
●
Same problem as above but possibly not solvable
●
Use indexed GENERATED PERSISTENT column!
● INDEX (a, b, c) ; WHERE b = 5 AND c = 2;
●
a filter is missing in the Query
●
Either add a filter to the query or create index on (b,c)
www.fromdual.com
29 / 31
All: Galera
●
Galera is cool but NOT the solution for all problems!!!
●
Galera IS MariaDB / MySQL BUT behaves slightly different...
●
Problems:
●
Stable Infrastructure (HW, NW, VM)
●
Operations not simple, needs drill!
●
Application must support Galera behaviour
●
→ See Galera Limitations @FromDual.com
●
Strategy:
●
Understand the technology!!!
●
Test application well
●
Drill your ops team, also for the bad weather scenarios.
www.fromdual.com
30 / 31
All: Progress bar
●
We rarely have one on CLI (MariaDB tries a bit)
●
But how can we though see progress?
●
Disk filling / file growing:
●
watch is your friend!
● df -h, ls -la, du -hsc
●
Progress on file operations:
●
Many files: ls -la /proc/<PID>/fd/*
●
Big file: watch -n 1 'cat /proc/<PID>/fdinfo/<FD>'
●
Database:
●
INSERT: AUTO_INCREMENT counter or SELECT MAX(id) or SELECT COUNT(*)
●
Size of file (*.ibd)
●
SHOW PROCESSLIST → Progress (MariaDB only)
● SHOW GLOBAL STATUS LIKE 'Innodb_rows%ed';
● INFORMATION_SCHEMA.USER_STATISTICS
● PERFORMANCE_SCHEMA.status_by_thread
www.fromdual.com
31 / 31
Q & A
Fragen ?
Diskussion?
Wir haben Zeit für ein persönliches Gespräch...
●
FromDual bietet neutral und unabhängig:
●
Beratung
●
Remote-DBA
●
Support für MariaDB, MySQL und Galera Cluster
●
Schulung www.fromdual.com/presentations

More Related Content

Similar to MariaDB / MySQL tripping hazard and how to get out again?

High-availability with Galera Cluster for MySQL
High-availability with Galera Cluster for MySQLHigh-availability with Galera Cluster for MySQL
High-availability with Galera Cluster for MySQLFromDual GmbH
 
UKOUG 2011: Practical MySQL Tuning
UKOUG 2011: Practical MySQL TuningUKOUG 2011: Practical MySQL Tuning
UKOUG 2011: Practical MySQL TuningFromDual GmbH
 
MySQL always-up with Galera Cluster
MySQL always-up with Galera ClusterMySQL always-up with Galera Cluster
MySQL always-up with Galera ClusterFromDual GmbH
 
MySQL 5.6 Performance
MySQL 5.6 PerformanceMySQL 5.6 Performance
MySQL 5.6 PerformanceMYXPLAIN
 
MySQL for Oracle DBAs
MySQL for Oracle DBAsMySQL for Oracle DBAs
MySQL for Oracle DBAsFromDual GmbH
 
Gdb basics for my sql db as (percona live europe 2019)
Gdb basics for my sql db as (percona live europe 2019)Gdb basics for my sql db as (percona live europe 2019)
Gdb basics for my sql db as (percona live europe 2019)Valerii Kravchuk
 
M|18 Battle of the Online Schema Change Methods
M|18 Battle of the Online Schema Change MethodsM|18 Battle of the Online Schema Change Methods
M|18 Battle of the Online Schema Change MethodsMariaDB plc
 
Gdb basics for my sql db as (openfest 2017) final
Gdb basics for my sql db as (openfest 2017) finalGdb basics for my sql db as (openfest 2017) final
Gdb basics for my sql db as (openfest 2017) finalValeriy Kravchuk
 
MySQL configuration - The most important Variables
MySQL configuration - The most important VariablesMySQL configuration - The most important Variables
MySQL configuration - The most important VariablesFromDual GmbH
 
MySQL Parallel Replication: inventory, use-case and limitations
MySQL Parallel Replication: inventory, use-case and limitationsMySQL Parallel Replication: inventory, use-case and limitations
MySQL Parallel Replication: inventory, use-case and limitationsJean-François Gagné
 
Redis Developers Day 2014 - Redis Labs Talks
Redis Developers Day 2014 - Redis Labs TalksRedis Developers Day 2014 - Redis Labs Talks
Redis Developers Day 2014 - Redis Labs TalksRedis Labs
 
Tales from the Field
Tales from the FieldTales from the Field
Tales from the FieldMongoDB
 
Ukoug 2011 mysql_arch_for_orcl_dba
Ukoug 2011 mysql_arch_for_orcl_dbaUkoug 2011 mysql_arch_for_orcl_dba
Ukoug 2011 mysql_arch_for_orcl_dbaorablue11
 
MySQL/MariaDB Parallel Replication: inventory, use-case and limitations
MySQL/MariaDB Parallel Replication: inventory, use-case and limitationsMySQL/MariaDB Parallel Replication: inventory, use-case and limitations
MySQL/MariaDB Parallel Replication: inventory, use-case and limitationsJean-François Gagné
 
IT Tage 2019 MariaDB 10.4 New Features
IT Tage 2019 MariaDB 10.4 New FeaturesIT Tage 2019 MariaDB 10.4 New Features
IT Tage 2019 MariaDB 10.4 New FeaturesFromDual GmbH
 
Linuxfest Northwest Proper Care and Feeding Of a MySQL for Busy Linux Admins
Linuxfest Northwest Proper Care and Feeding Of a MySQL for Busy Linux AdminsLinuxfest Northwest Proper Care and Feeding Of a MySQL for Busy Linux Admins
Linuxfest Northwest Proper Care and Feeding Of a MySQL for Busy Linux AdminsDave Stokes
 
MySQL Parallel Replication: inventory, use-case and limitations
MySQL Parallel Replication: inventory, use-case and limitationsMySQL Parallel Replication: inventory, use-case and limitations
MySQL Parallel Replication: inventory, use-case and limitationsJean-François Gagné
 
The Full MySQL and MariaDB Parallel Replication Tutorial
The Full MySQL and MariaDB Parallel Replication TutorialThe Full MySQL and MariaDB Parallel Replication Tutorial
The Full MySQL and MariaDB Parallel Replication TutorialJean-François Gagné
 
Proper Care and Feeding of a MySQL Database for Busy Linux Administrators
Proper Care and Feeding of a MySQL Database for Busy Linux AdministratorsProper Care and Feeding of a MySQL Database for Busy Linux Administrators
Proper Care and Feeding of a MySQL Database for Busy Linux AdministratorsDave Stokes
 

Similar to MariaDB / MySQL tripping hazard and how to get out again? (20)

High-availability with Galera Cluster for MySQL
High-availability with Galera Cluster for MySQLHigh-availability with Galera Cluster for MySQL
High-availability with Galera Cluster for MySQL
 
UKOUG 2011: Practical MySQL Tuning
UKOUG 2011: Practical MySQL TuningUKOUG 2011: Practical MySQL Tuning
UKOUG 2011: Practical MySQL Tuning
 
MySQL and MariaDB Backups
MySQL and MariaDB BackupsMySQL and MariaDB Backups
MySQL and MariaDB Backups
 
MySQL always-up with Galera Cluster
MySQL always-up with Galera ClusterMySQL always-up with Galera Cluster
MySQL always-up with Galera Cluster
 
MySQL 5.6 Performance
MySQL 5.6 PerformanceMySQL 5.6 Performance
MySQL 5.6 Performance
 
MySQL for Oracle DBAs
MySQL for Oracle DBAsMySQL for Oracle DBAs
MySQL for Oracle DBAs
 
Gdb basics for my sql db as (percona live europe 2019)
Gdb basics for my sql db as (percona live europe 2019)Gdb basics for my sql db as (percona live europe 2019)
Gdb basics for my sql db as (percona live europe 2019)
 
M|18 Battle of the Online Schema Change Methods
M|18 Battle of the Online Schema Change MethodsM|18 Battle of the Online Schema Change Methods
M|18 Battle of the Online Schema Change Methods
 
Gdb basics for my sql db as (openfest 2017) final
Gdb basics for my sql db as (openfest 2017) finalGdb basics for my sql db as (openfest 2017) final
Gdb basics for my sql db as (openfest 2017) final
 
MySQL configuration - The most important Variables
MySQL configuration - The most important VariablesMySQL configuration - The most important Variables
MySQL configuration - The most important Variables
 
MySQL Parallel Replication: inventory, use-case and limitations
MySQL Parallel Replication: inventory, use-case and limitationsMySQL Parallel Replication: inventory, use-case and limitations
MySQL Parallel Replication: inventory, use-case and limitations
 
Redis Developers Day 2014 - Redis Labs Talks
Redis Developers Day 2014 - Redis Labs TalksRedis Developers Day 2014 - Redis Labs Talks
Redis Developers Day 2014 - Redis Labs Talks
 
Tales from the Field
Tales from the FieldTales from the Field
Tales from the Field
 
Ukoug 2011 mysql_arch_for_orcl_dba
Ukoug 2011 mysql_arch_for_orcl_dbaUkoug 2011 mysql_arch_for_orcl_dba
Ukoug 2011 mysql_arch_for_orcl_dba
 
MySQL/MariaDB Parallel Replication: inventory, use-case and limitations
MySQL/MariaDB Parallel Replication: inventory, use-case and limitationsMySQL/MariaDB Parallel Replication: inventory, use-case and limitations
MySQL/MariaDB Parallel Replication: inventory, use-case and limitations
 
IT Tage 2019 MariaDB 10.4 New Features
IT Tage 2019 MariaDB 10.4 New FeaturesIT Tage 2019 MariaDB 10.4 New Features
IT Tage 2019 MariaDB 10.4 New Features
 
Linuxfest Northwest Proper Care and Feeding Of a MySQL for Busy Linux Admins
Linuxfest Northwest Proper Care and Feeding Of a MySQL for Busy Linux AdminsLinuxfest Northwest Proper Care and Feeding Of a MySQL for Busy Linux Admins
Linuxfest Northwest Proper Care and Feeding Of a MySQL for Busy Linux Admins
 
MySQL Parallel Replication: inventory, use-case and limitations
MySQL Parallel Replication: inventory, use-case and limitationsMySQL Parallel Replication: inventory, use-case and limitations
MySQL Parallel Replication: inventory, use-case and limitations
 
The Full MySQL and MariaDB Parallel Replication Tutorial
The Full MySQL and MariaDB Parallel Replication TutorialThe Full MySQL and MariaDB Parallel Replication Tutorial
The Full MySQL and MariaDB Parallel Replication Tutorial
 
Proper Care and Feeding of a MySQL Database for Busy Linux Administrators
Proper Care and Feeding of a MySQL Database for Busy Linux AdministratorsProper Care and Feeding of a MySQL Database for Busy Linux Administrators
Proper Care and Feeding of a MySQL Database for Busy Linux Administrators
 

More from FromDual GmbH

PXC 5.5 to MariaDB 10.4 Galera Cluster Migration Workshop
PXC 5.5 to MariaDB 10.4 Galera Cluster Migration WorkshopPXC 5.5 to MariaDB 10.4 Galera Cluster Migration Workshop
PXC 5.5 to MariaDB 10.4 Galera Cluster Migration WorkshopFromDual GmbH
 
MariaDB 10.4 New Features
MariaDB 10.4 New FeaturesMariaDB 10.4 New Features
MariaDB 10.4 New FeaturesFromDual GmbH
 
MariaDB 10.2 New Features
MariaDB 10.2 New FeaturesMariaDB 10.2 New Features
MariaDB 10.2 New FeaturesFromDual GmbH
 
MySQL für Oracle DBA's
MySQL für Oracle DBA'sMySQL für Oracle DBA's
MySQL für Oracle DBA'sFromDual GmbH
 
MySQL Backup/Recovery
MySQL Backup/RecoveryMySQL Backup/Recovery
MySQL Backup/RecoveryFromDual GmbH
 
MySQL Beispiele aus der Praxis - Wie setzen Kunden MySQL ein?
MySQL Beispiele aus der Praxis - Wie setzen Kunden MySQL ein?MySQL Beispiele aus der Praxis - Wie setzen Kunden MySQL ein?
MySQL Beispiele aus der Praxis - Wie setzen Kunden MySQL ein?FromDual GmbH
 
MySQL-Server im Teamwork - Replikation und Cluster
MySQL-Server im Teamwork - Replikation und ClusterMySQL-Server im Teamwork - Replikation und Cluster
MySQL-Server im Teamwork - Replikation und ClusterFromDual GmbH
 
Der Datenbank-Backup ist gemacht - was nun?
Der Datenbank-Backup ist gemacht - was nun?Der Datenbank-Backup ist gemacht - was nun?
Der Datenbank-Backup ist gemacht - was nun?FromDual GmbH
 
Weltweite Produktionsdatenverwaltung mit MySQL-Replikation
Weltweite Produktionsdatenverwaltung mit MySQL-ReplikationWeltweite Produktionsdatenverwaltung mit MySQL-Replikation
Weltweite Produktionsdatenverwaltung mit MySQL-ReplikationFromDual GmbH
 
MySQL Performance Tuning für Oracle-DBA's
MySQL Performance Tuning für Oracle-DBA'sMySQL Performance Tuning für Oracle-DBA's
MySQL Performance Tuning für Oracle-DBA'sFromDual GmbH
 
MySQL Security SLAC 2015
MySQL Security SLAC 2015MySQL Security SLAC 2015
MySQL Security SLAC 2015FromDual GmbH
 
MySQL Performance Tuning für Entwickler
MySQL Performance Tuning für EntwicklerMySQL Performance Tuning für Entwickler
MySQL Performance Tuning für EntwicklerFromDual GmbH
 
MySQL Replikation - Die Eier legende Wollmilchsau?
MySQL Replikation - Die Eier legende Wollmilchsau?MySQL Replikation - Die Eier legende Wollmilchsau?
MySQL Replikation - Die Eier legende Wollmilchsau?FromDual GmbH
 
Reading MySQL fingerprints
Reading MySQL fingerprintsReading MySQL fingerprints
Reading MySQL fingerprintsFromDual GmbH
 
MySQL Indexierung CeBIT 2014
MySQL Indexierung CeBIT 2014MySQL Indexierung CeBIT 2014
MySQL Indexierung CeBIT 2014FromDual GmbH
 
MySQL Cluster with Galera Cluster for MySQL
MySQL Cluster with Galera Cluster for MySQLMySQL Cluster with Galera Cluster for MySQL
MySQL Cluster with Galera Cluster for MySQLFromDual GmbH
 
Need for Speed: Mysql indexing
Need for Speed: Mysql indexingNeed for Speed: Mysql indexing
Need for Speed: Mysql indexingFromDual GmbH
 
MySQL HA and Security
MySQL HA and SecurityMySQL HA and Security
MySQL HA and SecurityFromDual GmbH
 
MySQL High Availability Solutions
MySQL High Availability SolutionsMySQL High Availability Solutions
MySQL High Availability SolutionsFromDual GmbH
 

More from FromDual GmbH (20)

PXC 5.5 to MariaDB 10.4 Galera Cluster Migration Workshop
PXC 5.5 to MariaDB 10.4 Galera Cluster Migration WorkshopPXC 5.5 to MariaDB 10.4 Galera Cluster Migration Workshop
PXC 5.5 to MariaDB 10.4 Galera Cluster Migration Workshop
 
MariaDB 10.4 New Features
MariaDB 10.4 New FeaturesMariaDB 10.4 New Features
MariaDB 10.4 New Features
 
MariaDB 10.2 New Features
MariaDB 10.2 New FeaturesMariaDB 10.2 New Features
MariaDB 10.2 New Features
 
MySQL für Oracle DBA's
MySQL für Oracle DBA'sMySQL für Oracle DBA's
MySQL für Oracle DBA's
 
MySQL Backup/Recovery
MySQL Backup/RecoveryMySQL Backup/Recovery
MySQL Backup/Recovery
 
MySQL Beispiele aus der Praxis - Wie setzen Kunden MySQL ein?
MySQL Beispiele aus der Praxis - Wie setzen Kunden MySQL ein?MySQL Beispiele aus der Praxis - Wie setzen Kunden MySQL ein?
MySQL Beispiele aus der Praxis - Wie setzen Kunden MySQL ein?
 
MySQL-Server im Teamwork - Replikation und Cluster
MySQL-Server im Teamwork - Replikation und ClusterMySQL-Server im Teamwork - Replikation und Cluster
MySQL-Server im Teamwork - Replikation und Cluster
 
Der Datenbank-Backup ist gemacht - was nun?
Der Datenbank-Backup ist gemacht - was nun?Der Datenbank-Backup ist gemacht - was nun?
Der Datenbank-Backup ist gemacht - was nun?
 
Weltweite Produktionsdatenverwaltung mit MySQL-Replikation
Weltweite Produktionsdatenverwaltung mit MySQL-ReplikationWeltweite Produktionsdatenverwaltung mit MySQL-Replikation
Weltweite Produktionsdatenverwaltung mit MySQL-Replikation
 
MySQL Performance Tuning für Oracle-DBA's
MySQL Performance Tuning für Oracle-DBA'sMySQL Performance Tuning für Oracle-DBA's
MySQL Performance Tuning für Oracle-DBA's
 
MySQL Security SLAC 2015
MySQL Security SLAC 2015MySQL Security SLAC 2015
MySQL Security SLAC 2015
 
MySQL Performance Tuning für Entwickler
MySQL Performance Tuning für EntwicklerMySQL Performance Tuning für Entwickler
MySQL Performance Tuning für Entwickler
 
MySQL Replikation - Die Eier legende Wollmilchsau?
MySQL Replikation - Die Eier legende Wollmilchsau?MySQL Replikation - Die Eier legende Wollmilchsau?
MySQL Replikation - Die Eier legende Wollmilchsau?
 
Reading MySQL fingerprints
Reading MySQL fingerprintsReading MySQL fingerprints
Reading MySQL fingerprints
 
MySQL Indexierung CeBIT 2014
MySQL Indexierung CeBIT 2014MySQL Indexierung CeBIT 2014
MySQL Indexierung CeBIT 2014
 
MySQL Cluster with Galera Cluster for MySQL
MySQL Cluster with Galera Cluster for MySQLMySQL Cluster with Galera Cluster for MySQL
MySQL Cluster with Galera Cluster for MySQL
 
MySQL Backup
MySQL BackupMySQL Backup
MySQL Backup
 
Need for Speed: Mysql indexing
Need for Speed: Mysql indexingNeed for Speed: Mysql indexing
Need for Speed: Mysql indexing
 
MySQL HA and Security
MySQL HA and SecurityMySQL HA and Security
MySQL HA and Security
 
MySQL High Availability Solutions
MySQL High Availability SolutionsMySQL High Availability Solutions
MySQL High Availability Solutions
 

Recently uploaded

Event 4 Introduction to Open Source.pptx
Event 4 Introduction to Open Source.pptxEvent 4 Introduction to Open Source.pptx
Event 4 Introduction to Open Source.pptxaryanv1753
 
Dutch Power - 26 maart 2024 - Henk Kras - Circular Plastics
Dutch Power - 26 maart 2024 - Henk Kras - Circular PlasticsDutch Power - 26 maart 2024 - Henk Kras - Circular Plastics
Dutch Power - 26 maart 2024 - Henk Kras - Circular PlasticsDutch Power
 
THE COUNTRY WHO SOLVED THE WORLD_HOW CHINA LAUNCHED THE CIVILIZATION REVOLUTI...
THE COUNTRY WHO SOLVED THE WORLD_HOW CHINA LAUNCHED THE CIVILIZATION REVOLUTI...THE COUNTRY WHO SOLVED THE WORLD_HOW CHINA LAUNCHED THE CIVILIZATION REVOLUTI...
THE COUNTRY WHO SOLVED THE WORLD_HOW CHINA LAUNCHED THE CIVILIZATION REVOLUTI...漢銘 謝
 
SaaStr Workshop Wednesday w/ Kyle Norton, Owner.com
SaaStr Workshop Wednesday w/ Kyle Norton, Owner.comSaaStr Workshop Wednesday w/ Kyle Norton, Owner.com
SaaStr Workshop Wednesday w/ Kyle Norton, Owner.comsaastr
 
SBFT Tool Competition 2024 -- Python Test Case Generation Track
SBFT Tool Competition 2024 -- Python Test Case Generation TrackSBFT Tool Competition 2024 -- Python Test Case Generation Track
SBFT Tool Competition 2024 -- Python Test Case Generation TrackSebastiano Panichella
 
miladyskindiseases-200705210221 2.!!pptx
miladyskindiseases-200705210221 2.!!pptxmiladyskindiseases-200705210221 2.!!pptx
miladyskindiseases-200705210221 2.!!pptxCarrieButtitta
 
Genshin Impact PPT Template by EaTemp.pptx
Genshin Impact PPT Template by EaTemp.pptxGenshin Impact PPT Template by EaTemp.pptx
Genshin Impact PPT Template by EaTemp.pptxJohnree4
 
Work Remotely with Confluence ACE 2.pptx
Work Remotely with Confluence ACE 2.pptxWork Remotely with Confluence ACE 2.pptx
Work Remotely with Confluence ACE 2.pptxmavinoikein
 
PAG-UNLAD NG EKONOMIYA na dapat isaalang alang sa pag-aaral.
PAG-UNLAD NG EKONOMIYA na dapat isaalang alang sa pag-aaral.PAG-UNLAD NG EKONOMIYA na dapat isaalang alang sa pag-aaral.
PAG-UNLAD NG EKONOMIYA na dapat isaalang alang sa pag-aaral.KathleenAnnCordero2
 
Simulation-based Testing of Unmanned Aerial Vehicles with Aerialist
Simulation-based Testing of Unmanned Aerial Vehicles with AerialistSimulation-based Testing of Unmanned Aerial Vehicles with Aerialist
Simulation-based Testing of Unmanned Aerial Vehicles with AerialistSebastiano Panichella
 
The Ten Facts About People With Autism Presentation
The Ten Facts About People With Autism PresentationThe Ten Facts About People With Autism Presentation
The Ten Facts About People With Autism PresentationNathan Young
 
Call Girls In Aerocity 🤳 Call Us +919599264170
Call Girls In Aerocity 🤳 Call Us +919599264170Call Girls In Aerocity 🤳 Call Us +919599264170
Call Girls In Aerocity 🤳 Call Us +919599264170Escort Service
 
Gaps, Issues and Challenges in the Implementation of Mother Tongue Based-Mult...
Gaps, Issues and Challenges in the Implementation of Mother Tongue Based-Mult...Gaps, Issues and Challenges in the Implementation of Mother Tongue Based-Mult...
Gaps, Issues and Challenges in the Implementation of Mother Tongue Based-Mult...marjmae69
 
call girls in delhi malviya nagar @9811711561@
call girls in delhi malviya nagar @9811711561@call girls in delhi malviya nagar @9811711561@
call girls in delhi malviya nagar @9811711561@vikas rana
 
PHYSICS PROJECT BY MSC - NANOTECHNOLOGY
PHYSICS PROJECT BY MSC  - NANOTECHNOLOGYPHYSICS PROJECT BY MSC  - NANOTECHNOLOGY
PHYSICS PROJECT BY MSC - NANOTECHNOLOGYpruthirajnayak525
 
Call Girls in Rohini Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Rohini Delhi 💯Call Us 🔝8264348440🔝Call Girls in Rohini Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Rohini Delhi 💯Call Us 🔝8264348440🔝soniya singh
 
Genesis part 2 Isaiah Scudder 04-24-2024.pptx
Genesis part 2 Isaiah Scudder 04-24-2024.pptxGenesis part 2 Isaiah Scudder 04-24-2024.pptx
Genesis part 2 Isaiah Scudder 04-24-2024.pptxFamilyWorshipCenterD
 
James Joyce, Dubliners and Ulysses.ppt !
James Joyce, Dubliners and Ulysses.ppt !James Joyce, Dubliners and Ulysses.ppt !
James Joyce, Dubliners and Ulysses.ppt !risocarla2016
 
Mathan flower ppt.pptx slide orchids ✨🌸
Mathan flower ppt.pptx slide orchids ✨🌸Mathan flower ppt.pptx slide orchids ✨🌸
Mathan flower ppt.pptx slide orchids ✨🌸mathanramanathan2005
 
Presentation for the Strategic Dialogue on the Future of Agriculture, Brussel...
Presentation for the Strategic Dialogue on the Future of Agriculture, Brussel...Presentation for the Strategic Dialogue on the Future of Agriculture, Brussel...
Presentation for the Strategic Dialogue on the Future of Agriculture, Brussel...Krijn Poppe
 

Recently uploaded (20)

Event 4 Introduction to Open Source.pptx
Event 4 Introduction to Open Source.pptxEvent 4 Introduction to Open Source.pptx
Event 4 Introduction to Open Source.pptx
 
Dutch Power - 26 maart 2024 - Henk Kras - Circular Plastics
Dutch Power - 26 maart 2024 - Henk Kras - Circular PlasticsDutch Power - 26 maart 2024 - Henk Kras - Circular Plastics
Dutch Power - 26 maart 2024 - Henk Kras - Circular Plastics
 
THE COUNTRY WHO SOLVED THE WORLD_HOW CHINA LAUNCHED THE CIVILIZATION REVOLUTI...
THE COUNTRY WHO SOLVED THE WORLD_HOW CHINA LAUNCHED THE CIVILIZATION REVOLUTI...THE COUNTRY WHO SOLVED THE WORLD_HOW CHINA LAUNCHED THE CIVILIZATION REVOLUTI...
THE COUNTRY WHO SOLVED THE WORLD_HOW CHINA LAUNCHED THE CIVILIZATION REVOLUTI...
 
SaaStr Workshop Wednesday w/ Kyle Norton, Owner.com
SaaStr Workshop Wednesday w/ Kyle Norton, Owner.comSaaStr Workshop Wednesday w/ Kyle Norton, Owner.com
SaaStr Workshop Wednesday w/ Kyle Norton, Owner.com
 
SBFT Tool Competition 2024 -- Python Test Case Generation Track
SBFT Tool Competition 2024 -- Python Test Case Generation TrackSBFT Tool Competition 2024 -- Python Test Case Generation Track
SBFT Tool Competition 2024 -- Python Test Case Generation Track
 
miladyskindiseases-200705210221 2.!!pptx
miladyskindiseases-200705210221 2.!!pptxmiladyskindiseases-200705210221 2.!!pptx
miladyskindiseases-200705210221 2.!!pptx
 
Genshin Impact PPT Template by EaTemp.pptx
Genshin Impact PPT Template by EaTemp.pptxGenshin Impact PPT Template by EaTemp.pptx
Genshin Impact PPT Template by EaTemp.pptx
 
Work Remotely with Confluence ACE 2.pptx
Work Remotely with Confluence ACE 2.pptxWork Remotely with Confluence ACE 2.pptx
Work Remotely with Confluence ACE 2.pptx
 
PAG-UNLAD NG EKONOMIYA na dapat isaalang alang sa pag-aaral.
PAG-UNLAD NG EKONOMIYA na dapat isaalang alang sa pag-aaral.PAG-UNLAD NG EKONOMIYA na dapat isaalang alang sa pag-aaral.
PAG-UNLAD NG EKONOMIYA na dapat isaalang alang sa pag-aaral.
 
Simulation-based Testing of Unmanned Aerial Vehicles with Aerialist
Simulation-based Testing of Unmanned Aerial Vehicles with AerialistSimulation-based Testing of Unmanned Aerial Vehicles with Aerialist
Simulation-based Testing of Unmanned Aerial Vehicles with Aerialist
 
The Ten Facts About People With Autism Presentation
The Ten Facts About People With Autism PresentationThe Ten Facts About People With Autism Presentation
The Ten Facts About People With Autism Presentation
 
Call Girls In Aerocity 🤳 Call Us +919599264170
Call Girls In Aerocity 🤳 Call Us +919599264170Call Girls In Aerocity 🤳 Call Us +919599264170
Call Girls In Aerocity 🤳 Call Us +919599264170
 
Gaps, Issues and Challenges in the Implementation of Mother Tongue Based-Mult...
Gaps, Issues and Challenges in the Implementation of Mother Tongue Based-Mult...Gaps, Issues and Challenges in the Implementation of Mother Tongue Based-Mult...
Gaps, Issues and Challenges in the Implementation of Mother Tongue Based-Mult...
 
call girls in delhi malviya nagar @9811711561@
call girls in delhi malviya nagar @9811711561@call girls in delhi malviya nagar @9811711561@
call girls in delhi malviya nagar @9811711561@
 
PHYSICS PROJECT BY MSC - NANOTECHNOLOGY
PHYSICS PROJECT BY MSC  - NANOTECHNOLOGYPHYSICS PROJECT BY MSC  - NANOTECHNOLOGY
PHYSICS PROJECT BY MSC - NANOTECHNOLOGY
 
Call Girls in Rohini Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Rohini Delhi 💯Call Us 🔝8264348440🔝Call Girls in Rohini Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Rohini Delhi 💯Call Us 🔝8264348440🔝
 
Genesis part 2 Isaiah Scudder 04-24-2024.pptx
Genesis part 2 Isaiah Scudder 04-24-2024.pptxGenesis part 2 Isaiah Scudder 04-24-2024.pptx
Genesis part 2 Isaiah Scudder 04-24-2024.pptx
 
James Joyce, Dubliners and Ulysses.ppt !
James Joyce, Dubliners and Ulysses.ppt !James Joyce, Dubliners and Ulysses.ppt !
James Joyce, Dubliners and Ulysses.ppt !
 
Mathan flower ppt.pptx slide orchids ✨🌸
Mathan flower ppt.pptx slide orchids ✨🌸Mathan flower ppt.pptx slide orchids ✨🌸
Mathan flower ppt.pptx slide orchids ✨🌸
 
Presentation for the Strategic Dialogue on the Future of Agriculture, Brussel...
Presentation for the Strategic Dialogue on the Future of Agriculture, Brussel...Presentation for the Strategic Dialogue on the Future of Agriculture, Brussel...
Presentation for the Strategic Dialogue on the Future of Agriculture, Brussel...
 

MariaDB / MySQL tripping hazard and how to get out again?

  • 1. www.fromdual.com 1 / 31 MariaDB / MySQL Stolperfallen und wie komme ich da wieder raus? GNU / LinuxDay im Vorarlberg 2020, Dornbirn (Austria) Oli Sennhauser Senior MariaDB und MySQL Berater, FromDual GmbH https://www.fromdual.com/presentations
  • 2. www.fromdual.com 2 / 31 Über FromDual GmbH Support remote-DBA Schulung Beratung
  • 3. www.fromdual.com 3 / 31 Inhalt Stolperfallen ➢ All – Admins und Entwickler ➢ Dev – Entwickler ➢ Adm – Admins
  • 4. www.fromdual.com 4 / 31 All: MySQL ≠ MariaDB ! ● Up to version 5.5: ~100% "drop-in-replacement" (2010 – 2015) ● Version 10.0 – 10.2 / 5.6 – 5.7: only "compatible" (2013 – 2017) ● Since version 10.3 / 8.0: "different" RDBMS (but still similar) (since 2018) ● MariaDB vs. MySQL ≈ Percona Server (99.99% compatible) ● Imitations ● Amazon Aurora – MySQL (RDS) – "fully compatible" ● "TiDB is fully compatible with the MySQL 5.7 protocol and the common features and syntax of MySQL 5.7" ● TDSQL (Tencent) – "Compatible with syntax elements and access API" ● Strategy ● Is the application "certified" against my fork? ● Decision: Support both or only one fork (which one???)? ● Very good testing!
  • 5. www.fromdual.com 5 / 31 Consequences in code: // MySQL/Percona 5.7 ff. if ( (($aInstanceInfo['branch'] == 'MySQL') || ($aInstanceInfo['branch'] == 'Percona') ) && ($aInstanceInfo['mr_version'] >= '050700') ) { // MySQL 5.7.0 - 5.7.99 if ( ($aInstanceInfo['mr_version'] >= '050700') && ($aInstanceInfo['mr_version'] <= '050799')) { ... } // MySQL 8.0 DOES support this feature but has different tables! elseif ( ($aInstanceInfo['mr_version'] >= '080000') ) { ... } } // MySQL + Percona 5.7 ff. // MariaDB and MySQL 5.6 and older else { // MariaDB 10.5 and newer if ( $aInstanceInfo['mr_version'] >= '100500') { ... } else { ... } } // MariaDB
  • 6. www.fromdual.com 6 / 31 All: KISS ● "Keep It Stupid Simple" ● Design principle by the U.S. Navy, 1960 and others (Wikipedia) ● "Most systems work best if they are kept simple rather than made complicated" ● Complicated solutions will break sooner or later! ● Caution: Software vendors, IT consultants and paper tigers have opposite goals! ● Strategy: ● Try to make/keep it simple. Where and why do errors happen? ● Simplicity should be a key goal in design and unnecessary complexity should be avoided ● Reflect the requirements! Can we reduce or adapt the requirements? ● Take your time to make a sketch (map) to get an overview!
  • 8. www.fromdual.com 8 / 31 Dev: MyISAM table locking ● MyISAM was default until about 2013! ● Old and legacy ● "Never change a running system" :-( ● Problem wit MyISAM: ● NOT crash-safe!!! → Possibility of corrupt data! ● Table level locks! → Does NOT scale! ● No transactions... (business problem not DB) ● Non obvious: Also reads are affected ● Symptoms: PROCESSLIST: ● "Waiting for table level lock" ● Strategy: ● Think about migrating to InnoDB.
  • 9. www.fromdual.com 9 / 31 MyISAM table locking Time State Info 6 Sending data select UserIndex, LastUsedShopLanguage from webshop_user2 wh 6 Waiting for table level lock update webshop_user2 set DataChange=1, LastDataChange=NOW() 6 Waiting for table level lock select UserIndex from webshop_user2 where UserIndex=317249 a 5 Waiting for table level lock update webshop_user2 set DataChange=1, LastDataChange=NOW() 5 Waiting for table level lock select UserIndex from webshop_user2 where UserIndex=1631890 5 Waiting for table level lock select UserIndex from webshop_user2 where UserIndex=695182 a 5 Waiting for table level lock select UserIndex from webshop_user2 where UserIndex=1583223 5 Waiting for table level lock select UserIndex from webshop_user2 where UserIndex=969880 a 5 Waiting for table level lock select Password, UserIndex, SubShop, MainSubShop, State, Adv 3 Waiting for table level lock select Password, UserIndex, SubShop, MainSubShop, State, Adv 3 Waiting for table level lock select UserIndex from webshop_user2 where UserIndex=1661429 3 Waiting for table level lock select UserIndex from webshop_user2 where UserIndex=654008 a 2 Waiting for table level lock select UserIndex from webshop_user2 where UserIndex=795808 a 2 Waiting for table level lock select UserIndex from webshop_user2 where UserIndex=1654024 2 Waiting for table level lock select Password, UserIndex, SubShop, MainSubShop, State, Adv 2 Waiting for table level lock select UNIX_TIMESTAMP(LastDataImport) from webshop_user2 whe
  • 10. www.fromdual.com 10 / 31 Adm: Big ibdata1 ● ibdata1 is called the System Tablespace ● Today it contains only "system" data ● Earlier it also contained "user" data ● Controlled by innodb_file_per_table = {on | off} ● Default to on since MariaDB / MySQL 5.5 ● So no more user data in there...? ● Why ibdata1 can still grow / is still big? ● Historical user data??? ● Long (read) and/or big (write) transactions → many UNDO log segments (ROLLBACK) ● Big InnoDB Temporary Tables ● Strategy: ● Small transactions (anyway a good idea from DB point of view!) ● UNDO Tablespaces (10.0 / 5.6) ● InnoDB Temporary Tablespaces (10.2 / 5.7) ● System Tablespace NEVER shrinks!!! ● Otherwise only: dump / restore (TTS is too complicated!?!)
  • 11. www.fromdual.com 11 / 31 All: Noisy Neighbours ● Problem: ● Shared and consolidated resources (SAN, network, VM, Container, many connections, ...) ● "Others" use "our!" resources ● → "We" become slow or even get outages... ● Examples: ● Backup times deviate ● Cloud ping times go suddenly up ● Unforeseen outages/freezes ● I/O becomes slow ● Strategy: ● Do NOT share (egoistic). ● Monitor well! ● Know the "big picture"! ● Consider, that you are not alone. Image by Free-Photos on Pixabay
  • 12. www.fromdual.com 12 / 31 All: Noisy Neighbours
  • 13. www.fromdual.com 13 / 31 Dev: No BLOBs in a RDBMS ● One big red database vendor claimed: ● "You can store now videos in the database!" ● I also found it cool once... :-( ● Problem: ● Query latency higher and ● Database throughput lower ● Backup size and time will increase ● DDL operations will take ages ● Buffer Pool (cache) is flooded ● Strategy: ● Do NOT store BLOBs in the RDBMS but on a filer (Disk, NAS, SAN). They are made for this task.
  • 14. www.fromdual.com 14 / 31 Adm: Disk full! ● Disk full is more or less the worst you can do to your database! ● DB will stuck ● Worst case you get corruptions ● Difficult to make it work again because of lack of free disk space ● I/O systems become slower if they are filled more than 90% (SAN, SSD, ...) ● How to find who is the evil? ● df -h; du -hsc; ls -lSr ● Who is the evil: ● Mostly Binary Logs (or Relay Logs) ● Temporary Tables (/tmp?) ● DB files (*.ibd) ● Other Logs (error, slow, general → FLUSH LOGS after rm!) ● ibdata1 not so common any more nowadays ● Strategy: ● Monitor your disk space! ● Try to predict how long it will take until disk is full.
  • 15. www.fromdual.com 15 / 31 Dev: Locking ● Locking is caused by the application and is NOT a database problem!!! ● So search there and not in the database. ● Your DBA can help you finding your problem... ● Different type of locks: ● Explicit locks (LOCK TABLE...) ● MyISAM Table Level Locks (write AND read!) ● Metadata Locks (DDL vs. DML + SELECT) ● InnoDB Row Level Locks (and special case: Deadlock) ● Galera Cluster Lock (DDL with TOI (default)) ● Galera Cluster Conflict (looks like a deadlock but is not). ● Strategy: ● Learn more about locking ● Avoid: LOCK TABLE and MyISAM ● Be careful with DDL operations ● Do fast and small DML operations (smaller chunks and Query Tuning)
  • 16. www.fromdual.com 16 / 31 Adm: "Crash" ● There is an inflationary use of the term "Crash"! ● What we have seen declared as a crash: ● Lost connection ● Killed connection (connection_timeout) ● Stalled system caused by Locks (MyISAM, Query Cache) ● Refused connections ● Properly shutdown database (see error log) ● Killed DB server (Oom Killer) → can be considered as a crash (syslog) ● You hit a Bug with Stacktrace → this is a real crash! (see error log) ● Strategy: ● Find the real cause of the symptom ● Check MariaDB / MySQL error log (stop sequence, start sequence, stack) ● Check syslog (Oom killer: Who eats all your memory?) ● Possibly InnoDB Buffer Pool or max_connections are too big! ● Or you hit a bug.
  • 17. www.fromdual.com 17 / 31 Adm: Oom and Restart Syslog: ... Out of memory: Kill process 1904 (mysqld) score 39 or sacrifice child Killed process 1904 (mysqld) total-vm:2855024kB, anon-rss:449640kB, file-rss:0kB ... NO Shutdown sequence in MariaDB / MySQL error log (kill -9) MariaDB / MySQL error log: [Note] bin/mysqld (initiated by: unknown): Normal shutdown ... [Note] bin/mysqld: Shutdown complete -- Version: '10.0.19-MariaDB' socket: '/var/lib/mysql/mysql.sock' port: 3306 MariaDB Server /usr/sbin/mysqld (mysqld 10.0.19-MariaDB) starting as process 4469 ... ... [Note] Server socket created on IP: '::'. [Note] bin/mysqld: ready for connections.
  • 18. www.fromdual.com 18 / 31 Real Crash with Stacktrace 111208 14:35:05 [ERROR] mysqld got signal 11 ; This could be because you hit a bug. It is also possible that this binary or one of the libraries it was linked against is corrupt, improperly built, or misconfigured. This error can also be caused by malfunctioning hardware. We will try our best to scrape up some info that will hopefully help diagnose the problem, but since we have already crashed, something is definitely wrong and this may fail. ... Thread pointer: 0x0 Attempting backtrace. You can use the following information to find out where mysqld died. If you see no messages after this, something went terribly wrong... stack_bottom = (nil) thread_stack 0x48000 ./bin/mysqld(my_print_stacktrace+0x2e) [0xa1195e] ./bin/mysqld(handle_segfault+0x3f6) [0x6340a6] /lib64/libpthread.so.0 [0x3248e0eb10] ./bin/mysqld(ma_checkpoint_execute+0x42d) [0x83bead] ./bin/mysqld(ma_checkpoint_background+0x23f) [0x83c9af] /lib64/libpthread.so.0 [0x3248e0673d] /lib64/libc.so.6(clone+0x6d) [0x32482d40cd]
  • 19. www.fromdual.com 19 / 31 All: Tables w/o PK ● Tables without a Primary Key are ● Bad design in a relational model ● Possibly worse latency and throughput ● Causes Slave lagging on UPDATE and DELETE ● Prevents use of Galera Cluster/InnoDB Cluster! ● Strategy: ● Create always Primary Keys on every MariaDB / MySQL table (also in DWH / Star Model!) ● AUTO_INCREMENT can be used
  • 20. www.fromdual.com 20 / 31 Dev: Server has gone away! ● I was very frightened the first time! ● Better: "Connection was terminated!" ● Symptom: Connection from client to server was terminated. ● Cause: ● Connection was killed (by admin?) ● Retrieved too big results (max_allowed_packet) ● Server was stopped, killed or crashed ● Strategy: ● 1. Check if admin has killed your connection (because it harmed the database) ● 2. Check Error Log for Start/Stop or Crash messages ● 3. Try to reproduce and possibly increase max_allowed_packet (typically BLOB or TEXT) Image by FreePhotosART on Pixabay
  • 21. www.fromdual.com 21 / 31 Adm: NUMA ● Problem: Big machines: more than 1 CPU/socket ● Heavy swapping! ● Swappiness does NOT help! ● You must tell the O/S how to behave: ● Strategy: ● Avoid such big machines! You mostly do not need them! ● innodb_numa_interleave = ON ● But: Not in all packages for all distributions for all versions available! :-( Stolen from: blog.sqlauthority.com
  • 22. www.fromdual.com 22 / 31 All: Slave Lag ● Causes: ● Long running Query (DML or DDL) ● Missing Primary Key (UPDATE, DELETE) → Long running Query ● Weaker Slave than master (RAM, I/O, ...)? ● Strategy: ● Do smaller transactions (not possible with DDL) ● Upgrade MariaDB/MySQL: DDL are online or instantaneous ● Add Primary Keys on ALL Tables ● Configure Slave correctly and buy adequate hardware ● Release hand break: innodb_flush_log_at_trx_commit = 2 / sync_binlog = 0 ● Last alternative: Parallel Replication (since MariaDB 10.0 and MySQL 5.6) SQL> SHOW SLAVE STATUSG *************************** 1. row *************************** ... Slave_IO_Running: Yes Slave_SQL_Running: Yes ... Seconds_Behind_Master: 999
  • 24. www.fromdual.com 24 / 31 Dev: Sending data ● Also interesting for Admins to find the evil! ● "Sending data" is NOT "Writing to net" ● Strategies: ● → Appropriate DB Cache configuration (InnoDB Buffer Pool) Disk I/O? ● → Query Tuning ● → Change design or architecture ● → Or live with it (SISO principle) SQL> SHOW PROCESSLIST; +--------+------+-----------+------+------+--------------+------------------------------+ | Id | User | Host | db | Time | State | Info | +--------+------+-----------+------+------+--------------+------------------------------+ | 577558 | app | 10.0.0.4 | test | 42 | Sending data | SELECT * FROM very_big_table | +--------+------+-----------+------+------+--------------+------------------------------+
  • 25. www.fromdual.com 25 / 31 Sending data SQL-Layer Handler Interface InnoDB MyISAM Aria Memory Storage Engine Layer Sending data  read_buffer  join_buffer  tmp_table  read_rnd_buffer read_buffer  sort_buffer Threads Application Writing data to net 3306
  • 26. www.fromdual.com 26 / 31 All: Too many connections ● You reached the database limit: ● max_connections ● max_user_connections ● Per Account MAX_USER_CONNECTIONS ● This is a fuse to protect your database! ● Cause: Locks, Long running queries, etc. ● Strategy: ● Find the reason why you reached the limit! ● Good starting point: SHOW PROCESSLIST; Image by Robert Allmann on Pixabay
  • 27. www.fromdual.com 27 / 31 All: How many connections? DB max_connections = 151 Web-Server ServerLimit (16) x ThreadsPerChild (25) = 400 threads n x Java + c3p0 maxPoolSize = 15 x m 15 x m + 400 x n + others = max_connections highly busy: 2 – 6 conn/core busy system: 10 conn/core idle system: many conn/core
  • 28. www.fromdual.com 28 / 31 Dev: Simple Query Tuning ● Most seen simple errors beside missing indices: ● WHERE col LIKE '%...%'; ● % on the left: Index cannot be taken! ● Avoid, change business rule or use Solr ● WHERE UNIX_TIMESTAMP(Date) < 12454232423; ● Function covered column: Index cannot be taken! ● rewrite Query: Date < FROM_UNIXTIME(1245...) ● WHERE LOWER(email) = LOWER('contact@fromdual.com) ● MariaDB/MySQL are case INsensitive! ● Same problem as above but possibly not solvable ● Use indexed GENERATED PERSISTENT column! ● INDEX (a, b, c) ; WHERE b = 5 AND c = 2; ● a filter is missing in the Query ● Either add a filter to the query or create index on (b,c)
  • 29. www.fromdual.com 29 / 31 All: Galera ● Galera is cool but NOT the solution for all problems!!! ● Galera IS MariaDB / MySQL BUT behaves slightly different... ● Problems: ● Stable Infrastructure (HW, NW, VM) ● Operations not simple, needs drill! ● Application must support Galera behaviour ● → See Galera Limitations @FromDual.com ● Strategy: ● Understand the technology!!! ● Test application well ● Drill your ops team, also for the bad weather scenarios.
  • 30. www.fromdual.com 30 / 31 All: Progress bar ● We rarely have one on CLI (MariaDB tries a bit) ● But how can we though see progress? ● Disk filling / file growing: ● watch is your friend! ● df -h, ls -la, du -hsc ● Progress on file operations: ● Many files: ls -la /proc/<PID>/fd/* ● Big file: watch -n 1 'cat /proc/<PID>/fdinfo/<FD>' ● Database: ● INSERT: AUTO_INCREMENT counter or SELECT MAX(id) or SELECT COUNT(*) ● Size of file (*.ibd) ● SHOW PROCESSLIST → Progress (MariaDB only) ● SHOW GLOBAL STATUS LIKE 'Innodb_rows%ed'; ● INFORMATION_SCHEMA.USER_STATISTICS ● PERFORMANCE_SCHEMA.status_by_thread
  • 31. www.fromdual.com 31 / 31 Q & A Fragen ? Diskussion? Wir haben Zeit für ein persönliches Gespräch... ● FromDual bietet neutral und unabhängig: ● Beratung ● Remote-DBA ● Support für MariaDB, MySQL und Galera Cluster ● Schulung www.fromdual.com/presentations