Benchmarking PostgreSQL Performance Across Different Architectures
Apple

Benchmarking PostgreSQL Performance Across Different Architectures

2025-02-02 · 10 分鐘 · Ray Lee (System Analyst)

In this blog post, we’ll compare the performance of PostgreSQL’s pgbench across various hardware platforms and configurations. The benchmarking test will focus on how different CPUs affect transaction processing time and throughput under the same load conditions. Our goal is to assess how PostgreSQL scales on Intel Xeon, Apple M1, and Apple M4 CPUs.

What is pgbench?

pgbench is a benchmarking tool that comes with PostgreSQL. It runs a series of transactions, testing the database’s performance under various load conditions. For this test, we will use the default TPC-B (sort of) benchmark, which simulates a banking workload.

We’ll focus on the following metrics:

  • Latency Average: The average time it takes to process a transaction.
  • Transactions Per Second (TPS): The number of transactions processed per second. We’ll include two variations: with and without the initial connection time.
  • Initial Connection Time: The time it takes to establish a connection to the database server.

Test Setup

For each case, we used the following configuration:

  • Number of clients: 10
  • Number of transactions per client: 1000
  • Total transactions processed: 10,000 (10 clients x 1000 transactions each)
  • Query Mode: Simple queries

Let’s dive into the results.

Case 1: Intel Xeon Silver 4110 CPU @ 2.10GHz

Hardware: Intel Xeon Silver 4110
CPU: 8 cores, 16 threads
Database: PostgreSQL running on a standard Linux server

Benchmark Results:

  • Latency Average: 12.847 ms
  • Initial Connection Time: 102.141 ms
  • TPS (Excluding Connection Time): 778.37

The Intel Xeon Silver 4110 shows respectable performance but lags behind in comparison to more modern processors. While the latency average is relatively low, the transactions per second (TPS) are on the lower end. This can likely be attributed to both the older architecture and the higher initial connection time, which can impact the overall performance for workloads with frequent connections.


Case 2: Intel Xeon Gold 6133 CPU @ 2.50GHz

Hardware: Intel Xeon Gold 6133
CPU: 8 cores, 16 threads
Database: PostgreSQL running on a similar Linux server configuration

Benchmark Results:

  • Latency Average: 4.796 ms
  • Initial Connection Time: 34.393 ms
  • TPS (Excluding Connection Time): 2084.87

The Intel Xeon Gold 6133, being a more modern and higher-end processor, demonstrates a substantial improvement over the Silver 4110 model. Latency is cut down by more than half, and the TPS is more than twice as high. The significant drop in initial connection time also contributes to better throughput for short-lived database connections.


Case 3: Apple M1 CPU

Hardware: Apple M1
CPU: ARM-based, 8 cores
Database: PostgreSQL running on the 15 version of Postgres.app

Benchmark Results:

  • Latency Average: 0.867 ms
  • Initial Connection Time: N/A (test excludes this)
  • TPS (Excluding Connection Time): 11,532.72

The Apple M1 chip is a game changer for databases running on ARM-based processors. Even with 10 clients, the M1 excels with a latency average that is nearly 1 ms, and an incredible TPS performance, outperforming the Intel Xeon processors by a factor of five. The low latency and high throughput are likely due to the efficiency and performance of the M1 chip, which integrates CPU and memory in a unified architecture for faster data processing.


Case 4: Apple M4 CPU

Hardware: Apple M4
CPU: ARM-based, 10 cores (anticipated improvements over M1)
Database: PostgreSQL running on the 15 version of Postgres.app

Benchmark Results:

  • Latency Average: 0.591 ms
  • Initial Connection Time: 111.438 ms
  • TPS (Excluding Connection Time): 16,919.21

The Apple M4 takes the crown in this comparison, offering an even more significant performance boost over the M1. With a latency of 0.591 ms, it performs nearly 8 times faster than the Intel Xeon Gold 6133 model. The TPS jumps to almost 17,000, which is a massive leap from the Intel-based servers. Even though the connection time is a bit higher compared to the M1, the M4’s speed easily overcomes this.


Performance Comparison and Key Insights

