[置顶] PostgreSQL介绍及PCIe SSD对其性能的提升效果分析
在关系数据库领域,PostgreSQL是一款非常受欢迎的开源数据库软件。自1996年发布至今,已经积累了近20年的实践经验,不论是PostgreSQL本身还是社区生态都已经非常成熟。不仅是中小企业,很多大型的行业客户也会使用PostgreSQL搭建自己的数据库系统。这篇文章
在关系数据库领域,PostgreSQL是一款非常受欢迎的开源数据库软件。自1996年发布至今,已经积累了近20年的实践经验,不论是PostgreSQL本身还是社区生态都已经非常成熟。不仅是中小企业,很多大型的行业客户也会使用PostgreSQL搭建自己的数据库系统。这篇文章主要对PostgreSQL做一个介绍,并比较了在PCIe SSD(本文使用Memblaze的PBlaze4 PCIe SSD)和硬件RAID聚合的SAS磁盘两种环境下,PostgreSQL数据库的联机事务处理(OLTP)的性能。
PostgreSQL及参数配置
最新的PostgreSQL基于SQL2011标准编写,能够实现ACID、多版本并发控制、完全串行,和复杂语句查询等功能。此外,作为开源数据库,PostgreSQL还有很多第三方组织提供的插件,在扩展、数据库迁移等方面,PostgreSQL同样具有很大的优势。
操作系统支持方面,PostgreSQL支持Linux、FreeBSD,OS X,Solaris以及Windows等。在OS X中,PostgreSQL已经是缺省的数据库软件(Mac OS X 10.7 Lion服务器或者更高的版本)。主流的Linux版本也已经有相应的PostgreSQL支持包。
测试之前,我们将参数full_page_write=on,PostgreSQL服务器在检查点之后对页面的第一次写入时将整个页面写到 WAL 里面。这么做是因为当页面写入非易失介质的过程中,同时发生了操作系统崩溃,可能只有部分页面写入磁盘, 从而导致在同一个页面中包含新旧数据的混合。如果关闭full_page_writes,在崩溃后的恢复期间, 由于在WAL里面存储的行变化信息不够完整,因此无法完全恢复该页。存储完整的页面内容可以保证页面可以正确恢复,但这样做的缺点是增加了必须写入WAL中的数据量,更多的读写操作。
测试环境介绍
BenchmarkSQL是使用Java开发的TPCC基准测试的开源应用程序,它满足TPCC行业基准协会的要求。本次测试中的BenchmarkSQL通过模拟操作人员设定了1000个仓库,并模拟了5项业务,分别为新订单、付款、订单状态、发货和库存。
整体测试环境如下:
服务器: Dell PowerEdge R730xd, 2 Intel XeonE5-2620(6核)v3 CPU,32GB DRAM
存储设备 : 1 x Memblaze 1.6T PBlaze4 PCIe SSD
6* 600GB 15K + 1 * 300GB 15K HDD
LSI SAS-3 3008 RAID Fury
测试工具:Benchmarksql 4.1.1,PostgreSQL的TPC-C测试工具
pgcluu 2.4,PostgreSQL性能监测和稽核工具
软件: PostgreSQL 9.2.14
CentOS 7.1
测试前提条件
在测试之前,需要考虑以下操作:
1. 确保PBlaze4的分区有4KiB对齐,分区偏移量从1MiB开始。
2. 打开irqbalance服务,并设置CPU的使用模式为最大性能模式。
3. 调整操作系统内核参数,以匹配PostgreSQL。避免使用操作系统交换功能,并调整共享内存参数/文件系统脏页参数。如下所示:
vm.swappiness=0
kernel.shmmax=21474836480
net.core.rmem_max=4194304
net.core.wmem_max=4194304
kernel.sem=50100 64128000 50100 1280
vm.dirty_background_bytes=33554432
4. 使用XFS时,PostgreSQL的默认块大小为8KiB,但在当前Linux环境中,运行“mount xfs”会弹出“功能未实现”错误,因此应将块大小调整为4KiB。分配组数量的增加意味着可分配更多并行块和索引节点。nvme设备分区大小为1601GB,并设置agsize=2g。设置inode64/nobarrier/nolargeio/allocsize=16M作为挂载选项。
5. 设置PostgreSQL数据库群可以使用3/4的服务器物理内存,并且设置shared_buffer=6GB,最大连接=600。
6. 在Benchmarksql工具中配置1000仓库,并设置128个终端。
7. 预处理PBlaze4,并确保文件系统的可用容量低于50%。
测试结果
图1,IOPS和带宽在PBlaze4 PCIe SSD和RAID HDD下的表现
图1清楚地显示了在不同的存储介质情况下,IOPS和数据吞吐量的流量。对比测试结果,PBlaze4 PCIe SSD读写IOPS之和大约是RAID HDD读写IOPS之和的10倍,PBlaze4 PCIe SSD 读写吞吐量之和大约是RAID HDD读写吞吐量之和的8倍。
图2,不同存储介质状态下的读写平均响应时间
如图2所示,PBlaze4 PCIe SSD在整个测试过程中保持了稳定的响应时间。
从以上结果可见,Memblaze PBlaze4 PCIe SSD在PostgreSQL数据库联机事务处理测试中表现了出色。
图3,PBlaze4 PCIe SSD在测试过程中的功耗和温度
如图3所示,功耗和温度指标均证明PBlaze4 PCIe SSD具有稳定的交付状态。

