私は2つの同一のサーバを持っていますが、どちらも同じ設定のpostgresqlサーババージョン9.0.4がインストールされています。約5kの挿入を実行する.sqlファイルを起動すると、最初のファイルは2秒、2番目のファイルは1分30秒かかります。同じ設定、異なるパフォーマンスを持つ2つのpostgresqlサーバ
synchronous_commitを設定すると、スピードが大幅に低下し(期待どおり)、2台のサーバーのパフォーマンスが同等になります。しかし、sync_commitをonに設定した場合、1つのサーバーで挿入スクリプトの実行時間が1秒未満に増え、もう一方のサーバーでは、最初の期間のように増加します。
このようなパフォーマンスの違いについて考えてみましょうか?私はいくつかの設定が欠けていますか?
更新は:time sh -c "dd if=/dev/zero of=ddfile bs=8k count=200000 && sync"
速いサーバー出力:
1638400000 bytes (1.6 GB) copied, 1.73537 seconds, 944 MB/s
real 0m32.009s
user 0m0.018s
sys 0m2.298s
遅いサーバー出力:
1638400000 bytes (1.6 GB) copied, 4.85727 s, 337 MB/s
real 0m35.045s
user 0m0.019s
sys 0m2.221s
共通の特徴(両方のサーバー):
単純なディスクのテストを試してみましたSATA, RAID1, controller: Intel Corporation 82801JI (ICH10 Family) SATA AHCI Controller, distribution: linux centOS. mount -v output:
/dev/md2 on/type ext3 (rw)
proc on /proc type proc (rw)
none on /dev/pts type devpts (rw,gid=5,mode=620)
/dev/md1 on /boot type ext3 (rw)
速いサーバー:カーネル2.6.18-238.9.1.el5#1 SMP
Disk /dev/sda: 750.1 GB, 750156374016 bytes
255 heads, 63 sectors/track, 91201 cylinders, total 1465149168 sectors
Units = sectors of 1 * 512 = 512 bytes
Device Boot Start End Blocks Id System
/dev/sda1 3906 4209029 2102562 fd Linux raid autodetect
/dev/sda2 4209030 4739174 265072+ fd Linux raid autodetect
/dev/sda3 4739175 1465144064 730202445 fd Linux raid autodetect
遅いサーバー:カーネル2.6.32-71.29.1.el6.x86_64#1 SMP
Disk /dev/sda: 750.2 GB, 750156374016 bytes
64 heads, 32 sectors/track, 715404 cylinders, total 1465149168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes/512 bytes
I/O size (minimum/optimal): 512 bytes/512 bytes
Disk identifier: 0x0006ffc4
Device Boot Start End Blocks Id System
/dev/sda1 2048 4194303 2096128 fd Linux raid autodetect
/dev/sda2 4194304 5242879 524288 fd Linux raid autodetect
/dev/sda3 5242880 1465147391 729952256 fd Linux raid autodetect
パフォーマンスの問題に対処すると便利でしょうか?
サーバーのCPUが同じであることを確認してください。 –
どちらのサーバも同じハードウェア構成とディスクレイアウトを持っていますか? – taro
はい。必要に応じて、lspci/hdparmコマンドの出力を投稿することができます –