CPULatency Average (ms)TPS (Excluding Connection Time)%
Intel Xeon Silver 411012.847778.37100%
Intel Xeon Gold 61334.7962084.87268%
Apple M10.86711,532.721487%
Apple M40.59116,919.212174%
  • Apple M4 clearly offers the best performance, with the lowest latency and highest TPS, easily surpassing both Intel Xeon processors.
  • Intel Xeon Gold 6133 is a solid performer, with a clear advantage over the Silver 4110 model, showing that newer and more powerful Intel CPUs can scale well with PostgreSQL.
  • Intel Xeon Silver 4110 shows decent performance but lags behind both the Gold version and the Apple M1/M4, particularly in transaction throughput.

Conclusion

This benchmark highlights the rapid evolution of CPU architectures. While Intel Xeon CPUs, especially the Gold series, still perform well in enterprise environments, the Apple M1 and M4 chips demonstrate a remarkable leap in performance for PostgreSQL workloads, particularly for environments optimized for ARM processors. If your organization uses PostgreSQL and is considering hardware upgrades, the Apple M1 and M4 chips could provide significant performance gains, especially when working with high-concurrency workloads or latency-sensitive applications.

As we continue to see innovation in ARM-based processors, we can expect the performance gap between traditional x86-based servers and newer ARM-based systems to continue shrinking, if not completely reversing.

Stay tuned for future comparisons as more powerful hardware becomes available!

English Version

In this blog post, we’ll compare the performance of PostgreSQL’s pgbench across various hardware platforms and configurations. The benchmarking test will focus on how different CPUs affect transaction processing time and throughput under the same load conditions. Our goal is to assess how PostgreSQL scales on Intel Xeon, Apple M1, and Apple M4 CPUs.

What is pgbench?

pgbench is a benchmarking tool that comes with PostgreSQL. It runs a series of transactions, testing the database’s performance under various load conditions. For this test, we will use the default TPC-B (sort of) benchmark, which simulates a banking workload.

We’ll focus on the following metrics:

  • Latency Average: The average time it takes to process a transaction.
  • Transactions Per Second (TPS): The number of transactions processed per second. We’ll include two variations: with and without the initial connection time.
  • Initial Connection Time: The time it takes to establish a connection to the database server.

Test Setup

For each case, we used the following configuration:

  • Number of clients: 10
  • Number of transactions per client: 1000
  • Total transactions processed: 10,000 (10 clients x 1000 transactions each)
  • Query Mode: Simple queries

Let’s dive into the results.

Case 1: Intel Xeon Silver 4110 CPU @ 2.10GHz

Hardware: Intel Xeon Silver 4110
CPU: 8 cores, 16 threads
Database: PostgreSQL running on a standard Linux server

Benchmark Results:

  • Latency Average: 12.847 ms
  • Initial Connection Time: 102.141 ms
  • TPS (Excluding Connection Time): 778.37

The Intel Xeon Silver 4110 shows respectable performance but lags behind in comparison to more modern processors. While the latency average is relatively low, the transactions per second (TPS) are on the lower end. This can likely be attributed to both the older architecture and the higher initial connection time, which can impact the overall performance for workloads with frequent connections.


Case 2: Intel Xeon Gold 6133 CPU @ 2.50GHz

Hardware: Intel Xeon Gold 6133
CPU: 8 cores, 16 threads
Database: PostgreSQL running on a similar Linux server configuration

Benchmark Results:

  • Latency Average: 4.796 ms
  • Initial Connection Time: 34.393 ms
  • TPS (Excluding Connection Time): 2084.87

The Intel Xeon Gold 6133, being a more modern and higher-end processor, demonstrates a substantial improvement over the Silver 4110 model. Latency is cut down by more than half, and the TPS is more than twice as high. The significant drop in initial connection time also contributes to better throughput for short-lived database connections.


Case 3: Apple M1 CPU

Hardware: Apple M1
CPU: ARM-based, 8 cores
Database: PostgreSQL running on the 15 version of Postgres.app

Benchmark Results:

  • Latency Average: 0.867 ms
  • Initial Connection Time: N/A (test excludes this)
  • TPS (Excluding Connection Time): 11,532.72

The Apple M1 chip is a game changer for databases running on ARM-based processors. Even with 10 clients, the M1 excels with a latency average that is nearly 1 ms, and an incredible TPS performance, outperforming the Intel Xeon processors by a factor of five. The low latency and high throughput are likely due to the efficiency and performance of the M1 chip, which integrates CPU and memory in a unified architecture for faster data processing.


Case 4: Apple M4 CPU

