Best Practices for
Configuring MySQL
with HGST s1120 Series
PCIe Accelerators
Whitepaper | January 2014
Best Practices for Configuring MySQL with HGST s1120 Series PCIe Accelerators
Table of Contents
Executive Summary............
Best Practices for Configuring MySQL with HGST s1120 Series PCIe Accelerators
2
Executive Summary
MySQL has become the mos...
Best Practices for Configuring MySQL with HGST s1120 Series PCIe Accelerators
3
Accelerate MySQL Performance with Solid-St...
Best Practices for Configuring MySQL with HGST s1120 Series PCIe Accelerators
4
Figure 1: MySQL Sharding Configuration
Sha...
Best Practices for Configuring MySQL with HGST s1120 Series PCIe Accelerators
5
Solid-state storage is the best choice for...
Best Practices for Configuring MySQL with HGST s1120 Series PCIe Accelerators
6
Linux I/O Scheduler
For best performance, ...
Best Practices for Configuring MySQL with HGST s1120 Series PCIe Accelerators
7
Benchmark Test and Results
To demonstrate ...
Best Practices for Configuring MySQL with HGST s1120 Series PCIe Accelerators
8
Figure 2: MySQL Benchmark Results – Standa...
© 2014 HGST, Inc., 3403 Yerba Buena Road, San Jose, CA 95135 USA. Produced in the United States All rights reserved. S.A.F...
Upcoming SlideShare
Loading in...5
×

Best Practices for Configuring MySQL with HGST s1120 Series PCIe Accelerators

146

