Linux and Mysql Tuning Getting the most from your hardware.

Slides:



Advertisements
Similar presentations
Storing Data: Disk Organization and I/O
Advertisements

© 2003 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice Performance Measurements of a User-Space.
Enhancing Application Performance Root Causes and Quick Solutions.
Mitchel Sellers, CEO IowaComputerGurus Inc.. Active in the DotNetNuke eco system for about 6 years Author of Professional DotNetNuke Module Programming.
CMPT 431 Dr. Alexandra Fedorova Lecture III: OS Support.
CMPT 401 Summer 2007 Dr. Alexandra Fedorova Lecture III: OS Support.
CMPT 401 Dr. Alexandra Fedorova Lecture III: OS Support.
Part IV: Memory Management
1 1999/Ph 514: Channel Access Concepts EPICS Channel Access Concepts Bob Dalesio LANL.
Internet Information Server 6.0. IIS 6.0 Enhancements  Fundamental changes, aimed at: Reliability & Availability Reliability & Availability Performance.
Computers Software. Computer Layers Hardware BIOS Operating System Applications.
Segmentation and Paging Considerations
Virtual Memory Adapted from lecture notes of Dr. Patterson and Dr. Kubiatowicz of UC Berkeley.
Multiprocessing Memory Management
Memory Management 2010.
Disco Running Commodity Operating Systems on Scalable Multiprocessors.
Operating System Organization
1 OS & Computer Architecture Modern OS Functionality (brief review) Architecture Basics Hardware Support for OS Features.
Basics of Operating Systems March 4, 2001 Adapted from Operating Systems Lecture Notes, Copyright 1997 Martin C. Rinard.
Layers of a DBMS Query optimization Execution engine Files and access methods Buffer management Disk space management Query Processor Query execution plan.
Authors: Tong Li, Dan Baumberger, David A. Koufaty, and Scott Hahn [Systems Technology Lab, Intel Corporation] Source: 2007 ACM/IEEE conference on Supercomputing.
1. When things go wrong: how to find SQL error Sveta Smirnova Principle Technical Support Engineer, Oracle.
Zabbix Performance Tuning
SEDA: An Architecture for Well-Conditioned, Scalable Internet Services
Livio Soares, Michael Stumm University of Toronto
Disco : Running commodity operating system on scalable multiprocessor Edouard et al. Presented by Jonathan Walpole (based on a slide set from Vidhya Sivasankaran)
CS533 Concepts of Operating Systems Jonathan Walpole.
Review of Memory Management, Virtual Memory CS448.
Introduction and Overview Questions answered in this lecture: What is an operating system? How have operating systems evolved? Why study operating systems?
Threads, Thread management & Resource Management.
Virtual Machine Monitors: Technology and Trends Jonathan Kaldor CS614 / F07.
Oracle Tuning Considerations. Agenda Why Tune ? Why Tune ? Ways to Improve Performance Ways to Improve Performance Hardware Hardware Software Software.
1 Wenguang WangRichard B. Bunt Department of Computer Science University of Saskatchewan November 14, 2000 Simulating DB2 Buffer Pool Management.
IT253: Computer Organization
Memory Management – Page 1 of 49CSCI 4717 – Computer Architecture Memory Management Uni-program – memory split into two parts –One for Operating System.
DONE-08 Sizing and Performance Tuning N-Tier Applications Mike Furgal Performance Manager Progress Software
Computing Infrastructure for Large Ecommerce Systems -- based on material written by Jacob Lindeman.
Chapter 10 System Monitoring Issues Performance Benchmarks NT Server Services Users and Server Access Information Task Manager for Applications Ram and.
The Alternative Larry Moore. 5 Nodes and Variant Input File Sizes Hadoop Alternative.
Supporting Multi-Processors Bernard Wong February 17, 2003.
Disco : Running commodity operating system on scalable multiprocessor Edouard et al. Presented by Vidhya Sivasankaran.
ESRI User Conference 2004 ArcSDE. Some Nuggets Setup Performance Distribution Geodatabase History.
DMBS Internals I. What Should a DBMS Do? Store large amounts of data Process queries efficiently Allow multiple users to access the database concurrently.
Computer Systems Week 14: Memory Management Amanda Oddie.
Review °Apply Principle of Locality Recursively °Manage memory to disk? Treat as cache Included protection as bonus, now critical Use Page Table of mappings.
Operating Systems ECE344 Ashvin Goel ECE University of Toronto Demand Paging.
Arne Wiebalck -- VM Performance: I/O
Consider the Java code snippet below. Is it a legal use of Java synchronization? What happens if two threads A and B call get() on an object supporting.
Protection of Processes Security and privacy of data is challenging currently. Protecting information – Not limited to hardware. – Depends on innovation.
1 Channel Access Concepts – IHEP EPICS Training – K.F – Aug EPICS Channel Access Concepts Kazuro Furukawa, KEK (Bob Dalesio, LANL)
DMBS Internals I. What Should a DBMS Do? Store large amounts of data Process queries efficiently Allow multiple users to access the database concurrently.
Chapter 2 Introduction to OS Chien-Chung Shen CIS/UD
Let’s get into PostgreSQL performance PGDay India 26 February 2016 Himanchali
REMINDER Check in on the COLLABORATE mobile app Best Practices for Oracle on VMware - Deep Dive Darryl Smith Chief Database Architect Distinguished Engineer.
What Should a DBMS Do? Store large amounts of data Process queries efficiently Allow multiple users to access the database concurrently and safely. Provide.
Título/Title Nome/Name Cargo/Position Foto/ Picture Linux Performance on Power Breno Leitão Software Engineer.
No more waiting. Sponsors About me  Database Technology Specialist  MVP  Blogger  Author 3
1© Copyright 2015 EMC Corporation. All rights reserved. NUMA(YEY) BY JACOB KUGLER.
Understanding and Improving Server Performance
Thread & Processor Scheduling
CS 6560: Operating Systems Design
Anything But, Troubleshooting when it’s not SQL Server
Software Architecture in Practice
Optimizing SQL Server Performance in a Virtual Environment
11/9/ :03 AM © Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN.
Predictive Performance
Presented by: Eric Carty-Fickes
ColdFusion Performance Troubleshooting and Tuning
CS222/CS122C: Principles of Data Management UCI, Fall 2018 Notes #03 Row/Column Stores, Heap Files, Buffer Manager, Catalogs Instructor: Chen Li.
Exploring Multi-Core on
Presentation transcript:

