CentOS vs Rocky Linux Benchmark with PostgreSQL

In December 2020, you might have seen an article from CentOS about shifting their focus towards CentOS stream, which is the upstream version of the RHEL. CentOS also mentioned that the version 8 would be EOL (end of life) by the end of the 2021. This means that it will no longer receive any updated fixes from it's upstream version of RHEL. A few days after this announcement, Rocky Linux was announced by the CentOS founder, Gregory Kurtzeras, as a 100% bug-for-bug compatible with RHEL. The Rocky Linux project quickly gained so much of attention, and also got sponsors from the cloud vendors like AWS, Google Cloud and Microsoft. We wanted to take this opportunity and write an article about CentOS vs Rocky Linux Benchmark with PostgreSQL.

CentOS

As of now, CentOS is widely used in productions, because it was a downstream version of RHEL. This means that the CentOS was receiving all the RHEL criticial bug fixes for free, which makes CentOS as robust and reliable as RHEL. The future of CentOS project is it's Stream version, which is the upstream of RHEL. This means that CentOS Stream may not be receiving any such critical bug fixes from RHEL, instead CentOS Stream bug fixes will be pushed down to the RHEL project.

CentOS vs Rocky Linux Benchmark

After seeing the Rocky Linux Project announcement, we wanted to run some benchmark regarding PostgreSQL and see if we get the same performance as CentOS 8 with Rocky Linux 8. To run this benchmark, we have chosen the phoronix tool, which offers a big list of benchmarking test suites. By using this phoronix tool, we will be running a few set of general benchmarks besides to PostgreSQL's pgbench.

Phoronix test suites

Phoronix is a system benchmarking tool which offers a big list of test suites. This tool provides test suites for the CPU, MEMORY, DISK, COMPILE, etc. for most of the operating systems. We will be using this tool to perform the benchmarking on both Rocky Linux and CentOS. For the purpose of this article, we have considered run the following test suites.

  1. Compiler
  2. CPU
  3. Memory
  4. Disk
  5. Stress
  6. PostgreSQL (pgbench)
  7. Stress & PostgreSQL

By doing the above benchmarkings on these 2 instances, we will be able to understand whether Rocky Linux is going to be a true CentOS replacement.

Install phoronix test suite

After spinning two dedicated instances hosted in Linode, we installed the phoronix tool on these new instances. No other additional software or configuration changes have been done, since we do not want to have any drift in the benchmarking results.

To install phoronix, we executed these 3 steps on Rocky Linux and the CentOS instances.

Step 1 : Install the following dependencies

    # yum install -y wget php-cli php-xml bzip2 php-json php-zip

Step 2 : Download the latest repo.

    # wget https://phoronix-test-suite.com/releases/phoronix-test-suite-10.4.0.tar.gz

Step 3 : Extract the source and install.

    # tar -zxf phoronix-test-suite-10.4.0.tar.gz
    # cd phoronix-test-suite
    # ./install-sh
    which: no xdg-mime in (/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin)
    Phoronix Test Suite Installation Completed
    Executable File: /usr/bin/phoronix-test-suite
    Documentation: /usr/share/doc/phoronix-test-suite/
    Phoronix Test Suite Files: /usr/share/phoronix-test-suite/

CentOS vs Rocky Hardware configuration

Before performing the benchmarking, let us see the system capacities of the both instances. As you see in the below specifications table, both systems has the same configuration and the only difference is the operating system.

  CentOS Spec Rocky Spec
CPU PROCESSOR: 4 x AMD EPYC 7501 32-Core PROCESSOR: 4 x AMD EPYC 7501 32-Core
  Core Count: 4 Core Count: 4
  Extensions: SSE 4.2 + AVX2 + AVX + RDRAND + FSGSBASE Extensions: SSE 4.2 + AVX2 + AVX + RDRAND + FSGSBASE
  Cache Size: 16 MB Cache Size: 16 MB
  Microcode: 0x1000065 Microcode: 0x1000065
  Core Family: Zen Core Family: Zen
         
Memory MEMORY: 1 x 8 GB RAM QEMU MEMORY: 1 x 8 GB RAM QEMU
         
Chipset MOTHERBOARD: QEMU Standard PC MOTHERBOARD: QEMU Standard PC
  BIOS Version: rel-1.12.1-0-ga5cab58e9a3f-prebuilt.qemu.org BIOS Version: rel-1.12.1-0-ga5cab58e9a3f-prebuilt.qemu.org
  Chipset: Intel 82G33/G31/P35/P31 + ICH9 Chipset: Intel 82G33/G31/P35/P31 + ICH9
  Network: Red Hat Virtio device Network: Red Hat Virtio device
         