Published on

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
146
On Slideshare
0
From Embeds
0
Number of Embeds
3
Actions
Shares
0
Downloads
4
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Transcript of "Best Practices for Configuring MySQL with HGST s1120 Series PCIe Accelerators"

  1. 1. Best Practices for Configuring MySQL with HGST s1120 Series PCIe Accelerators Whitepaper | January 2014
  2. 2. Best Practices for Configuring MySQL with HGST s1120 Series PCIe Accelerators Table of Contents Executive Summary................................................................................................................... 2 MySQL History and Distributions....................................................................................... 2 Accelerate MySQL Performance with Solid-State Drives..........................................3 Recommendations for Configuring MySQL with s1120 Series PCIe Accelerators.................................................................................................3 Benchmark Tests and Results................................................................................................ 7
  3. 3. Best Practices for Configuring MySQL with HGST s1120 Series PCIe Accelerators 2 Executive Summary MySQL has become the most popular open source relational database in the world for enterprise and web applications. Many enterprise applications and high-profile websites use MySQL databases. While most MySQL deployments still use hard disk drives, many enterprises are turning to solid-state drives as a storage alternative to eliminate I/O bottlenecks and accelerate database performance. The HGST s1120 Series PCIe Accelerator is an ideal solid-state storage solution for MySQL deployments. Its purpose-built PCIe solid-state architecture reduces storage access latencies while delivering long life, consistent high performance and data protection. Administrators ask whether MySQL configuration parameters should be tuned to optimize performance with SSDs, and the answer is yes. In this paper, HGST offers configuration advice regarding MySQL distributions, database and log file placement, RAID, Linux partitions, I/O schedulers and filesystems. MySQL benchmark tests showed up to 34% higher transactions per minute when using these best practices with an s1120 Series PCIe Accelerator. In this way, MySQL users can experience maximum performance gains under heavy workloads. MySQL History and Distributions MySQL is the most popular open source relational database in the world for enterprise and web applications. The database was originally developed in 1995 by the Swedish company MySQL AB. In 2000 the software was released under the GNU General Public License, making it open source and free to use. Oracle now owns the software and continues to develop and offer MySQL Community Edition as open source and freely downloadable. With a development history stretching back nearly 20 years, MySQL has become a solid, functional and popular database platform. Many Web 2.0 applications, cloud deployments and enterprise applications use it. MySQL Editions While MySQL Community Edition is freely available from www.mysql.com, Oracle charges for annual support for access to the more functional MySQL Standard, Enterprise and Cluster Carrier Grade Editions. Percona Server Percona Server is an enhanced version of MySQL Community Edition that includes the enterprise-class features for scalability, availability, backup and security found in the Oracle Enterprise Edition. This drop-in MySQL replacement is available free of charge from www.percona.com. Percona is an independent MySQL support, consulting and services firm.
  4. 4. Best Practices for Configuring MySQL with HGST s1120 Series PCIe Accelerators 3 Accelerate MySQL Performance with Solid-State Drives While most MySQL deployments still use HDDs, the slow response time and I/O throughput of disk drives limit system performance. This I/O bottleneck slows database and application performance, reduces server utilization and increases total cost of ownership. Many enterprises are turning to SSDs as a storage alternative to boost performance and eliminate the storage I/O bottleneck. SSDs provide random I/O throughput and response time multiple orders of magnitude faster than HDDs at a lower cost per IOP. In addition, compared to DRAM, SSDs are nonvolatile, physically denser, cost less per GB and consume less power. SSDs relieve storage I/O constraints, increase utilization of server CPU and memory, accelerate applications, and boost productivity while keeping the costs in check. HGST s1120 Series PCIe Accelerator The HGST s1120 Series PCIe Accelerator is an ideal solid-state storage solution for MySQL deployments. This enterprise-class PCIe SSD installs cleanly and easily in a server PCIe slot. Unlike SAS or SATA drives, PCIe cards do not require a separate enclosure, RAID card, cables and power supply. HGST’s superior PCIe solid- state architecture is purpose-built to reduce storage access latencies and improve application performance. By connecting server CPUs directly to the flash storage using the most efficient, reliable and scalable architecture, HGST PCIe SSDs provide extremely low-latency data access while eliminating the tax on host CPU and DRAM— accelerating to high levels of application performance. The s1120 Series PCIe Accelerator also has built-in enterprise-class reliability that makes it suitable as primary application storage. The s1120 Series protects data in flight or at rest from loss or corruption in the event of flash media or other component errors. PowerSafe™ Technology ensures that data on the card is protected against unscheduled power outages. Using patented CellCare™ Technology, HGST delivers unprecedented endurance with multi-level cell (MLC) media—enabling the use of less-expensive MLC-based solid-state storage for write-intensive caching and database applications. CellCare combined with Advanced Flash Management provides consistent, high performance over the life of the drive. HGST SSDs with these features are designed to perform as well at the end of life as at the beginning and eliminates the need for replacement due to wear out during the warranty period. HGST s1120 Series PCIe Accelerators are backed by a five-year warranty to ensure their robustness in business-critical enterprise applications. Recommendations for Configuring MySQL with s1120 Series PCIe Accelerators MySQL can be tuned to optimize performance with SSDs. HGST recommends the following configurations to maximize MySQL performance with s1120 Series PCIe Accelerators. Sharding Sharding is a method for scaling out MySQL deployments by splitting database tables and distributing them among different server nodes. Each database instance contains a range of table rows. For high availability, MySQL data on each server node should be replicated.
  5. 5. Best Practices for Configuring MySQL with HGST s1120 Series PCIe Accelerators 4 Figure 1: MySQL Sharding Configuration Sharding is complex because application logic must be modified to account for split database tables, as the database instances are unaware of each other. This requires significant upfront development and more complex operational management. The advantage of sharding is virtually unlimited scalability of database performance and size. HGST recommends s1120 PCIe Series Accelerators for sharded MySQL configurations because it reduces the number of server nodes required. SSDs support significantly higher transaction rates than HDDs, which improves server utilization overall and enables MySQL to support a workload with fewer scale-out nodes. For more information, including benchmark test results showing upto 19x performance improvement over an HDD array, see the webcast Reduce TCO for MySQL Scale-up and Scale-out Configurations using STEC s1120 PCIe Accelerators . Database and Log Files HGST recommends placing the entire MySQL data directory (variable datadir) on the s1120 Series PCIe card because solid-state storage offers by far the best performance for both random and sequential I/O. MySQL I/O is directed to both data and log files, which are usually stored in the following locations: Data file I/O is random in nature because it involves reading and writing records in the tables. Log I/O is sequential as transactions are continually appended to the end of the file. MySQL data files: $datadir/ibddata1 InnoDB log files: $datadir/ib_logfile0,ib_logfile1
  6. 6. Best Practices for Configuring MySQL with HGST s1120 Series PCIe Accelerators 5 Solid-state storage is the best choice for MySQL data and log files because it provides the best performance for random and sequential I/O, but especially for random. For deployments with extremely large data and log files, it may be necessary to place them on different storage devices. In this case, log files may be placed on a disk array since a sufficient number of high-performance HDDs may perform adequately for sequential I/O. The data files should reside on the s1120 Series PCIe card for superior random I/O performance. For more details about laying out data files in MySQL, see the MySQL support page for InnoDB configuration. RAID RAID is used for data protection via drive redundancy and sometimes for performance improvement. RAID may not be necessary when using s1120 Series PCIe Accelerators with MySQL because it provides data protection and high performance natively. The card employs Secure Array of Flash Elements (S.A.F.E.™) Technology, a form of internal parity protection that enables the card to recover from NAND flash page, block, die and chip failures. S.A.F.E.™ , especially when combined with database replication as shown in Figure 1 above, provide strong data protection without traditional RAID. In cases where multiple PCIe storage cards are used in a server, software RAID 0 (striping) can be used to aggregate performance or RAID 1 (mirroring) for data redundancy. Linux Partition Linux partitions should be aligned to the erase block size to optimize I/O performance. Like other media, SSDs may be read from and written to a single bit at a time, however, they must be erased a block at a time. It is optimal to align a Linux partition with the erase block which is generally 8KB. The erase block size of the s1120 Series PCIe Accelerator is also known as the Logical Block Number (LBN). In this example, the Linux partition is configured as a multiple of 8KB as follows: Note that the partition starts at 2048kB. It could start at any number divisible by 8KB. [root@linuxhost ~]# parted /dev/skd0 p Model: Unknown (unknown) Disk /dev/skd0: 1600GB Sector size (logical/physical): 512B/512B Partition Table: Msdos Number Start End Size Type File system Flags 1 2048kB 1600GB 1600GB Primary Ext2
  7. 7. Best Practices for Configuring MySQL with HGST s1120 Series PCIe Accelerators 6 Linux I/O Scheduler For best performance, HGST recommends the NOOP scheduler for SSDs instead of the CFQ scheduler, which is the default for most Linux kernels. The I/O scheduler or disk scheduler is the method used by the Linux kernel to determine how blocks are read from and written to storage. As its name indicates, the NOOP scheduler simply inserts all I/O requests into a FIFO queue. It does not try to optimize read or write requests. Linux Filesystem HGST recommends the ext4 filesystem rather than xfs because it provides better performance for write- intensive workloads. Benchmark test results comparing ext4 and xfs can be found on Percona’s MySQL Performance Blog. We recommend configuring ext4 as follows, which corresponds to the file /etc/fstab: Explanation of parameter options: • rw – Mount the filesystem read/write, as opposed to the default read-only. • discard – Pass TRIM commands to the underlying device, which in this case is the s1120 Series PCIe Accelerator. This option informs the filesystem which blocks are no longer in use and may be erased in advance of future writes, optimizing performance. • nobarrier – Barriers are a mechanism in ext4 that allow ordered writes for storage devices with battery- backed caches. However, enabling barriers incurs a performance penalty. Since the s1120 Series uses supercapacitors to preserve data integrity in the event of power loss, it is safe to turn off barriers and eliminate the performance penalty. [root@linuxhost ~]# echo noop > /sys/block/skd0/queue/scheduler [root@linuxhost ~]# cat /sys/block/skd0/queue/scheduler [noop] anticipatory deadline cfq /dev/skd0p1 /var/lib/mysql ext4 rw,discard,nobarrier 0 0
  8. 8. Best Practices for Configuring MySQL with HGST s1120 Series PCIe Accelerators 7 Benchmark Test and Results To demonstrate the performance advantages of these configurations, HGST conducted a MySQL benchmark test comparing the recommendations with the standard configuration file for the Percona Server MySQL distribution. Test Configuration x86 server, Percona Server 5.6, Red Hat Linux release: A single HGST s1122 PCIe Accelerator with 1.6 TB of capacity was installed in the server. This card stored all MySQL database and log files: The tpcc-mysql benchmark was used, which is a TPCC-like benchmark package available from Percona. Methodology The tpcc-mysql benchmark was run on the test system against the configuration file included with Percona Server and the tuned configuration recommended by HGST. The full configuration file can be found on our website. The benchmark was set up to simulate 1,000 warehouses and stepped through a range of threads (1, 8, 16, 32, 64) to test the effect of concurrency on database performance. MySQL performance metrics were measured and recorded for each test run: Throughput, Latency, IOPs and NOTPMs. Results As shown in Figure 2 and 3, the test results demonstrate that the HGST tuned MySQL configuration performs significantly better under heavy workloads with multiple concurrent users. The tuned configuration achieved 27% higher TPM at 16 threads and 34% higher at 64 threads. In other words, for enterprise and web workloads where many users access applications at the same time, HGST tuning will perform better with s1120 Series PCIe Accelerators. [root@linuxhost ~]# cat /etc/redhat-release CentOS release 6.3 (Final) [root@linuxhost ~]# uname –r 2.6.32-279.el6.x86_64 [root@linuxhost ~]# df -kh /var/lib/mysql/ Filesystem Size Used Avail Use% Mounted on /dev/skd0p1 1.5T 350G 1.1T 26% /var/lib/mysql
  9. 9. Best Practices for Configuring MySQL with HGST s1120 Series PCIe Accelerators 8 Figure 2: MySQL Benchmark Results – Standard vs Tuned Configurations @ 16 Threads Figure 3: MySQL Benchmark Results – Standard vs Tuned Configurations @ 64 Threads Conclusion HGST s1120 Series PCIe Accelerators provide superior I/O performance for MySQL databases. Simply by optimizing configuration parameters, users can experience maximum performance gains under heavy workloads.
  10. 10. © 2014 HGST, Inc., 3403 Yerba Buena Road, San Jose, CA 95135 USA. Produced in the United States All rights reserved. S.A.F.E. is trademark of HGST, Inc. and its affiliates in the United States and/or other countries. References in this publication to HGST’s products, programs, or services do not imply that HGST intends to make these available in all countries in which it operates. Product specifications and test results are for information purposes only and do not constitute a warranty. Information is true as of the date of publication and is subject to change. Warranty details are provided by your point of purchase. Please visit the Support section of our website, www.hgst.com/support, for additional information on product specifications. WP018-EN-US-0114-03 Best Practices for Configuring MySQL with HGST s1120 Series PCIe Accelerators

×