. SQL Database Management - Chapter II database hardware performance
2.1 Overview of hardware performance database
The system throughput metric elements:
Swallow a metric system (pressure capacity) closely associated with the request of the CPU consumption, memory, IO and so on.
Reqeust higher consumption of a single CPU, memory, IO slower impact speed, the lower the system throughput, whereas higher.
In order to correctly understand the database performance point, we need to be able to quickly locate the bottleneck point-that quickly find where our main overhead in SQL? And in most cases the performance of the slowest device will be a bottleneck points. Four important resource to consider when discussing performance:
CPU: server is the mainstream multi-core 2.4GB / S, 10GB of data access, six-core only needs 0.7 seconds
Memory: DDR4-2400MHZ = 2.4GHZ, 10GB data access needs to 4 seconds.
I / O: 10K hard -140M / S, 10GB data access needs to 71 seconds.
Network: 1000Kbps, B = 8bit, 1000/8 = 125M 10GB data access, a 80 seconds.
Database system hardware absorbing the CPU --cache (Ll-L2 of-L3) - Memory --SSD Hard - (hard disk and network)
2.2 Hardware performance at all levels
2.2.1 CPU
2.2.1.1 Cache: CPU key performance indicators, the bigger the better.
CPU cache (Cache Memory) is located between the CPU and memory of the temporary memory, its memory capacity is smaller than the switching speed but more much faster than memory. Appears cache mainly to solve the CPU speed and memory access speed does not match the contradiction, because the memory read and write speeds than the CPU speed is much faster, so that CPU will take a long time to wait for the arrival of data or to write data to RAM. Data in the cache memory is a small part, but this is a small part of the CPU is about to visit a short time, when the CPU calls a lot of data, you can call the first cache, thus speeding up the read speed. High Price
Currently modern multilayer CPU cache (L1, L2 of, L3) from L3 to L1, smaller cache, but about the increasing speed faster, Ll is typically 2ns, 32K. L2 is typically 4ns, 256K, L3 typically 6ns, 10MB-40MB.
2.2.1.2 frequency: CPU key performance indicators, the bigger the better.
Also called clock frequency in a megahertz (MHz), or gigahertz (GHz), is used to indicate the operation speed of the CPU, for processing data. Typically, the higher the frequency, the speed of the CPU to process data faster.
2.2.1.3 Hyper-Threading: the actual increase 0.1-0.15, physical cores better.
"Hyper-Threading" (Hyperthreading Technology) technique is through the use of special hardware instructions may be two logical cores modeled as two physical chips hyper-threading, thread-level parallelism achieved in a single computing processor, while in the corresponding hard and soft
Greatly improve the operational performance of the support member, such that a single processor on a dual-processor performance simulation. In fact, in essence, it is a kind of hyper-threading CPU may be temporarily idle internal resources to fully deal with "mobilize" up technology.
Multicore 2.2.1.4: FIG.
2.2.1.5 server system architecture
SMP (Symmetric Multi-Processor) structure called a symmetric multi-processor
The so-called symmetric multi-processor configuration, the server refers to the plurality of CPU symmetrical work, without prioritizing or affiliation. Each CPU share the same physical memory, each CPU to access any address in memory is the same as the time required, and therefore also referred to as SMP-uniform memory access architecture (UMA: Uniform Memory Access). Extend your way SMP servers include increased memory, a faster CPU, increased CPU, expansion I / O (slot number and bus number) as well as adding more external device (usually a disk storage).
The main feature of SMP servers is shared, all system resources (CPU, memory, I / O, etc.) are shared. It is due to such features, leading to major problems SMP server, that is its scalability is very limited. For SMP servers, each with a shared link may cause a bottleneck when the SMP server extensions, and is the most restrictive of memory. Since each CPU must pass the same access to the same memory bus memory resources, so as to increase the number of CPU, memory access violation will increase rapidly, eventually resulting in a waste of CPU resources, the effectiveness of the CPU performance is greatly reduced. Experiments show that, the SMP server CPU best utilization case 2 to. 4 -CPU
Non-uniform memory access NUMA architecture
Due to restrictions on SMP scalability, people began to explore how to effectively extend the technology to build large systems, NUMA is one of the results in this effort, use NUMA technology, you can put dozens of CPU (or even hundreds CPU) combined in a server.
Advantages are: use more CPU, a disadvantage: if the data accessed in another NUMA node memory, with slightly higher cost of access to the SMP system.
2.2.2 Memory
Because the memory speed is higher than the hard disk IO, so efficient use of memory resources have a significant impact on overall system performance.
All of the system or database administrator, always want to memory the bigger the better, the sooner the better. With the play memory technology, the price of memory getting cheaper. Now we are in a production environment, you can see 128,256GB, even TB-level memory is not unusual. In general, the database often use as a buffer memory, large memory configurations on the performance of the database has a clear upgrade
Memory performance parameters: capacity, frequency, delay value.
DDR4 2400HMZ, 35ns。
Memory bandwidth speed is = 2400HMZX64bit / 8 = 19.2GB / S.
2.2.3 Disk
The basic parameters of the disk
Volume: Volume indicators also includes a hard disk platter capacity, the so-called single platter hard drive capacity is monolithic disc capacity, the greater the single-disc capacity, the lower the unit cost, average access time is shorter. They buy when he is 500G hard disk, but the actual capacity of less than 500G. Because the factory is based on 1MB = 1000KB be converted, so we bought a new hard drive, than the actual amount of time to buy a small point.
Speed (Rotational Speed or Spindle speed),
The rotational speed of the hard disk spindle motor, i.e. the maximum number of revolutions of the disk in the hard disk can be completed within one minute. Speed speed is one of the important parameters indicate the grade of the hard disk, it is one of the key factors that determine the internal hard disk transfer rate, to a large extent directly affect the speed of the hard drive. The faster the speed of the hard disk, the hard disk to find the file, the faster the relative transmission rate of the hard disk will be improved. Hard disk rotational speed expressed in many revolutions per minute to, units of RPM, RPM Revolutions Per minute is an abbreviation is rev / min. RPM higher the value, the faster internal transfer rate, the shorter access time, the better the overall performance of the hard drive.
Transmission rate
Transmission rate (Data Transfer Rate) disk speed data transfer rate is hard to read and write data in megabytes per second (MB / s). Hard disk data transfer rate and data transfer rate comprises an internal and external data transfer rate.
Internal transfer rate (Internal Transfer Rate), also known as sustained transfer rate (Sustained Transfer Rate), which reflects the performance of hard disk buffer is not used. Internal transfer rate depends on the rotational speed of the hard disk.
External transfer rate (External Transfer Rate) data transfer rate is also referred to as a burst (Burst Data Transfer Rate) or interface transfer rate, which is the nominal rate of data transfer between the system bus and the hard disk buffer, and external data transfer rate hard disk interface type and hard disk cache size.
Hard disk interface
The connecting member between the hard disk and the host system, is to transfer data between host memory and the disk cache. Different hard disk interface determines the speed of the connection between the hard drive and the computer in the entire system, the merits of hard disk interface directly affects the running speed and the quality of system performance.
2.3 thing about database storage needs to be considered
2.3.1 store the most important indicators
In MB / sec is used to measure certain units from the storage number of bytes transmitted within 1 second
To IO / sec for the IOPS throughput indicates how many units can perform disk IO per second
IOPS calculation
IOPS = 1 / IO Time
IO Time = Seek Time + 60 sec/Rotational Speed/2 + IO Chunk Size/Transfer Rate
Seek Time = average seek time (Averageseektime),
(Rotational Speed = disk speed
Transfer Rate = Data transfer rate
10K disk 8K pages computing
IO Time = 5ms + (60sec/10000RPM/2) + 8K/40MB = 5 + 3+ 0.2 = 8.2ms
IOPS =1/8.2ms=120 IOPS
To MB / sec and IOPS that have a greater impact on database performance that perform random read and write OLTP database is mainly IOPS, OLAP analysis database for a large number of sequential read primarily MB / sec.
2.3.2 to consider matters relating to storage
2.3.2.1 use more disk
In RAID, disk speed is always a long time came faster than disk. E.g. 4TB volume required, the use of higher than 10 400G 2 hard 2TB drive performance is obtained. In some cases the throughput is approximately equal to the sum of the individual disk throughput. 400G and 2T hypotheses consistent speed for the 20M / S, then the use of a combination of a total throughput of 400G 200M / S, 2TB combination 40M / S. 400G 2TB combination is a combination of five times.
2.3.2.2 High-speed hard disk
No doubt, high-speed hard disk has better performance than the low-speed hard drive. 15K is the theoretical speed of the hard disk 250M / S, in fact, non-sequential, random read speed actually 2-4M / S, sequential bulk reading speed will not exceed 50-60M / S.
2.3.2.3 Disk Test
You can use windows built-in windows system performance monitor, or use IOMeter three parameters on the line Avg sec / Read, Avg sec / Write, Avg sec / Transfer calculator to measure.
Database transaction log: no more than 5MS, best 0ms.
OLTP data: less than 10MS.
OLAP and reporting systems: no more than 25MS.
Physical Disk IO monitoring of delay
Physical Disk IO on the delay analysis on the Windows level, mainly depends on the Performance Monitor counters to measure physical Disk IO delay counters are mainly three:
Avg Disk sec / Transfer:. Disk each access operation using the average time
Avg Disk sec / Read:. Disk each read operation using the average time
The average time each write Disk used: Avg Disk sec / Write.
avg.Disk sec / (Transfer, Read, Write), can well reflect the rate of Disk IO, the IO speed recommended baseline measure of Disk (baseline):
Soon: <10ms
General: 10-20ms
A bit slow: 20-50ms
Very slow:> 50ms