如图4所示,每分钟处理事务总量(tpmC)包含5个事务模型。运行在PBlaze4 PCIe SSD 上的测试结果远远高于基于RAID HDD的测试结果。
结论
本测试清晰地显示出运行在Memblaze PBlaze4 PCIe SSD 上得到的出色联机事务测试结果,并且在测试过程中,PBlaze4 PCIe SSD 的功率和温度表现稳定。对于业务类型简单,数TiB级别的数据库系统,使用Memblaze PBlaze4 PCIe SSD 是一个替换传统专用存储系统,提升性能同时大幅度降低TCO的可行方案。
本文作者
武豪,Memblaze产品部AE。长期从事存储相关的系统集成工作,主要的研究方向包括主要研究逻辑卷、传统存储和关系数据库的IO路径优化等。

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



Users may have seen the term wapi when using the Internet, but for some people they definitely don’t know what wapi is. The following is a detailed introduction to help those who don’t know to understand. What is wapi: Answer: wapi is the infrastructure for wireless LAN authentication and confidentiality. This is like functions such as infrared and Bluetooth, which are generally covered near places such as office buildings. Basically they are owned by a small department, so the scope of this function is only a few kilometers. Related introduction to wapi: 1. Wapi is a transmission protocol in wireless LAN. 2. This technology can avoid the problems of narrow-band communication and enable better communication. 3. Only one code is needed to transmit the signal

If you see the error message Please power off and connect the PCIe power cable on your Windows 11/10 PC, please read this post to learn how to resolve the issue. This error can be triggered when a PCIe device (usually a graphics card) fails to receive enough power. Possible causes include a faulty PCIe power cable, connection issues, or insufficient power. This problem can also occur if the power cord is not connected correctly. Please turn off the power and connect the PCIE power cable(S) of this graphics card. First-time PC users or people who lack experience in assembling computer systems often encounter this problem. This error message may also occur if the PCIe cable becomes loose due to vibration or time. This article explains the steps you need to take to resolve this issue

Pubg, also known as PlayerUnknown's Battlegrounds, is a very classic shooting battle royale game that has attracted a lot of players since its popularity in 2016. After the recent launch of win11 system, many players want to play it on win11. Let's follow the editor to see if win11 can play pubg. Can win11 play pubg? Answer: Win11 can play pubg. 1. At the beginning of win11, because win11 needed to enable tpm, many players were banned from pubg. 2. However, based on player feedback, Blue Hole has solved this problem, and now you can play pubg normally in win11. 3. If you meet a pub

There are users on Douyin who shoot a lot of video works. Once there are too many video works, all kinds of excellent video works will be buried. The pinning function is very useful. So how do we pin our own video works? Next, the editor will bring you a graphic tutorial on how to pin your own videos on Douyin. Users who don’t know how to pin videos to the top should take a look. Tiktok usage tutorial: How to pin your own videos on Tiktok 1. First, we open Tiktok and click on me as shown in the picture in the lower right corner of the main interface. 2. Then after we enter the personal interface, find the video work you want to pin to the top, and click to play it. 3. Then in the video interface, click on the three-dot option in the lower right corner as shown in the picture. 4. Finally, we click on the top button in the new pop-up window to return to the personal world.

How to check SSD health status in Windows 11? For their fast read, write, and access speeds, SSDs are quickly replacing HDDs, but even though they are more reliable, you still need to check the health of your SSDs in Windows 11. How to operate it? In this tutorial, the editor will share with you the method. Method 1: Use WMIC1, use the key combination Win+R, type wmic, and then press or click OK. Enter2. Now, type or paste the following command to check the SSD health status: diskdrivegetstatus If you receive the "Status: OK" message, your SSD drive is operating normally.

After updating to the latest win11, many users find that the sound of their system has changed slightly, but they don’t know how to adjust it. So today, this site brings you an introduction to the latest win11 sound adjustment method for your computer. It is not difficult to operate. And the choices are diverse, come and download and try them out. How to adjust the sound of the latest computer system Windows 11 1. First, right-click the sound icon in the lower right corner of the desktop and select "Playback Settings". 2. Then enter settings and click "Speaker" in the playback bar. 3. Then click "Properties" on the lower right. 4. Click the "Enhance" option bar in the properties. 5. At this time, if the √ in front of "Disable all sound effects" is checked, cancel it. 6. After that, you can select the sound effects below to set and click

According to news from this site on August 12, Kingston NV3M.2 SSD is currently on sale on JD.com. The SSD is available in 512GB (500GB)/1TB/2TB versions (the 4TB version is not on the shelves). Its main reading speed is 5000MB/s. The price information compiled by the website is as follows: 512GB: 319 yuan 1TB: 449 yuan 2TB: 929 yuan Kingston NV3 adopts single-sided M.22280 size, suitable for laptops, equipped with PCIe4.0x4 controller, the read and write speeds of this website are as follows: 512GB: 5000 /3000MB/s1TB: 6000/4000MB/s2TB: 6000/5000MB/s Kingston will provide a 3-year limited warranty for NV3 SSDs

PyCharm is a powerful Python integrated development environment with rich functions and tools that can greatly improve development efficiency. Among them, the replacement function is one of the functions frequently used in the development process, which can help developers quickly modify the code and improve the code quality. This article will introduce PyCharm's replacement function in detail, combined with specific code examples, to help novices better master and use this function. Introduction to the replacement function PyCharm's replacement function can help developers quickly replace specified text in the code