Linux and Mysql Tuning Getting the most from your hardware

The Ubiquitous About Me Ran datacenters for: National Geographic ExpertCity (now Citrix Online) Fastclick (now Valueclick) University of California (now broke); Now CEO/founder of LogicMonitor.com Probably just like you. (Not a kernel committer, or poring over MySQL source code).

Your Mileage May Vary Nothing I am going to say will have any impact in your environment. Unless it does. So...test, measure, rinse, repeat.

What to measure? Everything! Database (innodb, MyISAM, replication), OS, disk, application – all in as much detail as possible.

Measure YOUR application Get monitoring that can query db directly, and slice/dice (registrations/sec; customer updates received, etc). Also instrument front ends (via JMX, WMI, web status, etc) so you can measure effect on app of db adjustments

Talk outline Kernel IO scheduler tuning InnoDB thread tuning Stopping swapping Swappiness NUMA factors Huge pages

Why? Limits are always one of CPU, RAM, Disk, Network. But with better the limit will move to next object Default configurations may be for: Your server:

IO Scheduler Tuning Kernel decides how to order disk operations, in order to combine IO ops into one op, and also minimize disk seeks, or not. Defaults work. No benefit in other policies, only harm. Don't bother testing. But, it's trivial to test, so don't take my word for it. With battery backed RAID cache, others have reported good results with noop. Kernel, hardware dependent. Test! echo noop > /sys/block/sda/queue/scheduler

VM on ESX with no-cache RAID1 Switching from CFQ to Noop Amount of non-merged writes overwhelmed disk. Switch to NoOP

VM on ESX no-cache RAID1 Switch from anticipatory to CFQ at 13:10 CFQ has slightly more reads merged, slightly better performance time. Switch to CFQ

Lots of IO where ordering doesn't matter 4000 disk operations to SSD Switching from CFQ to NoOP – slightly worse IO completion time. Switch to NoOP

But it saves CPU, right? Not significantly, if at all. Policy switched

Innodb Thread Concurrency If database is slow, but CPU not busy...this may be issue. Defaults range from 4 (in some distro's) to infinite, depending on version. 8 seems most common default in real world. Infinite changes between versions. Default probably too low for real DB server.

Test! Benchmark first, then real life Use a threaded benchmark. sysbench --test=oltp --mysql-table- engine=innodb --mysql- socket=/var/lib/mysql/mysql.sock --max- time=300 --db-driver=mysql --num-threads=10 - -max-requests= run Use same benchmark, vary server config.

Results will vary with # users How many user threads to test? Use real data.

My results, not yours This is true on some hardware, with some version of MySQL, with 10 client threads. Your mileage WILL vary. Test. Higher settings not always better.

More InnoDB threads – more efficient use of CPU 8 Innodb threads 4 Innodb Threads 16 Innodb Threads Innodb Threads

Swapping Use of swap not bad – swapping is bad. OK (but not ideal): Performance Killer:

Disable swap? Erm … probably not. Because new pages are always being read in and processes are always allocating new memory, the OS will have to make a decision of what pages to evict from physical memory. If a page is dirty, it can only be evicted if there's swap. So if you have dirty pages that are very rarely used, swap allows you to keep more hot, clean pages in memory.

Easy things first echo 0 > /proc/sys/vm/swappiness echo vm.swappiness = 0 >> /etc/sysctl.conf; sysctl -p This may be enough. If so, KISS.

NUMA factors System tries to allocate memory local to the CPU a process runs on. In dual processor system, if one process tries to grab > 50% of system's memory, it will use all free memory local to one processor. other process on that CPU requesting memory may cause swap activity to get local memory – even though there is free non-local memory. swap-insanity-and-the-numa-architecture/

Numa, II I couldn't reproduce: Run mysql with affinity to a physical CPU, with buffer pool that consumes all local memory. Start Java process with affinity to same CPU. Mem was allocated from other core. But.. no swap used. But just in case...easy to address: numactl --interleave all mysqld If you are allocating more than 50% memory to innodb (or any other single process), you are guaranteed non-local memory access. So may as well be deterministic, and possibly benefit from this swap-fix.

HugePages Currently huge pages are not swapped (may change) Will have some (probably very minor) performance benefit (big in some cases) But.. more complex (and thus risky.) Need to enable in kernel, configure kernel,ulimits, security groups, configure mysql. See page-support.html

HugePages Set nr_hugepages too low – Mysql wont use, and you just wasted memory. Ditto too high. Pins Innodb buffer pool cache – but will increase pressure on other memory if swapping is triggered Will reduce TLB cache lookups/misses. Does that matter? Test!

Summary My app/kernel/hardware/DB version is not yours. YMMV. Test IO scheduler, as its so easy. Test InnoDB thread concurrency. Address swapping in the simplest way you can. Trend everything. All the time. Compare pre- and post releases.

That's it! Questions? Blog.logicmonitor.com