Tips & Tricks on Tuning MySQL Performance

Similar documents
The MySQL Query Cache

LAMP Tuning. Sean Walberg Network guy, server ninja

MySQL Performance Tuning 101

Performance improvements in MySQL 5.5

Analysis of Derby Performance

Improvements in MySQL 5.5 and 5.6. Peter Zaitsev Percona Live NYC May 26,2011

Monday, September 15, 14

InnoDB Scalability Limits. Peter Zaitsev, Vadim Tkachenko Percona Inc MySQL Users Conference 2008 April 14-17, 2008

What's new in MySQL 5.5? Performance/Scale Unleashed

Preventing and Resolving MySQL Downtime. Jervin Real, Michael Coburn Percona

MySQL Performance Optimization and Troubleshooting with PMM. Peter Zaitsev, CEO, Percona

How to Fulfill the Potential of InnoDB's Performance and Scalability

Mysql Cluster Could Not Acquire Global Schema Lock

PolarDB. Cloud Native Alibaba. Lixun Peng Inaam Rana Alibaba Cloud Team

Resolving and Preventing MySQL Downtime

MySQL Architecture and Components Guide

XtraDB 5.7: Key Performance Algorithms. Laurynas Biveinis Alexey Stroganov Percona

Pgpool-II Development Status Updates. Pgpool-II Global Development Group

The Google File System

Manual Trigger Sql Server 2008 Examples Insert Update

MySQL Performance Optimization and Troubleshooting with PMM. Peter Zaitsev, CEO, Percona Percona Technical Webinars 9 May 2018

Delegates must have a working knowledge of MariaDB or MySQL Database Administration.

InnoDB: Status, Architecture, and Latest Enhancements

Recoverability. Kathleen Durant PhD CS3200

Lecture 21: Virtual Memory. Spring 2018 Jason Tang

RocksDB Key-Value Store Optimized For Flash

MySQL Performance Improvements

ITS. MySQL for Database Administrators (40 Hours) (Exam code 1z0-883) (OCP My SQL DBA)

MySQL Performance Tuning

Best Practices. Deploying Optim Performance Manager in large scale environments. IBM Optim Performance Manager Extended Edition V4.1.0.

Switching to Innodb from MyISAM. Matt Yonkovit Percona

MySQL High Availability. Michael Messina Senior Managing Consultant, Rolta-AdvizeX /

Scale out Read Only Workload by sharing data files of InnoDB. Zhai weixiang Alibaba Cloud

EI 338: Computer Systems Engineering (Operating Systems & Computer Architecture)

DAT (cont d) Assume a page size of 256 bytes. physical addresses. Note: Virtual address (page #) is not stored, but is used as an index into the table

MongoDB for a High Volume Logistics Application. Santa Clara, California April 23th 25th, 2018

Concurrency Control Goals

CS3600 SYSTEMS AND NETWORKS

Tuesday, April 6, Inside SQL Server

MySQL for Database Administrators Ed 3.1

itexamdump 최고이자최신인 IT 인증시험덤프 일년무료업데이트서비스제공

Transactions and Recovery Study Question Solutions

1. Creates the illusion of an address space much larger than the physical memory

Outline. Failure Types

MySQL Database Administrator Training NIIT, Gurgaon India 31 August-10 September 2015

An overview of Drupal infrastructure and plans for future growth. prepared by Kieran Lal for the Drupal Association

Building High Performance Apps using NoSQL. Swami Sivasubramanian General Manager, AWS NoSQL

VERITAS Database Edition for Sybase. Technical White Paper

Operating System Concepts

GFS Overview. Design goals/priorities Design for big-data workloads Huge files, mostly appends, concurrency, huge bandwidth Design for failures

InnoDB: What s new in 8.0

Distributed Systems. Lec 10: Distributed File Systems GFS. Slide acks: Sanjay Ghemawat, Howard Gobioff, and Shun-Tak Leung

Modeling Page Replacement: Stack Algorithms. Design Issues for Paging Systems

MySQL Performance Tuning

System Characteristics

How To Rock with MyRocks. Vadim Tkachenko CTO, Percona Webinar, Jan

Here, we consider Database bottleneck as a problem and provide solution for some of common problems.

Chapter 20: Database System Architectures

Load Testing Tools. for Troubleshooting MySQL Concurrency Issues. May, 23, 2018 Sveta Smirnova

mysql Certified MySQL 5.0 DBA Part I

Software troubleshooting

<Insert Picture Here> MySQL Cluster What are we working on

pgmemcache and the over reliance on RDBMSs Copyright (c) 2004 Sean Chittenden. All rights reserved.

Operating System - Virtual Memory

MySQL Replication Update

MySQL 5.6: Advantages in a Nutshell. Peter Zaitsev, CEO, Percona Percona Technical Webinars March 6, 2013

InnoDB: What s new in 8.0

Innodb Architecture and Performance Optimization. Peter Zaitsev, CEO Percona 25 September 2017

DHANALAKSHMI COLLEGE OF ENGINEERING, CHENNAI

The Oracle DBMS Architecture: A Technical Introduction

Error code. Description of the circumstances under which the problem occurred. Less than 200. Linux system call error.

Mining for insight. Osma Ahvenlampi, CTO, Sulake Implementing business intelligence for Habbo

Chapter 18: Database System Architectures.! Centralized Systems! Client--Server Systems! Parallel Systems! Distributed Systems!

Memory Management and Memory Structures

Chapter 11: Implementing File Systems

CLOUD-SCALE FILE SYSTEMS

MySQL Performance Tuning 101

The unglamorous database option that works

Oracle Architectural Components

Common DB2 Customer Issues. As seen by DB2-LUW support

) Intel)(TX)memory):) Transac'onal) Synchroniza'on) Extensions)(TSX))) Transac'ons)

