-
Overview
关于数据库的性能,对于column-oriented database,很多时候性能取决于计算机硬件的磁盘访问I/O性能。
-
一、Workload Profiles
-
Workload Profiles
In the most generic sense, a workload profile describes the behavior of an application, or portion of an application with respect to how it performs work;
Workload profiles for storage systems are typically descibed and grouped by key “Workload Characteristics”;
-
IO workload characteristics
There are many characteristics of an IO workload that affect performance:
-
IO Size
IO size: the size of the Input or Output request.
The smaller an IO, the less time it takes to transmit; the larger an IO, the longer it takes to transmit;
It is the compromise that most applications need to trade-off moving data efficiently in the right size containers with as few round trips as possible.
-
IOPS
IOPS measures the number of Input/Output operations Per Second, this is sometimes referred to as requests per second.
The number of vehicles that pass through the boll in one hour is analogous to the number of bytes that pass through an interface each percond - IOPS;
-
Throughput (bandwidth)
Throughput measures the amount of work performed in a given time period;
Returing to the toll road example, the throughout measures the amount of cargo that passes through the toll tooths in a given period of time;
I O P S ∗ I O S i z e = T h r o u g h p u t IOPS * IO\;Size=Throughput IOPS∗IOSize=Throughput -
Response Time
The time required to send, process, and receive acknowledgement (ACK) for a request is known as Response Time (RT).
A read request involves sending a request for data, processing time to retrieve the data, and returning the data payload;
A write request involves sending a data payload, processing time to store the data, and returing confirmation (ACK) that the write has completed;
-
Read/Write Ratio
How many requests are reads compared to writes;
-
Random vs. Sequential
Sequential IO is a sequence of requests accessing data blocks that are adjacent to each other:
-
-
Other notions
-
Bits vs. Bytes
Bits are referenced with a lower-case ‘b’ and
Bytes
are referenced by an upper-case ‘B
’;
8 b = 1 B 4 b = 1 n y b b l e 8b=1B\\4b=1nybble 8b=1B4b=1nybble -
Decimal vs. Binary
The storage industry uses a decimal system for raw capacity using multiples of 1000;
The computer systems use binary, and the units of measure are based on powers of 1024;
1 T B = 1000 G B = 100 0 4 B y t e s 1 T i B = 1024 G i B = 102 4 4 B y t e s 1TB=1000GB=1000^4Bytes\\1TiB=1024GiB=1024^4Bytes 1TB=1000GB=10004Bytes1TiB=1024GiB=10244Bytes -
Workload Variations
Sustained workload; Averages; Peaks and Bursts;
-
二、有几种I/O
-
Buffer IO 缓存I/O(标准I/O)
缓存I/O又被称作标准I/O
Buffered I/O means the data for the I/O gets buffered or stored in some fast temporary storage, and gathered there for a while, before the I/O is actually done on the storage device;
-
Direct IO 直接I/O
Direct I/O means the data gets written out to the storage device as soon as your program issues the call to do so.
-
text I/O, binary I/O and raw I/O
From [3], The
io
module provides Python’s main facilities for dealing with various types of I/O.There are three main types of I/O:
- text I/O
- binary I/O
- raw I/O
-
IO检测工具
-
iostat
Sar is part of the sysstat package. According to the package, it includes the following system performance tools:
sar
: collects and reports system activity informationiostat
: report CPU utilization and disk I/O statistics;mpstat
: reports global and per-processor statistics;pidstat
: reports statistics for Linux tasks (processes);sadf
: displays data collected bby sar in various formats;
-
iotop
sudo apt update sudo apt install iotop
-
blktrace
-
Summary
iostat 是统计工具,查看具体某个进程的io问题需要iotop或blktrace
-
References
- 磁盘IO瓶颈
- 美团技术团队:磁盘I/O那些事
- Python Standard Library: io - Core tools for working with streams
- SQL Server disk performance metrics – Part 1 – the most important disk performance metrics
- MicroSoft: How To: Troubleshooting SQL Server I/O bottlenecks
- SqlMonitor: Resolving SQL Server Disk IO bottlenecks
- Undertanding how i/o workload profiles relate to performance
- Oracle 8: Designing and Tuning for Performance Release 2
- What’s the difference between buffered I/O and unbuffered I/O?