Hardware: Apple M4
CPU: ARM-based, 10 cores (anticipated improvements over M1)
Database: PostgreSQL running on the 15 version of Postgres.app

Benchmark Results:

  • Latency Average: 0.591 ms
  • Initial Connection Time: 111.438 ms
  • TPS (Excluding Connection Time): 16,919.21

The Apple M4 takes the crown in this comparison, offering an even more significant performance boost over the M1. With a latency of 0.591 ms, it performs nearly 8 times faster than the Intel Xeon Gold 6133 model. The TPS jumps to almost 17,000, which is a massive leap from the Intel-based servers. Even though the connection time is a bit higher compared to the M1, the M4’s speed easily overcomes this.


Performance Comparison and Key Insights

CPULatency Average (ms)TPS (Excluding Connection Time)%
Intel Xeon Silver 411012.847778.37100%
Intel Xeon Gold 61334.7962084.87268%
Apple M10.86711,532.721487%
Apple M40.59116,919.212174%
  • Apple M4 clearly offers the best performance, with the lowest latency and highest TPS, easily surpassing both Intel Xeon processors.
  • Intel Xeon Gold 6133 is a solid performer, with a clear advantage over the Silver 4110 model, showing that newer and more powerful Intel CPUs can scale well with PostgreSQL.
  • Intel Xeon Silver 4110 shows decent performance but lags behind both the Gold version and the Apple M1/M4, particularly in transaction throughput.

Conclusion

This benchmark highlights the rapid evolution of CPU architectures. While Intel Xeon CPUs, especially the Gold series, still perform well in enterprise environments, the Apple M1 and M4 chips demonstrate a remarkable leap in performance for PostgreSQL workloads, particularly for environments optimized for ARM processors. If your organization uses PostgreSQL and is considering hardware upgrades, the Apple M1 and M4 chips could provide significant performance gains, especially when working with high-concurrency workloads or latency-sensitive applications.

As we continue to see innovation in ARM-based processors, we can expect the performance gap between traditional x86-based servers and newer ARM-based systems to continue shrinking, if not completely reversing.

Stay tuned for future comparisons as more powerful hardware becomes available!

日本語版

このブログ記事では、さまざまなハードウェアプラットフォームと構成におけるPostgreSQLのpgbenchのパフォーマンスを比較します。ベンチマークテストでは、同じ負荷条件下で異なるCPUがトランザクション処理時間とスループットにどのように影響するかに焦点を当てます。Intel Xeon、Apple M1、Apple M4 CPUでのPostgreSQLのスケーラビリティを評価することが目標です。

pgbenchとは?

pgbenchはPostgreSQLに付属するベンチマークツールです。一連のトランザクションを実行し、さまざまな負荷条件下でのデータベースのパフォーマンスをテストします。今回のテストでは、銀行業務をシミュレートするデフォルトのTPC-B(に類似した)ベンチマークを使用します。

以下のメトリクスに焦点を当てます:

  • 平均レイテンシ:トランザクションの処理にかかる平均時間。
  • 1秒あたりのトランザクション数(TPS):1秒あたりに処理されるトランザクション数。初期接続時間を含む場合と含まない場合の2つのバリエーションを紹介します。
  • 初期接続時間:データベースサーバーへの接続を確立するのにかかる時間。

テスト設定

各ケースで、以下の構成を使用しました:

  • クライアント数:10
  • クライアントあたりのトランザクション数:1000
  • 処理されたトランザクション総数:10,000(10クライアント x 各1000トランザクション)
  • クエリモード:シンプルクエリ

それでは結果を見ていきましょう。

ケース1:Intel Xeon Silver 4110 CPU @ 2.10GHz

ハードウェア:Intel Xeon Silver 4110
CPU:8コア、16スレッド
データベース:標準的なLinuxサーバー上で動作するPostgreSQL

ベンチマーク結果:

  • 平均レイテンシ:12.847 ms
  • 初期接続時間:102.141 ms
  • TPS(接続時間を除く):778.37

Intel Xeon Silver 4110は一定のパフォーマンスを示しますが、より新しいプロセッサと比較すると見劣りします。平均レイテンシは比較的低いものの、1秒あたりのトランザクション数(TPS)は低めです。これは、古いアーキテクチャと高い初期接続時間の両方に起因する可能性があり、接続頻度の高いワークロードの全体的なパフォーマンスに影響を与える可能性があります。


