存储方式与介质对性能的影响_MySQL
bitsCN.com
摘要
数据的存储方式对应用程序的整体性能有着极大的影响。对数据的存取,是顺利读写还是随机读写?将数据放磁盘上还将数据放flash卡上?多线程读写对性能影响?面对着多种数据存储方式,我们如何选择?本文给大家提供了一份不同存储模式下的性能测试数据,方便大家在今后的程序开发过程中可以利用这份数据选择合适的数据存储模式。
TAG
存储性能,innodb性能,存储介质
目录
目录… 1
简介… 1
存储性能分析… 2
测试程序说明:… 2
存储测试数据:… 2
Mysql innodb性能测试… 4
Mysql(InnoDB)刷盘策略… 6
c/s模式通信性能… 6
直接文件存储… 7
文件IO方式… 7
完全随机写还是跳跃,5倍的性能差距… 8
多线程随机读、处理速度、响应时间… 9
系统缓存… 10
系统缓存相关的几个内核参数… 10
dirty页的write back. 10
总结… 11
简介
数据的存储方式对应用程序的整体性能有着极大的影响。对数据的存取,是顺利读写还是随机读写?将数据放磁盘上还将数据放flash卡上?多线程读写对性能影响?面对着多种数据存储方式,我们如何选择?
本文会对不同存储方式做详细的性能测试,以提供给大家一份不同存储方式下的性能测试数据为主,同时会简单介绍各种存储方式之间的性能差异。
存储性能分析
影响储存速度有各个方面的原因,包括存储介质、读写盘方式以及硬件环境对读写盘时的影响。这里主要分享存储速度的一些调研结果。
硬件环境如下:
CPU: INTER Nehalem E5620 2.4GHZx2
内存: PC-8500 4GB*8
硬盘: 300G 10k*2, RAID:1
Flash: SSD 160GB_MLC X25-M G2×6
网卡: 千兆
数据量:117G
测试程序说明:
测试共分两套程序:
- A. 存储测试
a) 存储测试程序均使用pread/pwrite进行存储测试,块链遍历速度采用frs开发的块链库进行。
b) 为了减少随机读写时系统缓存带来的影响
i. 将数据量增大至117G
ii. 每次数据只被测试一次
iii. 程序入口处清内存
c) 测顺序读写时,一次读写所有数据。
d) 测随机读写时,每次读4KB,读381MB。
- B. 网络性能测试
a) 采用ub + ubrpc实现压力工具的服务器端和客户端。
b) UBSVR_NODELAY
c) 常用的Idl规范
d) 对两个不同大小的包请求进行测试
存储测试数据:
磁盘
顺序读:145.59MB/s
随机读:0.91MB/s (每次读4KB,读381MB)
顺序写:83.1MB/s
随机写:0.34MB/s (每次写4KB, 写381MB)
Flash
顺序读:61.5MB/s
随机读:14.9MB/s (每次读4KB,读381MB)
顺序写:59.8MB/s
随机写:1.93MB/s (每次写4KB, 写381MB)
内存
顺序写:1655MB/s
随机写:1496MB/s
Eg: 块链遍历速度1000万元素, 565582 us
磁盘与flash卡的顺序读写性能对比(单位MB):
磁盘与flash卡的随机读写性能对比(单位MB):
对比磁盘和flash卡的随机读写性能,我们可以看到:对于写操作而言,其在磁盘和flash卡上的性能差异较小,且事实上其性能差异会随着随机写时每次写入的数据量以及flash卡块大小等其它因素而产生波动;同时,在带写优化的flash上,当将数据写入flash卡时,数据会先写到一块buffer中,当满足一定条件(如buffer满)后,会将buffer的数据刷入flash,此时会阻塞写,因此会带来性能抖动。所以,当应用程序的多数操作是写入操作时,若没有flash卡也可以勉强将数据放到磁盘上。
但是相反,从测试结果看,在磁盘和flash卡上的随机读性能有着8倍甚至更多的差距,所以当程序读磁盘操作相当多时,把数据放到flash卡上是一个比较好的选择。比如,对于一个随机查询较多数据库应用程序,我们可以考虑把数据库的存储文件放到flash卡上。
另一方面,我们可以直观地看到,无论顺序读还是顺序写,在磁盘上的速度都远远高于在flash卡上的速度。所以如果程序所需的数据是从磁盘一次载入,载入后对数据的修改都是内存操作,不直接写盘,当需要写盘时,也是一次将内存中的数据dump到磁盘上时。我们都应该将数据放到磁盘,而不是flash卡上。
bitsCN.com

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