Disk DISK: 171GB QEMU HDD + QEMU HDD DISK: 171GB QEMU HDD + QEMU HDD
  File-System: ext4 File-System: ext4
  Mount Options: relatime rw seclabel Mount Options: relatime rw seclabel
  Disk Scheduler: MQ-DEADLINE Disk Scheduler: MQ-DEADLINE
  Disk Details: Block Size: 4096 Disk Details: Block Size: 4096
         
OS OPERATING SYSTEM: CentOS Linux 8 OPERATING SYSTEM: Rocky Linux 8.4
  Kernel: 4.18.0-305.3.1.el8.x86_64 (x86_64) Kernel: 4.18.0-305.3.1.el8_4.x86_64 (x86_64)
  Compiler: GCC 8.4.1 20200928 Compiler: GCC 8.4.1 20200928
  System Layer: KVM System Layer: KVM
  Security: SELinux Security: SELinux

Compiler Benchmarking

Phoronix provides compiler benchmarking test suite, and we will be using this suite to compare the benchmark results between CentOS and Rocky Linux. To perform the compiler benchmarking, let us build the kernel (linux-5.10.20) on both operating systems, and compare it's completion time.

    # phoronix-test-suite benchmark build-linux-kernel

Here are the results

  Time Seconds Details
CentOS 553.54 OS: CentOS Linux 8, Kernel: 4.18.0-305.3.1.el8.x86_64 (x86_64), Compiler: GCC 8.4.1 20200928, File-System: ext4, Screen Resolution: 1024x768, System Layer: KVM
Rocky 546.10 OS: Rocky Linux 8.4, Kernel: 4.18.0-305.3.1.el8_4.x86_64 (x86_64), Compiler: GCC 8.4.1 20200928, File-System: ext4, Screen Resolution: 1024x768, System Layer: KVM

Compile time for Rocky Linux vs CentOS

By default, phoronix tool will run the test 3 times, and will provide an average duration of the test times. The above values which are listed are the average duration among the 3 runs. As per the compiler test results, Rocky Linux completed the kernel build a little bit faster than CentOS with not a huge gap between the results.

CPU Benchmarking

As both of the instances are having the same CPU capacity, let us run the sysbench with CPU profile, and see the number of events a cpu is processing per second.

    # phoronix-test-suite benchmark sysbench

Here are the results

  Events Per Second Details
CentOS 2687.02 Processor: 4 x AMD EPYC 7501 32-Core (4 Cores)
Rocky 2701.93 Processor: 4 x AMD EPYC 7501 32-Core (4 Cores)

Events per second for Rocky Linux vs CentOS

Rocky linux processed a little more events (14.91 more) per second than the CentOS, and this value is the average from the 3 tests. Again, there is not a  huge gap between Rocky Linux and CentOS.

Memory Benchmarking

Both hardware instances are having the same memory capacity, and this time let us use the sysbench memory profile to generate the load on the system. Here, the sysbench will initiate a block of memory in RAM, and will perform the seek tests.

    # phoronix-test-suite benchmark sysbench

Following are the results -

  Mb/sec Details
CentOS 7907.09 Memory: 1 x 8 GB RAM QEMU
Rocky 7798.74 Memory: 1 x 8 GB RAM QEMU

Memory benchmarking for Rocky Linux vs CentOS

From the results, CentOS is doing a bit higher operations than the Rocky Linux. And again, this is the average result from the 3 test runs.

Disk Benchmarking

When it comes to disk benchmarking, we have multiple factors to consider such as direct, buffered, block size, sequential, random reads, etc. The phoronix tool provides an advanced benchmarking suite like flexible io (fio). We have considered running it on these two machines.
As there are many possibilities of benchmarking, we are only limiting it to the below set of test cases.

# phoronix-test-suite benchmark fio

Following are the results -

  Random Read Random Write Sequential Read Sequential Write Details
CentOS 25.7 MB/S - 3302 IOPS 639 MB/S - 81767 IOPS 1478 MB/S - 189000 IOPS 783 MB/S - 100133 IOPS Engine: Linux AIO - Buffered: Yes - Direct: Yes - Block Size: 8KB QEMU HDD
Rocky 28.5 MB/S - 3648 IOPS 685 MB/S - 87633 IOPS 1537 MB/S - 197000 IOPS 811 MB/S - 103667 IOPS Engine: Linux AIO - Buffered: Yes - Direct: Yes - Block Size: 8KB QEMU HDD

Sequential IOPS for Rocky Linux vs CentOS
Random IOPS for Rocky Linux vs CentOS