ケース2:Intel Xeon Gold 6133 CPU @ 2.50GHz

ハードウェア:Intel Xeon Gold 6133
CPU:8コア、16スレッド
データベース:同様のLinuxサーバー構成上で動作するPostgreSQL

ベンチマーク結果:

  • 平均レイテンシ:4.796 ms
  • 初期接続時間:34.393 ms
  • TPS(接続時間を除く):2084.87

Intel Xeon Gold 6133は、より新しくハイエンドなプロセッサとして、Silver 4110モデルに対して大幅な改善を示しています。レイテンシは半分以下に削減され、TPSは2倍以上に向上しています。初期接続時間の大幅な短縮も、短期間のデータベース接続のスループット向上に貢献しています。


ケース3:Apple M1 CPU

ハードウェア:Apple M1
CPU:ARMベース、8コア
データベース:Postgres.appバージョン15上で動作するPostgreSQL

ベンチマーク結果:

  • 平均レイテンシ:0.867 ms
  • 初期接続時間:N/A(テストで除外)
  • TPS(接続時間を除く):11,532.72

Apple M1チップは、ARMベースのプロセッサ上で動作するデータベースにとって画期的な存在です。10クライアントでも、M1はほぼ1 msの平均レイテンシと驚異的なTPSパフォーマンスを発揮し、Intel Xeonプロセッサを5倍上回ります。低レイテンシと高スループットは、CPUとメモリを統合アーキテクチャで一体化し、より高速なデータ処理を実現するM1チップの効率性とパフォーマンスによるものと考えられます。


ケース4:Apple M4 CPU

ハードウェア:Apple M4
CPU:ARMベース、10コア(M1からの改善が期待される)
データベース:Postgres.appバージョン15上で動作するPostgreSQL

ベンチマーク結果:

  • 平均レイテンシ:0.591 ms
  • 初期接続時間:111.438 ms
  • TPS(接続時間を除く):16,919.21

Apple M4はこの比較で王座を獲得し、M1よりもさらに大きなパフォーマンスの向上を提供しています。0.591 msのレイテンシで、Intel Xeon Gold 6133モデルの約8倍の速度を実現しています。TPSはほぼ17,000に達し、Intelベースのサーバーからの大幅な飛躍です。接続時間はM1と比較してやや高いものの、M4のスピードはこれを容易に補っています。


パフォーマンス比較と主要な知見

CPU平均レイテンシ (ms)TPS(接続時間を除く)%
Intel Xeon Silver 411012.847778.37100%
Intel Xeon Gold 61334.7962084.87268%
Apple M10.86711,532.721487%
Apple M40.59116,919.212174%
  • Apple M4は最も優れたパフォーマンスを明確に提供し、最低のレイテンシと最高のTPSで、両方のIntel Xeonプロセッサを容易に上回っています。
  • Intel Xeon Gold 6133は堅実なパフォーマーであり、Silver 4110モデルに対する明確な優位性を示し、より新しく強力なIntel CPUがPostgreSQLで適切にスケールできることを示しています。
  • Intel Xeon Silver 4110はまずまずのパフォーマンスを示しますが、特にトランザクションスループットにおいて、GoldバージョンとApple M1/M4の両方に遅れをとっています。

結論

このベンチマークは、CPUアーキテクチャの急速な進化を浮き彫りにしています。Intel Xeon CPU、特にGoldシリーズはエンタープライズ環境で依然として良好なパフォーマンスを発揮しますが、Apple M1およびM4チップは、特にARMプロセッサに最適化された環境において、PostgreSQLワークロードでの顕著なパフォーマンスの飛躍を示しています。組織でPostgreSQLを使用しており、ハードウェアのアップグレードを検討している場合、Apple M1およびM4チップは、特に高並行ワークロードやレイテンシに敏感なアプリケーションにおいて、大幅なパフォーマンス向上を提供できる可能性があります。

ARMベースのプロセッサのイノベーションが続く中、従来のx86ベースのサーバーと新しいARMベースのシステム間のパフォーマンスギャップは、縮小し続けるか、あるいは完全に逆転する可能性があると期待できます。

より強力なハードウェアが利用可能になった際の今後の比較にご期待ください!

Ray Lee (System Analyst)
作者 Ray Lee (System Analyst)

iDempeire ERP Contributor, 經濟部中小企業處財務管理顧問 李寶瑞