《Tuning I/O Performance》读后笔记

《Tuning I/O Performance》,文章地址:http://doc.opensuse.org/products/draft/SLES/SLES-tuning_sd_draft/cha.tuning.io.html

大家在读了原文后若有更好的见解,请不吝赐教,谢谢!

文章以SUSE Linux Enterprise Server为例讲解了Linux系统的IO调度策略及调优,可适应于其他Linux操作系统,如CentOS、UBUNTU等。

1、查看当前IO调度策略(大多数Linux发行版的默认策略是CFQ)

命令:cat /sys/block/sda/queue/scheduler

结果:noop anticipatory deadline [cfq]   #CentOS系统,可知可用的调度策略和当前调度策略,[]中的为当前系统采用的调度策略

2、更改当前调度策略

a、在系统启动时加入elevator=SCHEDULER 的内核参数

b、直接修改内核参数:echo SCHEDULER > /sys/block/DEVICE/queue/scheduler

3、策略调优

各个策略均有参数可以调优,参数路径大致相同,在 /sys/block/DEVICE/queue/iosched/目录下

命令:echo VALUE > /sys/block/DEVICE/queue/iosched/TUNABLE

4、各主要策略调优

a、CFQ(Completely Fair Queuing)

i、CFQ是一个公平的算法,每个线程都有一个时间片来提交I/O请求,不同的任务也可以分配不同的I/O优先级(man 1 ionice)

ii、可调优的参数

/sys/block/<device>/queue/iosched/slice_idle

#就算一个任务当前没有I/O请求了,采用此策略仍然会等待一段时间才切换到下一个线程。

#针对 SSDs、多磁盘SAN等当前磁道位置(不用额外花费时间寻址)不是特别重要的,只可以把此参数设置为0可以明显提高吞吐量。

/sys/block/<device>/queue/iosched/quantum
                      #限制设备同时处理的请求数量,默认值是4
                      #调高此值虽然可以提高性能,但因为并发处理量增多了,可能会增加某些I/O的延时

#所以可调整/sys/block/<device>/queue/iosched/slice_async_rq(默认是2,限制同一时间片的异步写请求数量)

/sys/block/<device>/queue/iosched/low_latency
                      #对I/O延迟要求非常高的负载环境中,可以将此值设置为1会好一些

b、NOOP

i、它是一种非常普通的调度策略,有I/O请求时它就处理,它可以用来检测其它调度算法在复杂I/O环境下是否引起了I/O性能。

ii、有自身的的调度算法的设备,如智能存储设备、SSDs等,虽然一般情况下DEADLINE更适合这些设备,但在较低负载下它的性能可能会更好。

c、DEADLINE

i、DEADLINE是为降低延时而设计的,每个I/O请求分配了一个结束时间,超时后便会暂存到队列(读和写两个队列)中,当没有超时的请求时再处理这些队                    列里的请求,这个算法对读的好处大于写。

ii、在并发读写及优先级不是非常重要的情况下,此调试要比CFQ策略性能好许多。

iii、调优参数

/sys/block/<device>/queue/iosched/writes_starved

#控制在多少个读请求后可以处理一个写请求,设置为3表示处理3个请求后可以处理一个写请求

/sys/block/<device>/queue/iosched/read_expire
                       #以毫秒为单位,默认值是500,设置读操作的超时时间(当前时间往后推read_expire值便是超时的时间点)

/sys/block/<device>/queue/iosched/write_expire
                       #同上,控制写请求超时时间

5、I/O Barrier调优

Write Barriers 是一种内核机制,可以保证文件系统元数据正确有序地写入持久化存储,哪怕持久化存储掉电的情况也能保证。大多数文件系统(XFS、ext3、ext4、reiserfs)在fsync或事务提交的时候便会触发 Write Barriers 。可在有备用电池的磁盘关闭 Write Barriers 来提高性能。

可在ext3、ext4、reiserfs文件系统挂载时加上barrier=0的选项,XFS挂载时使用nobarrier选项。

时间: 2024-08-10 02:11:11

《Tuning I/O Performance》读后笔记的相关文章

Performance Tuning guide 翻译 || Performance Tuning Guide 11G中新增特性

Performance Tuning Guide 11G中新增特性 本章描述了Oracle11g Release2(11.2)中增加了哪些新的性能调整 特性,以及指向这些增加信息. 本章节描述的特性以及增强,包含了优化数据库性能的各个方面. 关于Oracle11gR2的所有新特性汇总,可以查看Oracle Database New Features Guide. 11.2.0.2中新增的新特性(关于性能调优) 新增的以及更新过的性能调整特性包括: 注:Resource Manager(资源管理器

High Performance Browser Networking

Table of Contents Foreword Preface About This Book Conventions Used in This Book Safari? Books Online How to Contact Us Content Updates May 23, 2014 I. Networking 101 1. Primer on Latency and Bandwidth Speed Is a Feature The Many Components of Latenc

使用Nginx、Nginx Plus抵御DDOS攻击

原创 2015-10-16 陈洋 运维帮 DDOS是一种通过大流量的请求对目标进行轰炸式访问,导致提供服务的服务器资源耗尽进而无法继续提供服务的攻击手段. 一般情况下,攻击者通过大量请求与连接使服务器处于饱和状态,以至于无法接受新的请求或变得很慢. 应用层DDOS攻击的特征 应用层(七层/HTTP层)DDOS攻击通常由木马程序发起,其可以通过设计更好的利用目标系统的脆弱点.例如,对于无法处理大量并发请求的系统,仅仅通过建立大量的连接,并周期性的发出少量数据包来保持会话就可以耗尽系统的资源,使其无

Nginx 性能调优

原文地址:http://nginx.com/blog/tuning-nginx/ Tuning NGINX for Performance NGINX is well known as a high performance load balancer, cache and web server, powering over 40% of the busiest websites in the world.  Most of the default NGINX and Linux settings

Java性能提示(全)

http://www.onjava.com/pub/a/onjava/2001/05/30/optimization.htmlComparing the performance of LinkedLists and ArrayLists (and Vectors) (Page last updated May 2001, Added 2001-06-18, Author Jack Shirazi, Publisher OnJava). Tips: ArrayList is faster than

.Net性能的方方面面(必看官方经典)

更多性能提高相关文章,必看 https://msdn.microsoft.com/en-us/library/hh917314.aspx Chapter 1 - Fundamentals of Engineering for Performance Chapter 2 - Performance Modeling Chapter 3 - Design Guidelines for Application Performance Chapter 4 - Architecture and Desig

PostgreSQL源码安装文档

This document describes the installation of PostgreSQL using the source    code distribution. (If you are installing a pre-packaged distribution,    such as an RPM or Debian package, ignore this document and read the    packager's instructions instea

《ActiveMQ in Action》【PDF】下载

内容介绍TheApache ActiveMQ message broker is an open source implementation ofthe Java Message Service spec. It makes for a reliable hub in anymessage-oriented enterprise application and integrates beautifullywith Java EE containers, ESBs, and other JMSpr

WebSphere Application Server Performance Tuning Toolkit

WebSphere? Application Server Performance Tuning Toolkit 是一款基于 Eclipse 的智能工具,旨在帮助用户通过使用数据收集.数据分析和统计数据推断技术来调优 WebSphere Application Server 的性能.其目的是帮助用户查找瓶颈,并适当调优应用程序. 背景知识 随着基于 Java EE 的企业级多层架构应用程序的大范围部署,出现得越来越多的性能问题,而且难以诊断.多层架构使得性能问题难以定位,而且要花费更多的时间和精