If you encounter the Unable to save changes error while using the Photos app for image editing in Windows 11, this article will provide you with solutions. Unable to save changes. An error occurred while saving. Please try again later. This problem usually occurs due to incorrect permission settings, file corruption, or system failure. So, we’ve done some deep research and compiled some of the most effective troubleshooting steps to help you resolve this issue and ensure you can continue to use the Microsoft Photos app seamlessly on your Windows 11 device. Fix Unable to Save Changes to Photos App Error in Windows 11 Many users have been talking about Microsoft Photos app error on different forums

In Windows, the Photos app is a convenient way to view and manage photos and videos. Through this application, users can easily access their multimedia files without installing additional software. However, sometimes users may encounter some problems, such as encountering a "This file cannot be opened because the format is not supported" error message when using the Photos app, or file corruption when trying to open photos or videos. This situation can be confusing and inconvenient for users, requiring some investigation and fixes to resolve the issues. Users see the following error when they try to open photos or videos on the Photos app. Sorry, Photos cannot open this file because the format is not currently supported, or the file

Microsoft Paint not working in Windows 11/10? Well, this seems to be a common problem and we have some great solutions to fix it. Users have been complaining that when trying to use MSPaint, it doesn't work or open. Scrollbars in the app don't work, paste icons don't show up, crashes, etc. Luckily, we've collected some of the most effective troubleshooting methods to help you resolve issues with Microsoft Paint app. Why doesn't Microsoft Paint work? Some possible reasons why MSPaint is not working on Windows 11/10 PC are as follows: The security identifier is corrupted. hung system

The Apple Vision Pro headset is not natively compatible with computers, so you must configure it to connect to a Windows computer. Since its launch, Apple Vision Pro has been a hit, and with its cutting-edge features and extensive operability, it's easy to see why. Although you can make some adjustments to it to suit your PC, and its functionality depends heavily on AppleOS, so its functionality will be limited. How do I connect AppleVisionPro to my computer? 1. Verify system requirements You need the latest version of Windows 11 (Custom PCs and Surface devices are not supported) Support 64-bit 2GHZ or faster fast processor High-performance GPU, most

Many users have been complaining about encountering error code caa90019 every time they try to log in using Microsoft Teams. Even though this is a convenient communication app, this mistake is very common. Fix Microsoft Teams Error: caa90019 In this case, the error message displayed by the system is: "Sorry, we are currently experiencing a problem." We have prepared a list of ultimate solutions that will help you resolve Microsoft Teams error caa90019. Preliminary steps Run as administrator Clear Microsoft Teams application cache Delete settings.json file Clear Microsoft from Credential Manager

When trying to open a disk image in VirtualBox, you may encounter an error indicating that the hard drive cannot be registered. This usually happens when the VM disk image file you are trying to open has the same UUID as another virtual disk image file. In this case, VirtualBox displays error code VBOX_E_OBJECT_NOT_FOUND(0x80bb0001). If you encounter this error, don’t worry, there are some solutions you can try. First, you can try using VirtualBox's command line tools to change the UUID of the disk image file, which will avoid conflicts. You can run the command `VBoxManageinternal

What happens when someone calls in airplane mode? Mobile phones have become one of the indispensable tools in people's lives. It is not only a communication tool, but also a collection of entertainment, learning, work and other functions. With the continuous upgrading and improvement of mobile phone functions, people are becoming more and more dependent on mobile phones. With the advent of airplane mode, people can use their phones more conveniently during flights. However, some people are worried about what impact other people's calls in airplane mode will have on the mobile phone or the user? This article will analyze and discuss from several aspects. first

Having issues with the Shazam app on iPhone? Shazam helps you find songs by listening to them. However, if Shazam isn't working properly or doesn't recognize the song, you'll have to troubleshoot it manually. Repairing the Shazam app won't take long. So, without wasting any more time, follow the steps below to resolve issues with Shazam app. Fix 1 – Disable Bold Text Feature Bold text on iPhone may be the reason why Shazam is not working properly. Step 1 – You can only do this from your iPhone settings. So, open it. Step 2 – Next, open the “Display & Brightness” settings there. Step 3 – If you find that “Bold Text” is enabled