Readings and References. Virtual Memory. Virtual Memory. Virtual Memory VPN. Reading. CSE Computer Systems December 5, 2001.

What s new in Percona Xtradb Cluster 5.6. Jay Janssen Lead Consultant February 5th, 2014

Panu Silvasti Page 1

Migrating To MySQL The Live Database Upgrade Guide

NoVA MySQL October Meetup. Tim Callaghan VP/Engineering, Tokutek

Aurora, RDS, or On-Prem, Which is right for you

Chapter 10: File System Implementation

Choosing a MySQL HA Solution Today

Side Load Feature Nasuni Corporation Boston, MA

How to setup Orchestrator to manage thousands of MySQL servers. Simon J Mudd 3 rd October 2017

CSE 530A ACID. Washington University Fall 2013

Bipul Sinha, Amit Ganesh, Lilian Hobbs, Oracle Corp. Dingbo Zhou, Basavaraj Hubli, Manohar Malayanur, Fannie Mae

Database Management System

DHCP Capacity and Performance Guidelines

<Insert Picture Here> Looking at Performance - What s new in MySQL Workbench 6.2

What's New in MySQL 5.7?

OPERATING SYSTEMS II DPL. ING. CIPRIAN PUNGILĂ, PHD.

Lock Tuning. Concurrency Control Goals. Trade-off between correctness and performance. Correctness goals. Performance goals.

FlashCache. Mohan Srinivasan Mark Callaghan July 2010

Transcription:

Tips & Tricks on Tuning MySQL Performance Shlomi Noach Interbit T & C Java Tech Day Israel, June 2009 1

Performance tuning One of the last things to tune. Data types, Schema structure, Queries: usually have more impact. However... 2

Sometimes you're on the edge You may be suffering high spikes of usage You may be scaling faster than you thought You need to minimize downtime 3

InnoDB transaction logs Transactions are written both to buffer pool and to transaction logs. Buffer pool is not flushed on transaction commit. Transaction logs Buffer pool 4

InnoDB transaction logs The smaller the transaction log, the more frequently page flush must occur on the buffer pool. The smaller the transaction log, the more random I/O operations occur. The larger the transaction log, the more data it contains, alleviating the need to flush the pool. The larger the transaction log, the more serial I/O operations occur. 5

Large transaction logs have downsides The larger the transaction log, the longer it will take for crash recovery. Very large transaction logs (hundreds of MB up to few GB) can make for many hours of recovery time. A trade-off must take place. 6

Calculating desired transaction log size Check for log sequence number in SHOW ENGINE INNODB STATUS. mysql> pager grep sequence - mysql> SHOW ENGINE INNODB STATUS\G SELECT SLEEP(60); SHOW ENGINE INNODB STATUS\G Log sequence number 184 4145541287... Log sequence number 184 4150607829 7

How much transactional MB do we write per hour? (4150607829-4145541287)*60/1024/1024 = 290 MB/Hr If we want to be able to recover within one hour, the combined transaction log size must not exceed 290MB 8

Need to restart? Restarting an InnoDB MySQL server (change of parameters, upgrade, machine reboot), may take a while. First attempt to minimize shutdown time is to set innodb_fast_shutdown. But this will be costly on next startup. 9

Gradual shutdown set global innodb_max_dirty_pages_pct=0; Will cause InnoDB to keep less dirty pages in memory. InnoDB will flush pages frequently. Reaching 0 is not possible on loaded server. Server is still up and responsive during this time. Upon shutdown, there's less flushing to do, hence shutdown is faster. 10

Helping out some more SHOW OPEN TABLES; Manually execute FLUSH TABLE T for each T in list of open tables. Will lock each table on turn. 11

Query cache Allows for caching query results. A query's result can be stored in the query cache, to be directly served to a later identical query, without reading actual table data. 12

Query cache Allows for caching query results. A query's result can be stored in the query cache, to be directly served to a later identical query, without reading actual table data. 13

How good is my query cache? mysql> SHOW GLOBAL STATUS LIKE 'qcache%'; +-------------------------+----------+ Variable_name Value +-------------------------+----------+ Qcache_free_blocks 2 Qcache_free_memory 66066864 Qcache_hits 2951917 Qcache_inserts 1657123 Qcache_lowmem_prunes 0 Qcache_not_cached 130096 Qcache_queries_in_cache 16 Qcache_total_blocks 47 +-------------------------+----------+ 14

But comparing consequent status: Doesn't look too good now... +-------------------------+----------+ Variable_name Value +-------------------------+----------+ Qcache_hits 10 Qcache_inserts 257 +-------------------------+----------+ 15

Query cache Incurs management overhead. Has a single locking mutex. Busy multicore system may suffer from using query cache. Consider using Memcached instead. 16

Memcached An application level caching server. Has client API for all major programming languages. Has client API for MySQL: memcached functions for MySQL. Can be utilized by stored procedures or triggers for cache invalidation, for example. SELECT memc_set('mykey', 'The answer is 42'); SELECT memc_delete('mykey') INTO @discard; 17

Table cache Caches table file descriptors. Usually should be very large (e.g. in the thousands) When schema contains huge amount of tables (e.g. ~ millions), table cache becomes bottleneck. 18

Table cache Like query cache, has global, single mutex. When flushing old tables from cache, LRU algorithm requires mutex lock. Time to hold lock is in proportion to cache size. When DB has too amny tables, consider reducing table cache size. Flushing will still occur, but with smaller lock contention periods. 19

Thank you! Visit http://openark.org 20