We recently conducted a performance comparison of PostgreSQL on two different architectures: an Apple M1 chip and an Intel Xeon Silver 4110. The goal was to evaluate the transaction processing speed and latency under a simple workload. This blog post details the setup, results, and some initial observations.
Test Setup:
We used pgbench
, a standard PostgreSQL benchmarking tool, for this comparison. The following commands were executed on both systems:
pgbench -i testdb
pgbench -c 10 -t 1000 testdb
This initializes a database named testdb
and then runs a benchmark with 10 clients, each performing 1000 transactions. We used the simple query mode for this test. The key parameters were:
- Number of clients: 10
- Number of threads: 1 (default)
- Transactions per client: 1000
- Query mode: simple
Results:
Here’s a comparison of the results:
Metric | Intel Xeon Silver 4110 | Apple M1 |
---|---|---|
CPU | 2.10 GHz | 3.2 GHz |
Latency Average (ms) | 12.847 | 0.867 |
Initial Connection Time (ms) | 102.141 | N/A |
Transactions per Second (tps) (incl. conn) | 778.37 | 11532.72 |
Transactions per Second (tps) (excl. conn) | 778.37 | 11571.74 |
Observations:
The results show a significant performance difference between the two systems. The Apple M1 outperformed the Intel Xeon Silver 4110 by a substantial margin. Specifically:
- Latency: The Apple M1 exhibited significantly lower latency (0.867ms) compared to the Intel Xeon (12.847ms). This suggests that the M4 can process individual transactions much faster.
- Transactions per Second (TPS): The Apple M1 achieved a dramatically higher TPS (11532.72 including connection time) compared to the Intel Xeon (778.37). This indicates the M4’s ability to handle a much greater volume of transactions per unit of time.
Initial Thoughts:
The massive difference in performance is striking. While a comprehensive analysis would require more in-depth investigation, a few potential factors contribute to this disparity:
- Architecture: The Apple M1’s unified memory architecture and high clock speed likely play a significant role in its superior performance. It’s designed for efficiency and low latency.
- Clock Speed vs. IPC: While the Intel Xeon has a higher clock speed, the Apple M1 likely has a much higher Instructions Per Cycle (IPC), meaning it can execute more instructions per clock cycle.
- Cooling and Power: The M1 is designed for a mobile environment, which often prioritizes power efficiency and thermal management. This could lead to more consistent performance under load.