|
|
<!doctype html>
|
|
|
<html class="no-js" lang="tw">
|
|
|
<head>
|
|
|
<meta charset="utf-8">
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
|
<meta name="author" content="Eric Chang">
|
|
|
<meta name="description" content="What’s the Worst That Could Happen?">
|
|
|
<meta name="keywords" content="linux,blog,responsive,search,font awesome,pages,posts,multilingual,highlight.js,syntax highlighting,premium,shortcuts">
|
|
|
<meta content="USB 3.1 Gen2 NVME SSD, NVME SSD, benchmark" name="keywords">
|
|
|
<meta name="generator" content="Hugo 0.50" />
|
|
|
<title> [筆記] 測試 USB 3.1 Gen2 NVME SSD 外接盒 & 內建pci-e ssd & 外接SATA SSD / Bencmark With External Internal Nvme Ssd and External Sata Ssd | MCの飄狂山莊㊣</title>
|
|
|
<meta name="description" content="[筆記] 測試 USB 3.1 Gen2 NVME SSD 外接盒 & 內建pci-e ssd & 外接SATA SSD / Bencmark With External Internal Nvme Ssd and External Sata Ssd - What’s the Worst That Could Happen?">
|
|
|
<meta itemprop="name" content="[筆記] 測試 USB 3.1 Gen2 NVME SSD 外接盒 & 內建pci-e ssd & 外接SATA SSD / Bencmark With External Internal Nvme Ssd and External Sata Ssd">
|
|
|
<meta itemprop="description" content="[筆記] 測試 USB 3.1 Gen2 NVME SSD 外接盒 & 內建pci-e ssd & 外接SATA SSD / Bencmark With External Internal Nvme Ssd and External Sata Ssd - What’s the Worst That Could Happen?">
|
|
|
<meta property="og:title" content="[筆記] 測試 USB 3.1 Gen2 NVME SSD 外接盒 & 內建pci-e ssd & 外接SATA SSD / Bencmark With External Internal Nvme Ssd and External Sata Ssd">
|
|
|
<meta property="og:description" content="[筆記] 測試 USB 3.1 Gen2 NVME SSD 外接盒 & 內建pci-e ssd & 外接SATA SSD / Bencmark With External Internal Nvme Ssd and External Sata Ssd - What’s the Worst That Could Happen?">
|
|
|
<meta property="og:image" content="https://h.cowbay.org/images/post-default-11.jpg">
|
|
|
<meta property="og:url" content="https://h.cowbay.org/post/bencmark-with-external-internal-nvme-ssd-and-external-sata-ssd/">
|
|
|
<meta property="og:site_name" content="MCの飄狂山莊㊣">
|
|
|
<meta property="og:type" content="article">
|
|
|
<link rel="icon" type="image/png" href="https://h.cowbay.org/favicon-32x32.png" sizes="32x32">
|
|
|
<link rel="icon" type="image/png" href="https://h.cowbay.org/favicon-16x16.png" sizes="16x16">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<link rel="stylesheet" href="https://h.cowbay.org/sass/combined.min.a89dfa577f701bffe9659f476ef61241cb2a3452b913e793463b0074a10c0a59.css">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
|
|
|
|
|
|
|
|
|
</head>
|
|
|
<body class="bilberry-hugo-theme">
|
|
|
|
|
|
<nav class="permanentTopNav">
|
|
|
|
|
|
<div class="container">
|
|
|
<ul class="topnav">
|
|
|
|
|
|
</ul>
|
|
|
|
|
|
|
|
|
<div id="search-box" class="search">
|
|
|
<i class="fa fa-search"></i>
|
|
|
<input id="search" type="text" placeholder="">
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
</nav>
|
|
|
|
|
|
|
|
|
<header>
|
|
|
<div class="container">
|
|
|
<div class="logo">
|
|
|
<a href="/" class="logo">
|
|
|
|
|
|
<img src="https://www.gravatar.com/avatar/e4eb1f8e016ffb73e9889f87d16e15f0?d=mm&size=200" alt="">
|
|
|
|
|
|
|
|
|
<span class="overlay"><i class="fa fa-home"></i></span>
|
|
|
</a>
|
|
|
</div>
|
|
|
<div class="titles">
|
|
|
<h3 class="title"><a href="/">MCの飄狂山莊㊣</a></h3>
|
|
|
|
|
|
<span class="subtitle">What’s the Worst That Could Happen?</span>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<div class="toggler permanentTopNav">
|
|
|
|
|
|
<i class="fa fa-bars" aria-hidden="true"></i>
|
|
|
</div>
|
|
|
</div>
|
|
|
</header>
|
|
|
|
|
|
|
|
|
<div class="main container">
|
|
|
|
|
|
|
|
|
<div class="article-wrapper u-cf single">
|
|
|
|
|
|
<a class="bubble" href="/post/bencmark-with-external-internal-nvme-ssd-and-external-sata-ssd/">
|
|
|
<i class="fa fa-fw fa-pencil"></i>
|
|
|
</a>
|
|
|
|
|
|
<article class="default article">
|
|
|
|
|
|
<div class="featured-image">
|
|
|
<a href="/post/bencmark-with-external-internal-nvme-ssd-and-external-sata-ssd/">
|
|
|
<img src="/images/post-default-11.jpg" alt="">
|
|
|
</a>
|
|
|
</div>
|
|
|
|
|
|
|
|
|
<div class="content">
|
|
|
<h3><a href="/post/bencmark-with-external-internal-nvme-ssd-and-external-sata-ssd/">[筆記] 測試 USB 3.1 Gen2 NVME SSD 外接盒 & 內建pci-e ssd & 外接SATA SSD / Bencmark With External Internal Nvme Ssd and External Sata Ssd</a></h3>
|
|
|
<div class="meta">
|
|
|
|
|
|
|
|
|
<span class="date moment">2019-09-10</span>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<span class="categories">
|
|
|
|
|
|
<a href="/categories/%E7%AD%86%E8%A8%98">筆記</a>
|
|
|
|
|
|
</span>
|
|
|
|
|
|
|
|
|
|
|
|
<span class="author"><a href="/author/eric-chang">Eric Chang</a></span>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
<p>前幾天在淘寶上買了個 SSK 的USB 3.1 Gen2 (type-c) NVME SSD 外接盒
|
|
|
手邊也剛好有一條多的intel 600p nvme ssd 就順手來做個比較
|
|
|
目標是看看有沒有可能直接用外接的SSD來跑postgresql</p>
|
|
|
|
|
|
<p>
|
|
|
把600p 裝進去外接盒之後,就先來看一些簡單的資訊
|
|
|
不過沒想到用了幾個指令,都沒辦法辨別出正確的型號</p>
|
|
|
|
|
|
<h4 id="fdisk">fdisk</h4>
|
|
|
|
|
|
<p>沒有看到廠牌、型號</p>
|
|
|
|
|
|
<pre><code>2019-09-10 13:20:55 [minion@hqdc075 ~]$ sudo fdisk /dev/sdb
|
|
|
|
|
|
Welcome to fdisk (util-linux 2.31.1).
|
|
|
Changes will remain in memory only, until you decide to write them.
|
|
|
Be careful before using the write command.
|
|
|
|
|
|
Command (m for help): p
|
|
|
Disk /dev/sdb: 238.5 GiB, 256060514304 bytes, 500118192 sectors
|
|
|
Units: sectors of 1 * 512 = 512 bytes
|
|
|
Sector size (logical/physical): 512 bytes / 4096 bytes
|
|
|
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
|
|
|
Disklabel type: dos
|
|
|
Disk identifier: 0x59511d8e
|
|
|
|
|
|
Device Boot Start End Sectors Size Id Type
|
|
|
/dev/sdb1 2048 500118191 500116144 238.5G 83 Linux
|
|
|
|
|
|
Command (m for help): q
|
|
|
</code></pre>
|
|
|
|
|
|
<h4 id="inxi">inxi</h4>
|
|
|
|
|
|
<p>內接的intel ssd 有看到,不過外接的這顆SSD沒有model 可是可以看到序號
|
|
|
我在想這個序號應該是外接盒的序號,而不是SSD的?</p>
|
|
|
|
|
|
<pre><code>2019-09-10 13:21:51 [minion@hqdc075 ~]$ sudo inxi -Dxx
|
|
|
Drives: HDD Total Size: 640.2GB (11.3% used)
|
|
|
ID-1: /dev/nvme0n1 model: INTEL_SSDPEKKF256G7L size: 256.1GB serial: BTPYXXXXX firmware: 123P
|
|
|
ID-2: USB /dev/sda model: SD/MMC size: 128.1GB serial: 201205XXXXXX-0:0 temp: 0C
|
|
|
ID-3: USB /dev/sdb model: N/A size: 256.1GB serial: DF564XXXXXX:0 temp: 0C
|
|
|
2019-09-10 13:21:55 [minion@hqdc075 ~]$
|
|
|
</code></pre>
|
|
|
|
|
|
<h4 id="dmesg">dmesg</h4>
|
|
|
|
|
|
<p>一樣,也是認不出 SSD ,但是有抓到外接盒</p>
|
|
|
|
|
|
<pre><code>[16622.930915] hub 4-0:1.0: USB hub found
|
|
|
[16622.930926] hub 4-0:1.0: 2 ports detected
|
|
|
[16623.372533] usb 4-1: new SuperSpeedPlus Gen 2 USB device number 2 using xhci_hcd
|
|
|
[16623.393844] usb 4-1: New USB device found, idVendor=152d, idProduct=0562, bcdDevice= 2.04
|
|
|
[16623.393849] usb 4-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
|
|
|
[16623.393853] usb 4-1: Product: SSK Storage
|
|
|
[16623.393856] usb 4-1: Manufacturer: SSK
|
|
|
[16623.393858] usb 4-1: SerialNumber: DF56419883B20
|
|
|
</code></pre>
|
|
|
|
|
|
<h4 id="直接測試吧">直接測試吧</h4>
|
|
|
|
|
|
<p>不看型號了,直接測試吧!先切好分割、格式化,然後掛載到 /mnt,再用 dd 測試寫入
|
|
|
結果如下</p>
|
|
|
|
|
|
<pre><code>2019-09-10 13:24:03 [minion@hqdc075 ~]$ for i in {4,8,16,32,64,128,256,512,1024,2048,4096,8192,16384};do sudo dd if=/dev/zero of=/mnt/"$i"k bs="$i"k count=1k;done
|
|
|
1024+0 records in
|
|
|
1024+0 records out
|
|
|
4194304 bytes (4.2 MB, 4.0 MiB) copied, 0.013719 s, 306 MB/s
|
|
|
1024+0 records in
|
|
|
1024+0 records out
|
|
|
8388608 bytes (8.4 MB, 8.0 MiB) copied, 0.0123268 s, 681 MB/s
|
|
|
1024+0 records in
|
|
|
1024+0 records out
|
|
|
16777216 bytes (17 MB, 16 MiB) copied, 0.0196891 s, 852 MB/s
|
|
|
1024+0 records in
|
|
|
1024+0 records out
|
|
|
33554432 bytes (34 MB, 32 MiB) copied, 0.0195221 s, 1.7 GB/s
|
|
|
1024+0 records in
|
|
|
1024+0 records out
|
|
|
67108864 bytes (67 MB, 64 MiB) copied, 0.0337692 s, 2.0 GB/s
|
|
|
1024+0 records in
|
|
|
1024+0 records out
|
|
|
134217728 bytes (134 MB, 128 MiB) copied, 0.0644939 s, 2.1 GB/s
|
|
|
1024+0 records in
|
|
|
1024+0 records out
|
|
|
268435456 bytes (268 MB, 256 MiB) copied, 0.131989 s, 2.0 GB/s
|
|
|
1024+0 records in
|
|
|
1024+0 records out
|
|
|
536870912 bytes (537 MB, 512 MiB) copied, 0.257682 s, 2.1 GB/s
|
|
|
1024+0 records in
|
|
|
1024+0 records out
|
|
|
1073741824 bytes (1.1 GB, 1.0 GiB) copied, 0.529154 s, 2.0 GB/s
|
|
|
1024+0 records in
|
|
|
1024+0 records out
|
|
|
2147483648 bytes (2.1 GB, 2.0 GiB) copied, 3.48498 s, 616 MB/s
|
|
|
1024+0 records in
|
|
|
1024+0 records out
|
|
|
4294967296 bytes (4.3 GB, 4.0 GiB) copied, 7.36899 s, 583 MB/s
|
|
|
1024+0 records in
|
|
|
1024+0 records out
|
|
|
8589934592 bytes (8.6 GB, 8.0 GiB) copied, 73.1975 s, 117 MB/s
|
|
|
1024+0 records in
|
|
|
1024+0 records out
|
|
|
17179869184 bytes (17 GB, 16 GiB) copied, 153.142 s, 112 MB/s
|
|
|
2019-09-10 13:28:58 [minion@hqdc075 ~]$
|
|
|
</code></pre>
|
|
|
|
|
|
<p>可以發現,<strong>當寫入8G檔案的時候,速度開始急遽下降</strong>
|
|
|
翻了一下google 看到這張表格</p>
|
|
|
|
|
|
<p><a href="https://www.anandtech.com/show/10850/the-intel-ssd-600p-512gb-review">https://www.anandtech.com/show/10850/the-intel-ssd-600p-512gb-review</a></p>
|
|
|
|
|
|
<p>intel 600p 256G 的SLC Cache 只有8.5GB
|
|
|
合理解釋了為什麼當寫入8G的檔案時,速度會掉那麼慘,跟SATA硬碟差不多了</p>
|
|
|
|
|
|
<h4 id="用iobench-測試看看">用iobench 測試看看</h4>
|
|
|
|
|
|
<p>得到一樣的結論,8G左右,就會把cache塞暴,然後掉速</p>
|
|
|
|
|
|
<pre><code>2019-09-10 13:44:59 [changch@hqdc075 iobench]$ sudo ./iobench.sh --sync --dir /mnt --megabytes 8192
|
|
|
Target directory: /mnt
|
|
|
Testfile size: 8192 x 1 Megabyte
|
|
|
|
|
|
1. Write benchmark without cache
|
|
|
8589934592 bytes (8.6 GB, 8.0 GiB) copied, 36.8695 s, 233 MB/s
|
|
|
|
|
|
2. Write benchmark with cache
|
|
|
8589934592 bytes (8.6 GB, 8.0 GiB) copied, 64.1573 s, 134 MB/s
|
|
|
|
|
|
3. Read benchmark with dropped cache
|
|
|
8589934592 bytes (8.6 GB, 8.0 GiB) copied, 9.21821 s, 932 MB/s
|
|
|
|
|
|
4. Read benchmark without cache drop
|
|
|
|
|
|
Start 1 of 5...
|
|
|
8589934592 bytes (8.6 GB, 8.0 GiB) copied, 1.02253 s, 8.4 GB/s
|
|
|
|
|
|
Start 2 of 5...
|
|
|
8589934592 bytes (8.6 GB, 8.0 GiB) copied, 0.832002 s, 10.3 GB/s
|
|
|
|
|
|
Start 3 of 5...
|
|
|
8589934592 bytes (8.6 GB, 8.0 GiB) copied, 0.81194 s, 10.6 GB/s
|
|
|
|
|
|
Start 4 of 5...
|
|
|
8589934592 bytes (8.6 GB, 8.0 GiB) copied, 0.821035 s, 10.5 GB/s
|
|
|
|
|
|
Start 5 of 5...
|
|
|
8589934592 bytes (8.6 GB, 8.0 GiB) copied, 0.808803 s, 10.6 GB/s
|
|
|
|
|
|
Done.
|
|
|
2019-09-10 13:47:40 [changch@hqdc075 iobench]$
|
|
|
</code></pre>
|
|
|
|
|
|
<p>那如果不用8G的檔案大小來測試呢?看起來是比較正常一點</p>
|
|
|
|
|
|
<pre><code>2019-09-10 13:47:40 [changch@hqdc075 iobench]$ sudo ./iobench.sh --sync --dir /mnt --megabytes 4096
|
|
|
Target directory: /mnt
|
|
|
Testfile size: 4096 x 1 Megabyte
|
|
|
|
|
|
1. Write benchmark without cache
|
|
|
4294967296 bytes (4.3 GB, 4.0 GiB) copied, 7.55296 s, 569 MB/s
|
|
|
|
|
|
2. Write benchmark with cache
|
|
|
4294967296 bytes (4.3 GB, 4.0 GiB) copied, 20.6237 s, 208 MB/s
|
|
|
|
|
|
3. Read benchmark with dropped cache
|
|
|
4294967296 bytes (4.3 GB, 4.0 GiB) copied, 4.63622 s, 926 MB/s
|
|
|
|
|
|
4. Read benchmark without cache drop
|
|
|
|
|
|
Start 1 of 5...
|
|
|
4294967296 bytes (4.3 GB, 4.0 GiB) copied, 0.518597 s, 8.3 GB/s
|
|
|
|
|
|
Start 2 of 5...
|
|
|
4294967296 bytes (4.3 GB, 4.0 GiB) copied, 0.436877 s, 9.8 GB/s
|
|
|
|
|
|
Start 3 of 5...
|
|
|
4294967296 bytes (4.3 GB, 4.0 GiB) copied, 0.437854 s, 9.8 GB/s
|
|
|
|
|
|
Start 4 of 5...
|
|
|
4294967296 bytes (4.3 GB, 4.0 GiB) copied, 0.420224 s, 10.2 GB/s
|
|
|
|
|
|
Start 5 of 5...
|
|
|
4294967296 bytes (4.3 GB, 4.0 GiB) copied, 0.431023 s, 10.0 GB/s
|
|
|
|
|
|
Done.
|
|
|
2019-09-10 13:50:09 [changch@hqdc075 iobench]$
|
|
|
</code></pre>
|
|
|
|
|
|
<h4 id="跑看看pgbench">跑看看pgbench ??</h4>
|
|
|
|
|
|
<p>試試看這次的目標,用 external nvme ssd 跑資料庫,會不會跟放在本機的PCI-E SSD 有所差距?</p>
|
|
|
|
|
|
<h4 id="data-directory-in-internal-pcie-ssd">data_directory in internal pcie-ssd</h4>
|
|
|
|
|
|
<p><strong>initialize pgbench database</strong></p>
|
|
|
|
|
|
<pre><code>2019-09-10 13:52:35 [minion@hqdc075 ~]$ sudo su - postgres
|
|
|
postgres@hqdc075:~$ createdb pgbench
|
|
|
postgres@hqdc075:~$ pgbench -i -U postgres -s 10 pgbench
|
|
|
NOTICE: table "pgbench_history" does not exist, skipping
|
|
|
NOTICE: table "pgbench_tellers" does not exist, skipping
|
|
|
NOTICE: table "pgbench_accounts" does not exist, skipping
|
|
|
NOTICE: table "pgbench_branches" does not exist, skipping
|
|
|
creating tables...
|
|
|
100000 of 1000000 tuples (10%) done (elapsed 0.08 s, remaining 0.70 s)
|
|
|
200000 of 1000000 tuples (20%) done (elapsed 0.19 s, remaining 0.75 s)
|
|
|
300000 of 1000000 tuples (30%) done (elapsed 0.36 s, remaining 0.83 s)
|
|
|
400000 of 1000000 tuples (40%) done (elapsed 0.49 s, remaining 0.73 s)
|
|
|
500000 of 1000000 tuples (50%) done (elapsed 0.58 s, remaining 0.58 s)
|
|
|
600000 of 1000000 tuples (60%) done (elapsed 0.75 s, remaining 0.50 s)
|
|
|
700000 of 1000000 tuples (70%) done (elapsed 0.89 s, remaining 0.38 s)
|
|
|
800000 of 1000000 tuples (80%) done (elapsed 0.99 s, remaining 0.25 s)
|
|
|
900000 of 1000000 tuples (90%) done (elapsed 1.11 s, remaining 0.12 s)
|
|
|
1000000 of 1000000 tuples (100%) done (elapsed 1.27 s, remaining 0.00 s)
|
|
|
vacuum...
|
|
|
set primary keys...
|
|
|
done.
|
|
|
</code></pre>
|
|
|
|
|
|
<p><strong>run pgbench</strong></p>
|
|
|
|
|
|
<pre><code>postgres@hqdc075:~$ pgbench -t 10 -c 100 -S -U postgres pgbench
|
|
|
starting vacuum...end.
|
|
|
transaction type: <builtin: select only>
|
|
|
scaling factor: 10
|
|
|
query mode: simple
|
|
|
number of clients: 100
|
|
|
number of threads: 1
|
|
|
number of transactions per client: 10
|
|
|
number of transactions actually processed: 1000/1000
|
|
|
latency average = 32.118 ms
|
|
|
tps = 3113.559459 (including connections establishing)
|
|
|
tps = 3135.056341 (excluding connections establishing)
|
|
|
postgres@hqdc075:~$ pgbench -t 1000 -c 100 -S -U postgres pgbench
|
|
|
starting vacuum...end.
|
|
|
transaction type: <builtin: select only>
|
|
|
scaling factor: 10
|
|
|
query mode: simple
|
|
|
number of clients: 100
|
|
|
number of threads: 1
|
|
|
number of transactions per client: 1000
|
|
|
number of transactions actually processed: 100000/100000
|
|
|
latency average = 3.753 ms
|
|
|
tps = 26643.223990 (including connections establishing)
|
|
|
tps = 26659.061459 (excluding connections establishing)
|
|
|
</code></pre>
|
|
|
|
|
|
<h4 id="data-directory-in-external-nvme-ssd">data_directory in external NVME SSD</h4>
|
|
|
|
|
|
<p><strong>initialize pgbench database</strong></p>
|
|
|
|
|
|
<pre><code>postgres@hqdc075:~$ pgbench -i -U postgres -s 10 pgbench
|
|
|
creating tables...
|
|
|
100000 of 1000000 tuples (10%) done (elapsed 0.08 s, remaining 0.70 s)
|
|
|
200000 of 1000000 tuples (20%) done (elapsed 0.19 s, remaining 0.76 s)
|
|
|
300000 of 1000000 tuples (30%) done (elapsed 0.35 s, remaining 0.81 s)
|
|
|
400000 of 1000000 tuples (40%) done (elapsed 0.49 s, remaining 0.74 s)
|
|
|
500000 of 1000000 tuples (50%) done (elapsed 0.60 s, remaining 0.60 s)
|
|
|
600000 of 1000000 tuples (60%) done (elapsed 0.76 s, remaining 0.51 s)
|
|
|
700000 of 1000000 tuples (70%) done (elapsed 0.89 s, remaining 0.38 s)
|
|
|
800000 of 1000000 tuples (80%) done (elapsed 1.01 s, remaining 0.25 s)
|
|
|
900000 of 1000000 tuples (90%) done (elapsed 1.15 s, remaining 0.13 s)
|
|
|
1000000 of 1000000 tuples (100%) done (elapsed 1.32 s, remaining 0.00 s)
|
|
|
vacuum...
|
|
|
set primary keys...
|
|
|
done.
|
|
|
</code></pre>
|
|
|
|
|
|
<p><strong>run pgbench</strong>
|
|
|
可以看到兩邊的結果其實是差不多的,作為資料庫備份是一定沒有問題
|
|
|
至於能不能直接作為資料庫空間使用?我想也許可以嘗試看看..</p>
|
|
|
|
|
|
<pre><code>postgres@hqdc075:~$ pgbench -t 10 -c 100 -S -U postgres pgbench
|
|
|
starting vacuum...end.
|
|
|
transaction type: <builtin: select only>
|
|
|
scaling factor: 10
|
|
|
query mode: simple
|
|
|
number of clients: 100
|
|
|
number of threads: 1
|
|
|
number of transactions per client: 10
|
|
|
number of transactions actually processed: 1000/1000
|
|
|
latency average = 32.998 ms
|
|
|
tps = 3030.531670 (including connections establishing)
|
|
|
tps = 3051.744292 (excluding connections establishing)
|
|
|
postgres@hqdc075:~$ pgbench -t 1000 -c 100 -S -U postgres pgbench
|
|
|
starting vacuum...end.
|
|
|
transaction type: <builtin: select only>
|
|
|
scaling factor: 10
|
|
|
query mode: simple
|
|
|
number of clients: 100
|
|
|
number of threads: 1
|
|
|
number of transactions per client: 1000
|
|
|
number of transactions actually processed: 100000/100000
|
|
|
latency average = 3.758 ms
|
|
|
tps = 26610.771423 (including connections establishing)
|
|
|
tps = 26626.871871 (excluding connections establishing)
|
|
|
postgres@hqdc075:~$
|
|
|
</code></pre>
|
|
|
|
|
|
<p>update:</p>
|
|
|
|
|
|
<p>剛剛看了一下,發現這樣只有測試到 read (select only)
|
|
|
或許要找找看其他的測試方法</p>
|
|
|
|
|
|
<hr />
|
|
|
|
|
|
<p>接下來直接用 restore 測試</p>
|
|
|
|
|
|
<pre><code>#### restore 5G database with external nvme ssd
|
|
|
postgres@hqdc075:~$ createdb demo
|
|
|
postgres@hqdc075:~$ time psql demo < /tmp/demo.sql
|
|
|
SET
|
|
|
...
|
|
|
ALTER TABLE
|
|
|
|
|
|
real 4m1.184s
|
|
|
user 0m2.894s
|
|
|
sys 0m0.504s
|
|
|
postgres@hqdc075:~$
|
|
|
</code></pre>
|
|
|
|
|
|
<h4 id="restore-5g-database-with-internal-pci-e-nvme-ssd">restore 5G database with internal pci-e nvme ssd</h4>
|
|
|
|
|
|
<pre><code>postgres@hqdc075:~$ dropdb demo
|
|
|
postgres@hqdc075:~$ createdb demo
|
|
|
postgres@hqdc075:~$ time psql demo < /tmp/demo.sql
|
|
|
SET
|
|
|
...
|
|
|
ALTER TABLE
|
|
|
|
|
|
real 4m1.636s
|
|
|
user 0m2.909s
|
|
|
sys 0m0.612s
|
|
|
postgres@hqdc075:~$
|
|
|
</code></pre>
|
|
|
|
|
|
<p>看起來是沒有什麼區別,那如果是外接的 SATA SSD呢?</p>
|
|
|
|
|
|
<hr />
|
|
|
|
|
|
<p>dmesg 看得到型號耶..</p>
|
|
|
|
|
|
<pre><code>[23995.478928] usb 2-4: new SuperSpeed Gen 1 USB device number 3 using xhci_hcd
|
|
|
[23995.506134] usb 2-4: New USB device found, idVendor=2109, idProduct=0715, bcdDevice= 3.36
|
|
|
[23995.506141] usb 2-4: New USB device strings: Mfr=1, Product=2, SerialNumber=3
|
|
|
[23995.506145] usb 2-4: Product: 30848
|
|
|
[23995.506149] usb 2-4: Manufacturer: Ugreen
|
|
|
[23995.506153] usb 2-4: SerialNumber: 00000012526D
|
|
|
[23995.512813] scsi host2: uas
|
|
|
[23995.530161] scsi 2:0:0:0: Direct-Access SanDisk SDSSDXP240G R131 PQ: 0 ANSI: 6
|
|
|
[23995.531948] sd 2:0:0:0: Attached scsi generic sg2 type 0
|
|
|
[23995.533820] sd 2:0:0:0: [sdc] 468862128 512-byte logical blocks: (240 GB/224 GiB)
|
|
|
[23995.533986] sd 2:0:0:0: [sdc] Write Protect is off
|
|
|
[23995.533992] sd 2:0:0:0: [sdc] Mode Sense: 2f 00 00 00
|
|
|
[23995.534402] sd 2:0:0:0: [sdc] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
|
|
|
[23995.534844] sd 2:0:0:0: [sdc] Optimal transfer size 33553920 bytes
|
|
|
[23995.540806] sdc:
|
|
|
[23995.544089] sd 2:0:0:0: [sdc] Attached SCSI disk
|
|
|
2019-09-10 14:24:54 [minion@hqdc075 ~]$
|
|
|
</code></pre>
|
|
|
|
|
|
<p><strong>restore 5G database with external sata SSD</strong></p>
|
|
|
|
|
|
<p>很意外的,速度居然還是差不多??</p>
|
|
|
|
|
|
<pre><code>postgres@hqdc075:~$ createdb demo
|
|
|
postgres@hqdc075:~$ time psql demo < /tmp/demo.sql
|
|
|
SET
|
|
|
...
|
|
|
ALTER TABLE
|
|
|
|
|
|
real 4m9.950s
|
|
|
user 0m2.752s
|
|
|
sys 0m0.640s
|
|
|
postgres@hqdc075:~$
|
|
|
</code></pre>
|
|
|
|
|
|
<p><strong>run pgebnech</strong></p>
|
|
|
|
|
|
<p>這個差很多了,tps 從前面的 26000 掉到剩下 2800 ,差十倍左右!</p>
|
|
|
|
|
|
<pre><code>postgres@hqdc075:~$ pgbench -t 10 -c 100 -S -U postgres pgbench
|
|
|
starting vacuum...end.
|
|
|
transaction type: <builtin: select only>
|
|
|
scaling factor: 10
|
|
|
query mode: simple
|
|
|
number of clients: 100
|
|
|
number of threads: 1
|
|
|
number of transactions per client: 10
|
|
|
number of transactions actually processed: 1000/1000
|
|
|
latency average = 35.267 ms
|
|
|
tps = 2835.526770 (including connections establishing)
|
|
|
tps = 2855.642604 (excluding connections establishing)
|
|
|
postgres@hqdc075:~$
|
|
|
</code></pre>
|
|
|
|
|
|
<p>疑問:</p>
|
|
|
|
|
|
<ol>
|
|
|
<li>什麼原因會讓外接/內建 nvme ssd 和外接SATA SSD 在 restore db時,花了差不多時間,但是 tps 差異那麼大呢?</li>
|
|
|
<li>這樣測試,似乎沒有真正測出外接nvme ssd 跑資料庫時候的效能?</li>
|
|
|
</ol>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
<div class="footer">
|
|
|
|
|
|
|
|
|
|
|
|
<div class="tags">
|
|
|
<i class="fa fa-tags"></i>
|
|
|
<div class="links">
|
|
|
|
|
|
<a href="/tags/postgresql">postgresql</a>
|
|
|
|
|
|
<a href="/tags/benchmark">benchmark</a>
|
|
|
|
|
|
<a href="/tags/nvme">nvme</a>
|
|
|
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</article>
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
<div id="disqus_thread"></div>
|
|
|
<script type="application/javascript">
|
|
|
var disqus_config = function () {
|
|
|
|
|
|
|
|
|
|
|
|
};
|
|
|
(function() {
|
|
|
if (["localhost", "127.0.0.1"].indexOf(window.location.hostname) != -1) {
|
|
|
document.getElementById('disqus_thread').innerHTML = 'Disqus comments not available by default when the website is previewed locally.';
|
|
|
return;
|
|
|
}
|
|
|
var d = document, s = d.createElement('script'); s.async = true;
|
|
|
s.src = '//' + "h-cowbay-org-1" + '.disqus.com/embed.js';
|
|
|
s.setAttribute('data-timestamp', +new Date());
|
|
|
(d.head || d.body).appendChild(s);
|
|
|
})();
|
|
|
</script>
|
|
|
<noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
|
|
|
<a href="https://disqus.com" class="dsq-brlink">comments powered by <span class="logo-disqus">Disqus</span></a>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
<footer>
|
|
|
<div class="container">
|
|
|
|
|
|
|
|
|
<div class="recent-posts">
|
|
|
<strong></strong>
|
|
|
<ul>
|
|
|
|
|
|
<li>
|
|
|
<a href="/post/recommended-ulauncher-in-ubuntu-1804/">[推薦] ulauncher ubuntu 18.04 底下,好用的 app launcher / Recommended Ulauncher in Ubuntu 1804</a>
|
|
|
</li>
|
|
|
|
|
|
<li>
|
|
|
<a href="/post/pg_auto_failover_in_ubuntu_1804_psql_11/">[筆記] 在ubuntu 18.04安裝psql 11 以及 pg_auto_failover / install psql 11 and pg_auto_failover in ubuntu 18.04</a>
|
|
|
</li>
|
|
|
|
|
|
<li>
|
|
|
<a href="/post/bencmark-with-external-internal-nvme-ssd-and-external-sata-ssd/">[筆記] 測試 USB 3.1 Gen2 NVME SSD 外接盒 & 內建pci-e ssd & 外接SATA SSD / Bencmark With External Internal Nvme Ssd and External Sata Ssd</a>
|
|
|
</li>
|
|
|
|
|
|
<li>
|
|
|
<a href="/post/postgresql-backup-restore-using-zfs-snapshot/">[筆記] 用zfs的snapshot 快照功能來做 postgresql 的備份還原 / Postgresql Backup Restore Using Zfs Snapshot</a>
|
|
|
</li>
|
|
|
|
|
|
<li>
|
|
|
<a href="/post/backup-restore-postgresql-with-pgbackrest/">[筆記] 用pbackrest 備份還原 postgresql / Backup Restore Postgresql With Pgbackrest</a>
|
|
|
</li>
|
|
|
|
|
|
<li>
|
|
|
<a href="/post/pgbarman-in-ubuntu-1804-postgresql-10-via-ssh/">[筆記] 在Ubuntu 18.04 下 透過 pgbarman rsync/ssh backup 備份 postgresql 10 / backup postgresql 10 with pgbarman via ssh/rsync in ubuntu 18.04</a>
|
|
|
</li>
|
|
|
|
|
|
<li>
|
|
|
<a href="/post/pgbarman-in-ubuntu-1804-postgresql-10/">[筆記] 在Ubuntu 18.04 下 透過 pgbarman streaming backup 備份 postgresql 10/ backup postgresql 10 with pgbarman straming backup in ubuntu 18.04</a>
|
|
|
</li>
|
|
|
|
|
|
</ul>
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<div class="categories">
|
|
|
<a href="/categories/"><strong></strong></a>
|
|
|
<ul>
|
|
|
|
|
|
<li>
|
|
|
<a href="/categories/%E7%AD%86%E8%A8%98">筆記 (31)</a>
|
|
|
</li>
|
|
|
|
|
|
<li>
|
|
|
<a href="/categories/ansible">Ansible (3)</a>
|
|
|
</li>
|
|
|
|
|
|
<li>
|
|
|
<a href="/categories/"> (1)</a>
|
|
|
</li>
|
|
|
|
|
|
<li>
|
|
|
<a href="/categories/linux">Linux (1)</a>
|
|
|
</li>
|
|
|
|
|
|
<li>
|
|
|
<a href="/categories/proxmox">Proxmox (1)</a>
|
|
|
</li>
|
|
|
|
|
|
<li>
|
|
|
<a href="/categories/ps">Ps (1)</a>
|
|
|
</li>
|
|
|
|
|
|
<li>
|
|
|
<a href="/categories/%E7%A2%8E%E5%BF%B5">碎念 (1)</a>
|
|
|
</li>
|
|
|
|
|
|
</ul>
|
|
|
</div>
|
|
|
|
|
|
|
|
|
<div class="right">
|
|
|
|
|
|
<div class="external-profiles">
|
|
|
<strong></strong>
|
|
|
|
|
|
|
|
|
<a href="https://www.facebook.com/mariahchang" target="_blank"><i class="fa fa-facebook-adblock-proof"></i></a>
|
|
|
|
|
|
|
|
|
<a href="https://twitter.com/changchichung" target="_blank"><i class="fa fa-twitter-adblock-proof"></i></a>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<a href="https://github.com/changchichung" target="_blank"><i class="fa fa-github"></i></a>
|
|
|
|
|
|
|
|
|
|
|
|
<a href="https://www.yapee.tw/mvc/onlinePay/webLink?key=lMC74kucH21JChCR77-wJ80ZZ-Poh11amP24BwiDdHw" target="_blank"><img border="0" src="https://www.yapee.tw/mvc/file/publicFile?pathType=data/linkLogo/B0S0F0002585.jpg"></img></a>
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
</div>
|
|
|
</footer>
|
|
|
|
|
|
|
|
|
<div class="credits">
|
|
|
<div class="container">
|
|
|
<div class="copyright">
|
|
|
<a href="https://github.com/Lednerb" target="_blank">
|
|
|
©
|
|
|
|
|
|
2017
|
|
|
|
|
|
by Lednerb
|
|
|
</a>
|
|
|
|
|
|
</div>
|
|
|
<div class="author">
|
|
|
<a href="https://www.yapee.tw/mvc/onlinePay/webLink?key=lMC74kucH21JChCR77-wJ80ZZ-Poh11amP24BwiDdHw" target="_blank">Bilberry Hugo Theme</a>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<script type="application/javascript">
|
|
|
var doNotTrack = false;
|
|
|
if (!doNotTrack) {
|
|
|
window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)};ga.l=+new Date;
|
|
|
ga('create', 'UA-138954876-1', 'auto');
|
|
|
|
|
|
ga('send', 'pageview');
|
|
|
}
|
|
|
</script>
|
|
|
<script async src='https://www.google-analytics.com/analytics.js'></script>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<script type="text/javascript" src="https://h.cowbay.org/js/externalDependencies.39c47e10e241eae2947b3fe21809c572.js" integrity="md5-OcR+EOJB6uKUez/iGAnFcg=="></script>
|
|
|
|
|
|
|
|
|
|
|
|
<script type="text/javascript" src="https://h.cowbay.org/js/theme.ff50ae6dc1bfc220b23bf69dbb41b54e.js" integrity="md5-/1CubcG/wiCyO/adu0G1Tg=="></script>
|
|
|
|
|
|
<script>
|
|
|
$(".moment").each(function() {
|
|
|
$(this).text(
|
|
|
moment( $(this).text() )
|
|
|
.locale( "tw" )
|
|
|
.format('LL')
|
|
|
);
|
|
|
});
|
|
|
|
|
|
$(".footnote-return sup").html("");
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
var client = algoliasearch("2XL0P8XDCY", "4ef65b37b627bb886b46c34a10e63aa6");
|
|
|
var index = client.initIndex("h_cowbay_org");
|
|
|
|
|
|
$('#search').autocomplete({ hint: false, autoselect: true, debug: false },
|
|
|
[
|
|
|
{
|
|
|
|
|
|
source: $.fn.autocomplete.sources.hits(index, { hitsPerPage: 10 }),
|
|
|
|
|
|
displayKey: function(suggestion) {
|
|
|
return suggestion.title || suggestion.author
|
|
|
},
|
|
|
templates: {
|
|
|
suggestion: function(suggestion) {
|
|
|
return "<span class='entry " + suggestion.type + "'>"
|
|
|
+ "<span class='title'>" + suggestion.title + "</span>"
|
|
|
+ "<span class='fa fa-fw " + suggestion.iconClass + "'></span>"
|
|
|
+ "</span>"
|
|
|
;
|
|
|
},
|
|
|
empty: function() {
|
|
|
return "<span class='empty'></span>"
|
|
|
},
|
|
|
footer: function() {
|
|
|
return '<div class="branding">Powered by <img src="https:\/\/h.cowbay.org\/dist\/algolia-logo-light.svg" /></div>'
|
|
|
}
|
|
|
|
|
|
},
|
|
|
}
|
|
|
])
|
|
|
.on('autocomplete:selected', function(event, suggestion, dataset) {
|
|
|
window.location = (suggestion.url);
|
|
|
})
|
|
|
.keypress(function (event, suggestion) {
|
|
|
if (event.which == 13) {
|
|
|
window.location = (suggestion.url);
|
|
|
}
|
|
|
});
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</body>
|
|
|
</html>
|