Seems that Rocky Linux with the same filesystem ext4 is giving some better throughput than CentOS, though the configuration is same.

Stress Benchmarking

This time, let us use the popular stress-ng test, to check the system stability. phoronix do provide the stress-ng benchmarking suite, which will initiate few benchmarking tests.

# phoronix-test-suite benchmark stress-ng

Following are the results -

op/sec MMAP NUMA MEMFD Atomic Crypto Malloc Forking SENDFILE CPU Cache CPU Stress
CentOS 9.03 34.69 59.03 320701.15 329.47 5394403.52 13126.39 22847.99 2.64 461.63
Rocky 10.22 33.70 61.09 317368.35 329.09 5886840.34 13116.39 22754.75 3.43 457.55
op/sec Semaphores Matrix Math Vector Math Memory Copying Socket Activity Context Switching Glibc C String Functions Glibc Qsort Data Sorting System V Message Passing
CentOS 267137.47 8479.07 11581.05 1623.55 1460.90 787841.94 152539.11 21.85 1686145.73
Rocky 267230.52 8510.55 11578.17 1722.36 1519.78 797083.22 153499.17 19.23 1739696.00

As per the test results, Rocky Linux is almost matching with most of the CentOS results, and seems to be giving better performance in few of the areas like Memory Allocations, Socket Activity, Context Switches and in processing the Semaphores and System V Message Passing. And CentOS is in a bit leading position while doing the Forking, Atomic operations.

PGBench Benchmarking

Finally, we ran the much awaited PostgreSQL benchmarking on these two machines. Let us use the phoronix pgbench test suite, and run the both read , read write tests. Use the following command to run the pgbench and see the results. This suite will install the PostgreSQL-13, and will run the default pgbench test cases.

# phoronix-test-suite benchmark pgbench

Following are the results for Rocky Linux and CentOS with PostgreSQL -

  Read Only Avg Latency Read Write Avg Latency Details
CentOS 17570 TPS 5.693 ms 3402 TPS 29.40 ms Scaling Factor: 1000 - Clients: 100
Rocky 17751 TPS 5.635 ms 3464 TPS 28.88 ms Scaling Factor: 1000 - Clients: 100

pgbench TPS for Rocky Linux vs CentOS

This benchmarking is done with the default installation of PostgreSQL, with default settings on the both machines. No special changes have done to any configuration parameter. Seems, Rocky Linux is matching (slightly better TPS than CentOS) the CentOS benchmark results.

Stress & PostgreSQL

This is an additional benchmarking case we performed to know how PostgreSQL will behave in Rocky Linux and CentOS, while the system is already having some load on it. For this test, we will be running 2 phoronix suites in parallel. One suite will be running the stress-ng and other will be running pgbench. While we are running these suites, we followed the same test parameters which we did in the earlier tests. These tests are performed on these two hosts almost in the same time.

Session1

# phoronix-test-suite benchmark stress-ng

Session2

# phoronix-test-suite benchmark pgbench

Following are the results -

  Read Only Avg Latency Read Write Avg Latency Details
CentOS 12287 TPS 8.291 ms 2234 TPS 45.67 ms Scaling Factor: 1000 - Clients: 100
Rocky 15051 TPS 6.781 ms 2606 TPS 39.27 ms Scaling Factor: 1000 - Clients: 100

Stress and pgbench TPS for Rocky Linux vs CentOS

From the above results, it's a little bit surprise to see more TPS from Rocky linux than CentOS, with PostgreSQL and some load on the system.

Conclusion

After going through all these benchmarking results, Rocky Linux is giving a little bit better throughput when compared to CentOS but it's not a big difference in number. This proves that Rocky Linux is going to be a true replacement for CentOS, and the benchmarking numbers are already saying it. PostgreSQL is also pretty stable in Rocky Linux and producing the same (a bit higher) throughput as CentOS.

Looking forward for your valuable thoughts and inputs.

By the way, if you are interested in migrating your proprietary databases like Oracle or SQL Server to PostgreSQL, please feel free to contact us. We also provide Remote DBA services and Performance Assessments for PostgreSQL databases. You may fill the following form and our team will contact you soon.

3 thoughts on “CentOS vs Rocky Linux Benchmark with PostgreSQL”

  1. Glenn Matthys

    That’s curious. At this point in time the results should be exactly the same. CentOS and Rocky are still derived from the same source code. You said you used 2 dedicated hosts from Linode, have you tried swapping operating systems and redoing the tests? So if node1 was running CentOS and node2 running Rocky, repeat the test but now node1 is running Rocky and node2 CentOS. Also can you turn off the animation on the charts? Really annoying.

Leave a Comment

Your email address will not be published.

Scroll to Top