{
  "date": "2021-03-10T20:23:20",
  "slug": "aws-postgresql-on-graviton2-aarch64",
  "link": "https://www.dbi-services.com/blog/aws-postgresql-on-graviton2-aarch64/",
  "title": {
    "rendered": "AWS: PostgreSQL on Graviton2 with newer GCC"
  },
  "content": {
    "rendered": "<h2>By Franck Pachot</h2>\n<p>.<br />\nIn the <a href=\"https://dev.to/aws-heroes/aws-postgresql-on-graviton2-3n44\" target=\"_blank\" rel=\"noopener\">previous post</a> I have run PostgreSQL on AWS m6gd.2xlarge (ARM Graviton2 processor).<br />\nI didn&#8217;t precise the compilation option and this post will give more details following this feedback:</p>\n<blockquote class=\"twitter-tweet\" data-width=\"500\" data-dnt=\"true\">\n<p lang=\"en\" dir=\"ltr\"><a href=\"https://twitter.com/FranckPachot?ref_src=twsrc%5Etfw\">@FranckPachot</a> thanks for sharing the results.  Our own testing showed similar perf when using the default gcc7.  However, with newer compiler and use of LSE, the graviton2 would provide higher performance : <a href=\"https://t.co/x9OgFqiPPy\">https://t.co/x9OgFqiPPy</a></p>\n<p>&mdash; NB (@N_B__N_B) <a href=\"https://twitter.com/N_B__N_B/status/1369180884608315398?ref_src=twsrc%5Etfw\">March 9, 2021</a></p></blockquote>\n<p><script async src=\"https://platform.twitter.com/widgets.js\" charset=\"utf-8\"></script></p>\n<p>First, the PostgreSQL ./configure has correctly detected ARM and compiled with the following flags: -march=armv8-a+crc<br />\nThis is ARM v8. However, LSE (Large System Extensions) for atomic instructions were added later in ARM v8.1 and they can make a huge difference on PostgreSQL especially with spinlocks on on high CPU usage.</p>\n<p>I followed the information in <a href=\"https://github.com/aws/aws-graviton-getting-started/blob/master/c-c++.md\" target=\"_blank\" rel=\"noopener\">https://github.com/aws/aws-graviton-getting-started/blob/master/c-c++.md</a> to check the binaries after compilation.</p>\n<pre><code>\nfor i in $(find postgres/src/backend -name \"*.o\") ; do objdump -d \"$i\" | awk '/:$/{w=$2}/aarch64_(cas|casp|swp|ldadd|stadd|ldclr|stclr|ldeor|steor|ldset|stset|ldsmax|stsmax|ldsmin|stsmin|ldumax|stumax|ldumin|stumin)/{printf \"%-27s %-20s %-30s %-60s\\n\",\"(LSE instructions)\",$NF,w,f}' f=\"$i\" ; done | sort | uniq -c | sort -rnk1,4\n\n\n      8 (LSE instructions)          &lt;__aarch64_swp4_acq&gt; &lt;StartupXLOG&gt;:                 postgres/src/backend/access/transam/xlog.o\n      7 (LSE instructions)          &lt;__aarch64_swp4_acq&gt; &lt;BitmapHeapNext&gt;:              postgres/src/backend/executor/nodeBitmapHeapscan.o\n      6 (LSE instructions)          &lt;__aarch64_ldclr4_acq_rel&gt; &lt;LWLockDequeueSelf&gt;:           postgres/src/backend/storage/lmgr/lwlock.o\n      6 (LSE instructions)          &lt;__aarch64_cas8_acq_rel&gt; &lt;shm_mq_send_bytes&gt;:           postgres/src/backend/storage/ipc/shm_mq.o\n      5 (LSE instructions)          &lt;__aarch64_swp4_acq&gt; &lt;WalReceiverMain&gt;:             postgres/src/backend/replication/walreceiver.o\n      5 (LSE instructions)          &lt;__aarch64_cas8_acq_rel&gt; &lt;shm_mq_receive_bytes.isra.0&gt;: postgres/src/backend/storage/ipc/shm_mq.o\n      4 (LSE instructions)          &lt;__aarch64_swp4_acq&gt; &lt;ProcessRepliesIfAny&gt;:         postgres/src/backend/replication/walsender.o\n      4 (LSE instructions)          &lt;__aarch64_swp4_acq&gt; &lt;hash_search_with_hash_value&gt;: postgres/src/backend/utils/hash/dynahash.o\n      4 (LSE instructions)          &lt;__aarch64_swp4_acq&gt; &lt;copy_replication_slot&gt;:       postgres/src/backend/replication/slotfuncs.o\n      4 (LSE instructions)          &lt;__aarch64_ldadd4_acq_rel&gt; &lt;parallel_vacuum_index&gt;:       postgres/src/backend/access/heap/vacuumlazy.o\n      4 (LSE instructions)          &lt;__aarch64_cas4_acq_rel&gt; &lt;LWLockAcquire&gt;:               postgres/src/backend/storage/lmgr/lwlock.o\n      3 (LSE instructions)          &lt;__aarch64_swp4_acq&gt; &lt;xlog_redo&gt;:                   postgres/src/backend/access/transam/xlog.o\n      3 (LSE instructions)          &lt;__aarch64_swp4_acq&gt; &lt;XLogInsertRecord&gt;:            postgres/src/backend/access/transam/xlog.o\n      3 (LSE instructions)          &lt;__aarch64_swp4_acq&gt; &lt;SaveSlotToPath&gt;:              postgres/src/backend/replication/slot.o\n      3 (LSE instructions)          &lt;__aarch64_swp4_acq&gt; &lt;RequestCheckpoint&gt;:           postgres/src/backend/postmaster/checkpointer.o\n      3 (LSE instructions)          &lt;__aarch64_swp4_acq&gt; &lt;LogicalRepSyncTableStart&gt;:    postgres/src/backend/replication/logical/tablesync.o\n      3 (LSE instructions)          &lt;__aarch64_swp4_acq&gt; &lt;LogicalConfirmReceivedLocation&gt;: postgres/src/backend/replication/logical/logical.o\n      3 (LSE instructions)          &lt;__aarch64_swp4_acq&gt; &lt;InvalidateObsoleteReplicationSlots&gt;: postgres/src/backend/replication/slot.o\n      3 (LSE instructions)          &lt;__aarch64_swp4_acq&gt; &lt;CreateInitDecodingContext&gt;:   postgres/src/backend/replication/logical/logical.o\n      3 (LSE instructions)          &lt;__aarch64_swp4_acq&gt; &lt;CreateCheckPoint&gt;:            postgres/src/backend/access/transam/xlog.o\n      3 (LSE instructions)          &lt;__aarch64_swp4_acq&gt; &lt;CheckpointerMain&gt;:            postgres/src/backend/postmaster/checkpointer.o\n      3 (LSE instructions)          &lt;__aarch64_ldclr4_acq_rel&gt; &lt;LWLockQueueSelf&gt;:             postgres/src/backend/storage/lmgr/lwlock.o\n      3 (LSE instructions)          &lt;__aarch64_ldadd4_acq_rel&gt; &lt;tbm_prepare_shared_iterate&gt;:  postgres/src/backend/nodes/tidbitmap.o\n      3 (LSE instructions)          &lt;__aarch64_ldadd4_acq_rel&gt; &lt;tbm_free_shared_area&gt;:        postgres/src/backend/nodes/tidbitmap.o\n      3 (LSE instructions)          &lt;__aarch64_cas8_acq_rel&gt; &lt;ProcessProcSignalBarrier&gt;:    postgres/src/backend/storage/ipc/procsignal.o\n      3 (LSE instructions)          &lt;__aarch64_cas8_acq_rel&gt; &lt;ExecParallelHashIncreaseNumBatches&gt;: postgres/src/backend/executor/nodeHash.o\n      2 (LSE instructions)          &lt;__aarch64_swp4_acq&gt; &lt;XLogWrite&gt;:                   postgres/src/backend/access/transam/xlog.o\n      2 (LSE instructions)          &lt;__aarch64_swp4_acq&gt; &lt;XLogSendPhysical&gt;:            postgres/src/backend/replication/walsender.o\n      2 (LSE instructions)          &lt;__aarch64_swp4_acq&gt; &lt;XLogBackgroundFlush&gt;:         postgres/src/backend/access/transam/xlog.o\n      2 (LSE instructions)          &lt;__aarch64_swp4_acq&gt; &lt;WalRcvStreaming&gt;:             postgres/src/backend/replication/walreceiverfuncs.o\n      2 (LSE instructions)          &lt;__aarch64_swp4_acq&gt; &lt;WalRcvRunning&gt;:               postgres/src/backend/replication/walreceiverfuncs.o\n      2 (LSE instructions)          &lt;__aarch64_swp4_acq&gt; &lt;WalRcvDie&gt;:                   postgres/src/backend/replication/walreceiver.o\n      2 (LSE instructions)          &lt;__aarch64_swp4_acq&gt; &lt;TransactionIdLimitedForOldSnapshots&gt;: postgres/src/backend/utils/time/snapmgr.o\n      2 (LSE instructions)          &lt;__aarch64_swp4_acq&gt; &lt;StrategyGetBuffer&gt;:           postgres/src/backend/storage/buffer/freelist.o\n      2 (LSE instructions)          &lt;__aarch64_swp4_acq&gt; &lt;shm_mq_wait_internal&gt;:        postgres/src/backend/storage/ipc/shm_mq.o\n      2 (LSE instructions)          &lt;__aarch64_swp4_acq&gt; &lt;ReplicationSlotReserveWal&gt;:   postgres/src/backend/replication/slot.o\n      2 (LSE instructions)          &lt;__aarch64_swp4_acq&gt; &lt;ReplicationSlotRelease&gt;:      postgres/src/backend/replication/slot.o\n      2 (LSE instructions)          &lt;__aarch64_swp4_acq&gt; &lt;ProcKill&gt;:                    postgres/src/backend/storage/lmgr/proc.o\n      2 (LSE instructions)          &lt;__aarch64_swp4_acq&gt; &lt;process_syncing_tables&gt;:      postgres/src/backend/replication/logical/tablesync.o\n      2 (LSE instructions)          &lt;__aarch64_swp4_acq&gt; &lt;pg_get_replication_slots&gt;:    postgres/src/backend/replication/slotfuncs.o\n      2 (LSE instructions)          &lt;__aarch64_swp4_acq&gt; &lt;exec_replication_command&gt;:    postgres/src/backend/replication/walsender.o\n      2 (LSE instructions)          &lt;__aarch64_swp4_acq&gt; &lt;CreateRestartPoint&gt;:          postgres/src/backend/access/transam/xlog.o\n      2 (LSE instructions)          &lt;__aarch64_swp4_acq&gt; &lt;ConditionVariableBroadcast&gt;:  postgres/src/backend/storage/lmgr/condition_variable.o\n      2 (LSE instructions)          &lt;__aarch64_swp4_acq&gt; &lt;BarrierArriveAndWait&gt;:        postgres/src/backend/storage/ipc/barrier.o\n      2 (LSE instructions)          &lt;__aarch64_ldset4_acq_rel&gt; &lt;LWLockWaitListLock&gt;:          postgres/src/backend/storage/lmgr/lwlock.o\n      2 (LSE instructions)          &lt;__aarch64_ldclr4_acq_rel&gt; &lt;LWLockWaitForVar&gt;:            postgres/src/backend/storage/lmgr/lwlock.o\n      2 (LSE instructions)          &lt;__aarch64_ldclr4_acq_rel&gt; &lt;LWLockUpdateVar&gt;:             postgres/src/backend/storage/lmgr/lwlock.o\n      2 (LSE instructions)          &lt;__aarch64_ldadd4_acq_rel&gt; &lt;vacuum_delay_point&gt;:          postgres/src/backend/commands/vacuum.o\n      2 (LSE instructions)          &lt;__aarch64_ldadd4_acq_rel&gt; &lt;StrategyGetBuffer&gt;:           postgres/src/backend/storage/buffer/freelist.o\n      2 (LSE instructions)          &lt;__aarch64_ldadd4_acq_rel&gt; &lt;LWLockRelease&gt;:               postgres/src/backend/storage/lmgr/lwlock.o\n      2 (LSE instructions)          &lt;__aarch64_ldadd4_acq_rel&gt; &lt;lazy_parallel_vacuum_indexes&gt;: postgres/src/backend/access/heap/vacuumlazy.o\n      2 (LSE instructions)          &lt;__aarch64_cas8_acq_rel&gt; &lt;WalReceiverMain&gt;:             postgres/src/backend/replication/walreceiver.o\n      2 (LSE instructions)          &lt;__aarch64_cas8_acq_rel&gt; &lt;WaitForProcSignalBarrier&gt;:    postgres/src/backend/storage/ipc/procsignal.o\n      2 (LSE instructions)          &lt;__aarch64_cas8_acq_rel&gt; &lt;shm_mq_receive&gt;:              postgres/src/backend/storage/ipc/shm_mq.o\n      2 (LSE instructions)          &lt;__aarch64_cas8_acq_rel&gt; &lt;ResolveRecoveryConflictWithLock&gt;: postgres/src/backend/storage/ipc/standby.o\n      2 (LSE instructions)          &lt;__aarch64_cas8_acq_rel&gt; &lt;ProcSignalInit&gt;:              postgres/src/backend/storage/ipc/procsignal.o\n      2 (LSE instructions)          &lt;__aarch64_cas8_acq_rel&gt; &lt;ExecParallelHashTableInsert&gt;: postgres/src/backend/executor/nodeHash.o\n      2 (LSE instructions)          &lt;__aarch64_cas8_acq_rel&gt; &lt;ExecParallelHashTableInsertCurrentBatch&gt;: postgres/src/backend/executor/nodeHash.o\n      2 (LSE instructions)          &lt;__aarch64_cas8_acq_rel&gt; &lt;ExecParallelHashIncreaseNumBuckets&gt;: postgres/src/backend/executor/nodeHash.o\n      2 (LSE instructions)          &lt;__aarch64_cas4_acq_rel&gt; &lt;TransactionIdSetTreeStatus&gt;:  postgres/src/backend/access/transam/clog.o\n      2 (LSE instructions)          &lt;__aarch64_cas4_acq_rel&gt; &lt;ProcArrayEndTransaction&gt;:     postgres/src/backend/storage/ipc/procarray.o\n      2 (LSE instructions)          &lt;__aarch64_cas4_acq_rel&gt; &lt;LWLockAcquireOrWait&gt;:         postgres/src/backend/storage/lmgr/lwlock.o\n      1 (LSE instructions)          &lt;__aarch64_swp4_acq&gt; &lt;XLogWalRcvFlush.part.4&gt;:      postgres/src/backend/replication/walreceiver.o\n      1 (LSE instructions)          &lt;__aarch64_swp4_acq&gt; &lt;XLogSetReplicationSlotMinimumLSN&gt;: postgres/src/backend/access/transam/xlog.o\n      1 (LSE instructions)          &lt;__aarch64_swp4_acq&gt; &lt;XLogSetAsyncXactLSN&gt;:         postgres/src/backend/access/transam/xlog.o\n      1 (LSE instructions)          &lt;__aarch64_swp4_acq&gt; &lt;XLogSendLogical&gt;:             postgres/src/backend/replication/walsender.o\n      1 (LSE instructions)          &lt;__aarch64_swp4_acq&gt; &lt;XLogPageRead&gt;:                postgres/src/backend/access/transam/xlog.o\n      1 (LSE instructions)          &lt;__aarch64_swp4_acq&gt; &lt;XLogNeedsFlush&gt;:              postgres/src/backend/access/transam/xlog.o\n      1 (LSE instructions)          &lt;__aarch64_swp4_acq&gt; &lt;XLogGetLastRemovedSegno&gt;:     postgres/src/backend/access/transam/xlog.o\n      1 (LSE instructions)          &lt;__aarch64_swp4_acq&gt; &lt;XLogFlush&gt;:                   postgres/src/backend/access/transam/xlog.o\n      1 (LSE instructions)          &lt;__aarch64_swp4_acq&gt; &lt;worker_freeze_result_tape&gt;:   postgres/src/backend/utils/sort/tuplesort.o\n      1 (LSE instructions)          &lt;__aarch64_swp4_acq&gt; &lt;WalSndWakeup&gt;:                postgres/src/backend/replication/walsender.o\n      1 (LSE instructions)          &lt;__aarch64_swp4_acq&gt; &lt;WalSndWaitStopping&gt;:          postgres/src/backend/replication/walsender.o\n      1 (LSE instructions)          &lt;__aarch64_swp4_acq&gt; &lt;WalSndSetState&gt;:              postgres/src/backend/replication/walsender.o\n      1 (LSE instructions)          &lt;__aarch64_swp4_acq&gt; &lt;WalSndRqstFileReload&gt;:        postgres/src/backend/replication/walsender.o\n      1 (LSE instructions)          &lt;__aarch64_swp4_acq&gt; &lt;WalSndKill&gt;:                  postgres/src/backend/replication/walsender.o\n      1 (LSE instructions)          &lt;__aarch64_swp4_acq&gt; &lt;WalSndInitStopping&gt;:          postgres/src/backend/replication/walsender.o\n      1 (LSE instructions)          &lt;__aarch64_swp4_acq&gt; &lt;WalRcvForceReply&gt;:            postgres/src/backend/replication/walreceiver.o\n      1 (LSE instructions)          &lt;__aarch64_swp4_acq&gt; &lt;WaitXLogInsertionsToFinish&gt;:  postgres/src/backend/access/transam/xlog.o\n      1 (LSE instructions)          &lt;__aarch64_swp4_acq&gt; &lt;UpdateMinRecoveryPoint.part.10&gt;: postgres/src/backend/access/transam/xlog.o\n      1 (LSE instructions)          &lt;__aarch64_swp4_acq&gt; &lt;tuplesort_performsort&gt;:       postgres/src/backend/utils/sort/tuplesort.o\n      1 (LSE instructions)          &lt;__aarch64_swp4_acq&gt; &lt;tuplesort_begin_common&gt;:      postgres/src/backend/utils/sort/tuplesort.o\n      1 (LSE instructions)          &lt;__aarch64_swp4_acq&gt; &lt;table_block_parallelscan_startblock_init&gt;: postgres/src/backend/access/table/tableam.o\n      1 (LSE instructions)          &lt;__aarch64_swp4_acq&gt; &lt;SyncRepInitConfig&gt;:           postgres/src/backend/replication/syncrep.o\n      1 (LSE instructions)          &lt;__aarch64_swp4_acq&gt; &lt;SyncRepGetCandidateStandbys&gt;: postgres/src/backend/replication/syncrep.o\n      1 (LSE instructions)          &lt;__aarch64_swp4_acq&gt; &lt;StrategySyncStart&gt;:           postgres/src/backend/storage/buffer/freelist.o\n      1 (LSE instructions)          &lt;__aarch64_swp4_acq&gt; &lt;StrategyNotifyBgWriter&gt;:      postgres/src/backend/storage/buffer/freelist.o\n      1 (LSE instructions)          &lt;__aarch64_swp4_acq&gt; &lt;StrategyFreeBuffer&gt;:          postgres/src/backend/storage/buffer/freelist.o\n      1 (LSE instructions)          &lt;__aarch64_swp4_acq&gt; &lt;SnapshotTooOldMagicForTest&gt;:  postgres/src/backend/utils/time/snapmgr.o\n      1 (LSE instructions)          &lt;__aarch64_swp4_acq&gt; &lt;s_lock&gt;:                      postgres/src/backend/storage/lmgr/s_lock.o\n      1 (LSE instructions)          &lt;__aarch64_swp4_acq&gt; &lt;SIInsertDataEntries&gt;:         postgres/src/backend/storage/ipc/sinvaladt.o\n      1 (LSE instructions)          &lt;__aarch64_swp4_acq&gt; &lt;SIGetDataEntries&gt;:            postgres/src/backend/storage/ipc/sinvaladt.o\n      1 (LSE instructions)          &lt;__aarch64_swp4_acq&gt; &lt;ShutdownWalRcv&gt;:              postgres/src/backend/replication/walreceiverfuncs.o\n      1 (LSE instructions)          &lt;__aarch64_swp4_acq&gt; &lt;shm_toc_insert&gt;:              postgres/src/backend/storage/ipc/shm_toc.o\n      1 (LSE instructions)          &lt;__aarch64_swp4_acq&gt; &lt;shm_toc_freespace&gt;:           postgres/src/backend/storage/ipc/shm_toc.o\n      1 (LSE instructions)          &lt;__aarch64_swp4_acq&gt; &lt;shm_toc_allocate&gt;:            postgres/src/backend/storage/ipc/shm_toc.o\n      1 (LSE instructions)          &lt;__aarch64_swp4_acq&gt; &lt;shm_mq_set_sender&gt;:           postgres/src/backend/storage/ipc/shm_mq.o\n      1 (LSE instructions)          &lt;__aarch64_swp4_acq&gt; &lt;shm_mq_set_receiver&gt;:         postgres/src/backend/storage/ipc/shm_mq.o\n      1 (LSE instructions)          &lt;__aarch64_swp4_acq&gt; &lt;shm_mq_sendv&gt;:                postgres/src/backend/storage/ipc/shm_mq.o\n      1 (LSE instructions)          &lt;__aarch64_swp4_acq&gt; &lt;shm_mq_get_sender&gt;:           postgres/src/backend/storage/ipc/shm_mq.o\n      1 (LSE instructions)          &lt;__aarch64_swp4_acq&gt; &lt;shm_mq_get_receiver&gt;:         postgres/src/backend/storage/ipc/shm_mq.o\n      1 (LSE instructions)          &lt;__aarch64_swp4_acq&gt; &lt;shm_mq_detach_internal&gt;:      postgres/src/backend/storage/ipc/shm_mq.o\n      1 (LSE instructions)          &lt;__aarch64_swp4_acq&gt; &lt;ShmemAllocRaw&gt;:               postgres/src/backend/storage/ipc/shmem.o\n      1 (LSE instructions)          &lt;__aarch64_swp4_acq&gt; &lt;SharedFileSetOnDetach&gt;:       postgres/src/backend/storage/file/sharedfileset.o\n      1 (LSE instructions)          &lt;__aarch64_swp4_acq&gt; &lt;SharedFileSetAttach&gt;:         postgres/src/backend/storage/file/sharedfileset.o\n      1 (LSE instructions)          &lt;__aarch64_swp4_acq&gt; &lt;SetWalWriterSleeping&gt;:        postgres/src/backend/access/transam/xlog.o\n      1 (LSE instructions)          &lt;__aarch64_swp4_acq&gt; &lt;SetRecoveryPause&gt;:            postgres/src/backend/access/transam/xlog.o\n      1 (LSE instructions)          &lt;__aarch64_swp4_acq&gt; &lt;SetPromoteIsTriggered&gt;:       postgres/src/backend/access/transam/xlog.o\n      1 (LSE instructions)          &lt;__aarch64_swp4_acq&gt; &lt;SetOldSnapshotThresholdTimestamp&gt;: postgres/src/backend/utils/time/snapmgr.o\n      1 (LSE instructions)          &lt;__aarch64_swp4_acq&gt; &lt;RequestXLogStreaming&gt;:        postgres/src/backend/replication/walreceiverfuncs.o\n      1 (LSE instructions)          &lt;__aarch64_swp4_acq&gt; &lt;ReplicationSlotsDropDBSlots&gt;: postgres/src/backend/replication/slot.o\n      1 (LSE instructions)          &lt;__aarch64_swp4_acq&gt; &lt;ReplicationSlotsCountDBSlots&gt;: postgres/src/backend/replication/slot.o\n      1 (LSE instructions)          &lt;__aarch64_swp4_acq&gt; &lt;ReplicationSlotsComputeRequiredXmin&gt;: postgres/src/backend/replication/slot.o\n      1 (LSE instructions)          &lt;__aarch64_swp4_acq&gt; &lt;ReplicationSlotsComputeRequiredLSN&gt;: postgres/src/backend/replication/slot.o\n      1 (LSE instructions)          &lt;__aarch64_swp4_acq&gt; &lt;ReplicationSlotsComputeLogicalRestartLSN&gt;: postgres/src/backend/replication/slot.o\n      1 (LSE instructions)          &lt;__aarch64_swp4_acq&gt; &lt;ReplicationSlotPersist&gt;:      postgres/src/backend/replication/slot.o\n      1 (LSE instructions)          &lt;__aarch64_swp4_acq&gt; &lt;ReplicationSlotMarkDirty&gt;:    postgres/src/backend/replication/slot.o\n      1 (LSE instructions)          &lt;__aarch64_swp4_acq&gt; &lt;ReplicationSlotDropPtr&gt;:      postgres/src/backend/replication/slot.o\n      1 (LSE instructions)          &lt;__aarch64_swp4_acq&gt; &lt;ReplicationSlotCreate&gt;:       postgres/src/backend/replication/slot.o\n      1 (LSE instructions)          &lt;__aarch64_swp4_acq&gt; &lt;ReplicationSlotCleanup&gt;:      postgres/src/backend/replication/slot.o\n      1 (LSE instructions)          &lt;__aarch64_swp4_acq&gt; &lt;ReplicationSlotAcquireInternal&gt;: postgres/src/backend/replication/slot.o\n      1 (LSE instructions)          &lt;__aarch64_swp4_acq&gt; &lt;RemoveOldXlogFiles&gt;:          postgres/src/backend/access/transam/xlog.o\n      1 (LSE instructions)          &lt;__aarch64_swp4_acq&gt; &lt;RemoveLocalLock&gt;:             postgres/src/backend/storage/lmgr/lock.o\n      1 (LSE instructions)          &lt;__aarch64_swp4_acq&gt; &lt;RecoveryRestartPoint&gt;:        postgres/src/backend/access/transam/xlog.o\n      1 (LSE instructions)          &lt;__aarch64_swp4_acq&gt; &lt;RecoveryIsPaused&gt;:            postgres/src/backend/access/transam/xlog.o\n      1 (LSE instructions)          &lt;__aarch64_swp4_acq&gt; &lt;ReadRecord&gt;:                  postgres/src/backend/access/transam/xlog.o\n      1 (LSE instructions)          &lt;__aarch64_swp4_acq&gt; &lt;PublishStartupProcessInformation&gt;: postgres/src/backend/storage/lmgr/proc.o\n      1 (LSE instructions)          &lt;__aarch64_swp4_acq&gt; &lt;PromoteIsTriggered&gt;:          postgres/src/backend/access/transam/xlog.o\n      1 (LSE instructions)          &lt;__aarch64_swp4_acq&gt; &lt;ProcSendSignal&gt;:              postgres/src/backend/storage/lmgr/proc.o\n      1 (LSE instructions)          &lt;__aarch64_swp4_acq&gt; &lt;ProcessWalSndrMessage&gt;:       postgres/src/backend/replication/walreceiver.o\n      1 (LSE instructions)          &lt;__aarch64_swp4_acq&gt; &lt;PhysicalReplicationSlotNewXmin&gt;: postgres/src/backend/replication/walsender.o\n      1 (LSE instructions)          &lt;__aarch64_swp4_acq&gt; &lt;pg_stat_get_wal_senders&gt;:     postgres/src/backend/replication/walsender.o\n      1 (LSE instructions)          &lt;__aarch64_swp4_acq&gt; &lt;pg_stat_get_wal_receiver&gt;:    postgres/src/backend/replication/walreceiver.o\n      1 (LSE instructions)          &lt;__aarch64_swp4_acq&gt; &lt;pg_replication_slot_advance&gt;: postgres/src/backend/replication/slotfuncs.o\n      1 (LSE instructions)          &lt;__aarch64_swp4_acq&gt; &lt;ParallelWorkerReportLastRecEnd&gt;: postgres/src/backend/access/transam/parallel.o\n      1 (LSE instructions)          &lt;__aarch64_swp4_acq&gt; &lt;MaintainOldSnapshotTimeMapping&gt;: postgres/src/backend/utils/time/snapmgr.o\n      1 (LSE instructions)          &lt;__aarch64_swp4_acq&gt; &lt;LWLockNewTrancheId&gt;:          postgres/src/backend/storage/lmgr/lwlock.o\n      1 (LSE instructions)          &lt;__aarch64_swp4_acq&gt; &lt;LogicalIncreaseXminForSlot&gt;:  postgres/src/backend/replication/logical/logical.o\n      1 (LSE instructions)          &lt;__aarch64_swp4_acq&gt; &lt;LogicalIncreaseRestartDecodingForSlot&gt;: postgres/src/backend/replication/logical/logical.o\n      1 (LSE instructions)          &lt;__aarch64_swp4_acq&gt; &lt;lock_twophase_recover&gt;:       postgres/src/backend/storage/lmgr/lock.o\n      1 (LSE instructions)          &lt;__aarch64_swp4_acq&gt; &lt;LockRefindAndRelease&gt;:        postgres/src/backend/storage/lmgr/lock.o\n      1 (LSE instructions)          &lt;__aarch64_swp4_acq&gt; &lt;LockAcquireExtended&gt;:         postgres/src/backend/storage/lmgr/lock.o\n      1 (LSE instructions)          &lt;__aarch64_swp4_acq&gt; &lt;KnownAssignedXidsSearch&gt;:     postgres/src/backend/storage/ipc/procarray.o\n      1 (LSE instructions)          &lt;__aarch64_swp4_acq&gt; &lt;KnownAssignedXidsGetAndSetXmin&gt;: postgres/src/backend/storage/ipc/procarray.o\n      1 (LSE instructions)          &lt;__aarch64_swp4_acq&gt; &lt;KnownAssignedXidsAdd&gt;:        postgres/src/backend/storage/ipc/procarray.o\n      1 (LSE instructions)          &lt;__aarch64_swp4_acq&gt; &lt;KeepLogSeg&gt;:                  postgres/src/backend/access/transam/xlog.o\n      1 (LSE instructions)          &lt;__aarch64_swp4_acq&gt; &lt;InitWalSender&gt;:               postgres/src/backend/replication/walsender.o\n      1 (LSE instructions)          &lt;__aarch64_swp4_acq&gt; &lt;InitProcess&gt;:                 postgres/src/backend/storage/lmgr/proc.o\n      1 (LSE instructions)          &lt;__aarch64_swp4_acq&gt; &lt;InitAuxiliaryProcess&gt;:        postgres/src/backend/storage/lmgr/proc.o\n      1 (LSE instructions)          &lt;__aarch64_swp4_acq&gt; &lt;HotStandbyActive&gt;:            postgres/src/backend/access/transam/xlog.o\n      1 (LSE instructions)          &lt;__aarch64_swp4_acq&gt; &lt;HaveNFreeProcs&gt;:              postgres/src/backend/storage/lmgr/proc.o\n      1 (LSE instructions)          &lt;__aarch64_swp4_acq&gt; &lt;GetXLogWriteRecPtr&gt;:          postgres/src/backend/access/transam/xlog.o\n      1 (LSE instructions)          &lt;__aarch64_swp4_acq&gt; &lt;GetXLogReplayRecPtr&gt;:         postgres/src/backend/access/transam/xlog.o\n      1 (LSE instructions)          &lt;__aarch64_swp4_acq&gt; &lt;GetXLogInsertRecPtr&gt;:         postgres/src/backend/access/transam/xlog.o\n      1 (LSE instructions)          &lt;__aarch64_swp4_acq&gt; &lt;GetWalRcvFlushRecPtr&gt;:        postgres/src/backend/replication/walreceiverfuncs.o\n      1 (LSE instructions)          &lt;__aarch64_swp4_acq&gt; &lt;GetSnapshotCurrentTimestamp&gt;: postgres/src/backend/utils/time/snapmgr.o\n      1 (LSE instructions)          &lt;__aarch64_swp4_acq&gt; &lt;GetReplicationTransferLatency&gt;: postgres/src/backend/replication/walreceiverfuncs.o\n      1 (LSE instructions)          &lt;__aarch64_swp4_acq&gt; &lt;GetReplicationApplyDelay&gt;:    postgres/src/backend/replication/walreceiverfuncs.o\n      1 (LSE instructions)          &lt;__aarch64_swp4_acq&gt; &lt;GetRedoRecPtr&gt;:               postgres/src/backend/access/transam/xlog.o\n      1 (LSE instructions)          &lt;__aarch64_swp4_acq&gt; &lt;GetRecoveryState&gt;:            postgres/src/backend/access/transam/xlog.o\n      1 (LSE instructions)          &lt;__aarch64_swp4_acq&gt; &lt;GetOldSnapshotThresholdTimestamp&gt;: postgres/src/backend/utils/time/snapmgr.o\n      1 (LSE instructions)          &lt;__aarch64_swp4_acq&gt; &lt;GetLatestXTime&gt;:              postgres/src/backend/access/transam/xlog.o\n      1 (LSE instructions)          &lt;__aarch64_swp4_acq&gt; &lt;GetInsertRecPtr&gt;:             postgres/src/backend/access/transam/xlog.o\n      1 (LSE instructions)          &lt;__aarch64_swp4_acq&gt; &lt;GetFlushRecPtr&gt;:              postgres/src/backend/access/transam/xlog.o\n      1 (LSE instructions)          &lt;__aarch64_swp4_acq&gt; &lt;GetFakeLSNForUnloggedRel&gt;:    postgres/src/backend/access/transam/xlog.o\n      1 (LSE instructions)          &lt;__aarch64_swp4_acq&gt; &lt;GetCurrentChunkReplayStartTime&gt;: postgres/src/backend/access/transam/xlog.o\n      1 (LSE instructions)          &lt;__aarch64_swp4_acq&gt; &lt;FirstCallSinceLastCheckpoint&gt;: postgres/src/backend/postmaster/checkpointer.o\n      1 (LSE instructions)          &lt;__aarch64_swp4_acq&gt; &lt;element_alloc&gt;:               postgres/src/backend/utils/hash/dynahash.o\n      1 (LSE instructions)          &lt;__aarch64_swp4_acq&gt; &lt;do_pg_stop_backup&gt;:           postgres/src/backend/access/transam/xlog.o\n      1 (LSE instructions)          &lt;__aarch64_swp4_acq&gt; &lt;do_pg_start_backup&gt;:          postgres/src/backend/access/transam/xlog.o\n      1 (LSE instructions)          &lt;__aarch64_swp4_acq&gt; &lt;DecodingContextFindStartpoint&gt;: postgres/src/backend/replication/logical/logical.o\n      1 (LSE instructions)          &lt;__aarch64_swp4_acq&gt; &lt;ConditionVariableTimedSleep&gt;: postgres/src/backend/storage/lmgr/condition_variable.o\n      1 (LSE instructions)          &lt;__aarch64_swp4_acq&gt; &lt;ConditionVariableSignal&gt;:     postgres/src/backend/storage/lmgr/condition_variable.o\n      1 (LSE instructions)          &lt;__aarch64_swp4_acq&gt; &lt;ConditionVariablePrepareToSleep&gt;: postgres/src/backend/storage/lmgr/condition_variable.o\n      1 (LSE instructions)          &lt;__aarch64_swp4_acq&gt; &lt;ConditionVariableCancelSleep&gt;: postgres/src/backend/storage/lmgr/condition_variable.o\n      1 (LSE instructions)          &lt;__aarch64_swp4_acq&gt; &lt;ComputeXidHorizons&gt;:          postgres/src/backend/storage/ipc/procarray.o\n      1 (LSE instructions)          &lt;__aarch64_swp4_acq&gt; &lt;CheckXLogRemoved&gt;:            postgres/src/backend/access/transam/xlog.o\n      1 (LSE instructions)          &lt;__aarch64_swp4_acq&gt; &lt;CheckRecoveryConsistency.part.11&gt;: postgres/src/backend/access/transam/xlog.o\n      1 (LSE instructions)          &lt;__aarch64_swp4_acq&gt; &lt;_bt_parallel_seize&gt;:          postgres/src/backend/access/nbtree/nbtree.o\n      1 (LSE instructions)          &lt;__aarch64_swp4_acq&gt; &lt;_bt_parallel_scan_and_sort&gt;:  postgres/src/backend/access/nbtree/nbtsort.o\n      1 (LSE instructions)          &lt;__aarch64_swp4_acq&gt; &lt;btparallelrescan&gt;:            postgres/src/backend/access/nbtree/nbtree.o\n      1 (LSE instructions)          &lt;__aarch64_swp4_acq&gt; &lt;_bt_parallel_release&gt;:        postgres/src/backend/access/nbtree/nbtree.o\n      1 (LSE instructions)          &lt;__aarch64_swp4_acq&gt; &lt;_bt_parallel_done&gt;:           postgres/src/backend/access/nbtree/nbtree.o\n      1 (LSE instructions)          &lt;__aarch64_swp4_acq&gt; &lt;_bt_parallel_advance_array_keys&gt;: postgres/src/backend/access/nbtree/nbtree.o\n      1 (LSE instructions)          &lt;__aarch64_swp4_acq&gt; &lt;btbuild&gt;:                     postgres/src/backend/access/nbtree/nbtsort.o\n      1 (LSE instructions)          &lt;__aarch64_swp4_acq&gt; &lt;BarrierParticipants&gt;:         postgres/src/backend/storage/ipc/barrier.o\n      1 (LSE instructions)          &lt;__aarch64_swp4_acq&gt; &lt;BarrierDetach&gt;:               postgres/src/backend/storage/ipc/barrier.o\n      1 (LSE instructions)          &lt;__aarch64_swp4_acq&gt; &lt;BarrierAttach&gt;:               postgres/src/backend/storage/ipc/barrier.o\n      1 (LSE instructions)          &lt;__aarch64_swp4_acq&gt; &lt;BarrierArriveAndDetach&gt;:      postgres/src/backend/storage/ipc/barrier.o\n      1 (LSE instructions)          &lt;__aarch64_swp4_acq&gt; &lt;BarrierArriveAndDetachExceptLast&gt;: postgres/src/backend/storage/ipc/barrier.o\n      1 (LSE instructions)          &lt;__aarch64_swp4_acq&gt; &lt;AuxiliaryProcKill&gt;:           postgres/src/backend/storage/lmgr/proc.o\n      1 (LSE instructions)          &lt;__aarch64_swp4_acq&gt; &lt;AdvanceXLInsertBuffer&gt;:       postgres/src/backend/access/transam/xlog.o\n      1 (LSE instructions)          &lt;__aarch64_swp4_acq&gt; &lt;AbortStrongLockAcquire&gt;:      postgres/src/backend/storage/lmgr/lock.o\n      1 (LSE instructions)          &lt;__aarch64_ldset4_acq_rel&gt; &lt;ProcessProcSignalBarrier&gt;:    postgres/src/backend/storage/ipc/procsignal.o\n      1 (LSE instructions)          &lt;__aarch64_ldset4_acq_rel&gt; &lt;LWLockWaitForVar&gt;:            postgres/src/backend/storage/lmgr/lwlock.o\n      1 (LSE instructions)          &lt;__aarch64_ldset4_acq_rel&gt; &lt;LWLockQueueSelf&gt;:             postgres/src/backend/storage/lmgr/lwlock.o\n      1 (LSE instructions)          &lt;__aarch64_ldset4_acq_rel&gt; &lt;LWLockDequeueSelf&gt;:           postgres/src/backend/storage/lmgr/lwlock.o\n      1 (LSE instructions)          &lt;__aarch64_ldset4_acq_rel&gt; &lt;LWLockAcquire&gt;:               postgres/src/backend/storage/lmgr/lwlock.o\n      1 (LSE instructions)          &lt;__aarch64_ldset4_acq_rel&gt; &lt;LockBufHdr&gt;:                  postgres/src/backend/storage/buffer/bufmgr.o\n      1 (LSE instructions)          &lt;__aarch64_ldset4_acq_rel&gt; &lt;EmitProcSignalBarrier&gt;:       postgres/src/backend/storage/ipc/procsignal.o\n      1 (LSE instructions)          &lt;__aarch64_ldclr4_acq_rel&gt; &lt;LWLockReleaseClearVar&gt;:       postgres/src/backend/storage/lmgr/lwlock.o\n      1 (LSE instructions)          &lt;__aarch64_ldadd8_acq_rel&gt; &lt;table_block_parallelscan_nextpage&gt;: postgres/src/backend/access/table/tableam.o\n      1 (LSE instructions)          &lt;__aarch64_ldadd8_acq_rel&gt; &lt;EmitProcSignalBarrier&gt;:       postgres/src/backend/storage/ipc/procsignal.o\n      1 (LSE instructions)          &lt;__aarch64_ldadd4_acq_rel&gt; &lt;find_or_make_matching_shared_tupledesc&gt;: postgres/src/backend/utils/cache/typcache.o\n      1 (LSE instructions)          &lt;__aarch64_ldadd4_acq_rel&gt; &lt;ExecParallelHashJoin&gt;:        postgres/src/backend/executor/nodeHashjoin.o\n      1 (LSE instructions)          &lt;__aarch64_cas8_acq_rel&gt; &lt;table_block_parallelscan_reinitialize&gt;: postgres/src/backend/access/table/tableam.o\n      1 (LSE instructions)          &lt;__aarch64_cas8_acq_rel&gt; &lt;ProcWakeup&gt;:                  postgres/src/backend/storage/lmgr/proc.o\n      1 (LSE instructions)          &lt;__aarch64_cas8_acq_rel&gt; &lt;ProcSleep&gt;:                   postgres/src/backend/storage/lmgr/proc.o\n      1 (LSE instructions)          &lt;__aarch64_cas8_acq_rel&gt; &lt;pg_stat_get_wal_receiver&gt;:    postgres/src/backend/replication/walreceiver.o\n      1 (LSE instructions)          &lt;__aarch64_cas8_acq_rel&gt; &lt;InitProcess&gt;:                 postgres/src/backend/storage/lmgr/proc.o\n      1 (LSE instructions)          &lt;__aarch64_cas8_acq_rel&gt; &lt;InitAuxiliaryProcess&gt;:        postgres/src/backend/storage/lmgr/proc.o\n      1 (LSE instructions)          &lt;__aarch64_cas8_acq_rel&gt; &lt;GetWalRcvWriteRecPtr&gt;:        postgres/src/backend/replication/walreceiverfuncs.o\n      1 (LSE instructions)          &lt;__aarch64_cas8_acq_rel&gt; &lt;GetLockStatusData&gt;:           postgres/src/backend/storage/lmgr/lock.o\n      1 (LSE instructions)          &lt;__aarch64_cas8_acq_rel&gt; &lt;ExecParallelScanHashBucket&gt;:  postgres/src/backend/executor/nodeHash.o\n      1 (LSE instructions)          &lt;__aarch64_cas8_acq_rel&gt; &lt;CleanupProcSignalState&gt;:      postgres/src/backend/storage/ipc/procsignal.o\n      1 (LSE instructions)          &lt;__aarch64_cas4_acq_rel&gt; &lt;UnpinBuffer.constprop.11&gt;:    postgres/src/backend/storage/buffer/bufmgr.o\n      1 (LSE instructions)          &lt;__aarch64_cas4_acq_rel&gt; &lt;StrategySyncStart&gt;:           postgres/src/backend/storage/buffer/freelist.o\n      1 (LSE instructions)          &lt;__aarch64_cas4_acq_rel&gt; &lt;StrategyGetBuffer&gt;:           postgres/src/backend/storage/buffer/freelist.o\n      1 (LSE instructions)          &lt;__aarch64_cas4_acq_rel&gt; &lt;ProcessProcSignalBarrier&gt;:    postgres/src/backend/storage/ipc/procsignal.o\n      1 (LSE instructions)          &lt;__aarch64_cas4_acq_rel&gt; &lt;PinBuffer&gt;:                   postgres/src/backend/storage/buffer/bufmgr.o\n      1 (LSE instructions)          &lt;__aarch64_cas4_acq_rel&gt; &lt;MarkBufferDirty&gt;:             postgres/src/backend/storage/buffer/bufmgr.o\n      1 (LSE instructions)          &lt;__aarch64_cas4_acq_rel&gt; &lt;LWLockRelease&gt;:               postgres/src/backend/storage/lmgr/lwlock.o\n      1 (LSE instructions)          &lt;__aarch64_cas4_acq_rel&gt; &lt;LWLockConditionalAcquire&gt;:    postgres/src/backend/storage/lmgr/lwlock.o\n</code></pre>\n<p>So, this confirms that it was compiled with -march=armv8-a and outline -moutline-atomics (which is the default in GCC &gt;= 10 and also in the GCC 7 compiled in Amazon Linux 2). LSE (Large-System Extensions) are there, and we can see where the atomic instructions are used: WAL and buffer lightweight locks that protect access to shared memory.</p>\n<pre><code>for i in /usr/local/pgsql/bin/postgres $(find postgres/src/backend -name \"*.o\") ; do objdump -d \"$i\" | awk '/:$/{w=$2}/aarch64_(cas|casp|swp|ldadd|stadd|ldclr|stclr|ldeor|steor|ldset|stset|ldsmax|stsmax|ldsmin|stsmin|ldumax|stumax|ldumin|stumin)/{printf \"%-27s %-40s %-40s %-60s\\n\",\"(LSE instructions)\",$NF,w,f}/\\t(ldxr|ldaxr|stxr|stlxr)\\t/{printf \"%-27s %-40s %-40s %-60s\\n\",\"(load and store exclusives)\",$3,w,f}' f=\"$i\" ; done | sort | uniq -c | sort -rn\n\n      1 (load and store exclusives) stxr                                     &lt;__aarch64_swp4_acq&gt;:                    /usr/local/pgsql/bin/postgres\n      1 (load and store exclusives) stlxr                                    &lt;__aarch64_ldset4_acq_rel&gt;:              /usr/local/pgsql/bin/postgres\n      1 (load and store exclusives) stlxr                                    &lt;__aarch64_ldclr4_acq_rel&gt;:              /usr/local/pgsql/bin/postgres\n      1 (load and store exclusives) stlxr                                    &lt;__aarch64_ldadd8_acq_rel&gt;:              /usr/local/pgsql/bin/postgres\n      1 (load and store exclusives) stlxr                                    &lt;__aarch64_ldadd4_acq_rel&gt;:              /usr/local/pgsql/bin/postgres\n      1 (load and store exclusives) stlxr                                    &lt;__aarch64_cas8_acq_rel&gt;:                /usr/local/pgsql/bin/postgres\n      1 (load and store exclusives) stlxr                                    &lt;__aarch64_cas4_acq_rel&gt;:                /usr/local/pgsql/bin/postgres\n      1 (load and store exclusives) ldaxr                                    &lt;__aarch64_swp4_acq&gt;:                    /usr/local/pgsql/bin/postgres\n      1 (load and store exclusives) ldaxr                                    &lt;__aarch64_ldset4_acq_rel&gt;:              /usr/local/pgsql/bin/postgres\n      1 (load and store exclusives) ldaxr                                    &lt;__aarch64_ldclr4_acq_rel&gt;:              /usr/local/pgsql/bin/postgres\n      1 (load and store exclusives) ldaxr                                    &lt;__aarch64_ldadd8_acq_rel&gt;:              /usr/local/pgsql/bin/postgres\n      1 (load and store exclusives) ldaxr                                    &lt;__aarch64_ldadd4_acq_rel&gt;:              /usr/local/pgsql/bin/postgres\n      1 (load and store exclusives) ldaxr                                    &lt;__aarch64_cas8_acq_rel&gt;:                /usr/local/pgsql/bin/postgres\n      1 (load and store exclusives) ldaxr                                    &lt;__aarch64_cas4_acq_rel&gt;:                /usr/local/pgsql/bin/postgres\n</code></pre>\n<p>This confirms that the PostgreSQL binary also contains load and store exclusives so that the binary can run on Graviton and Graviton2.</p>\n<pre><code>\n[ec2-user@ip-172-31-11-116 ~]$ nm /usr/local/pgsql/bin/postgres | grep -E \"aarch64(_have_lse_atomics)?\"\n\n00000000008fb460 t __aarch64_cas4_acq_rel\n00000000008fb490 t __aarch64_cas8_acq_rel\n0000000000bbe640 b __aarch64_have_lse_atomics\n00000000008fb4f0 t __aarch64_ldadd4_acq_rel\n00000000008fb580 t __aarch64_ldadd8_acq_rel\n00000000008fb520 t __aarch64_ldclr4_acq_rel\n00000000008fb550 t __aarch64_ldset4_acq_rel\n00000000008fb4c0 t __aarch64_swp4_acq\n</code></pre>\n<p>This is the run-time detection. As it was compiled for ARM v8, with atomics outlined, the same binary can run on v8 or &gt;=v8.1</p>\n<pre><code>\n[ec2-user@ip-172-31-11-116 ~]$ gcc --version\ngcc (GCC) 7.3.1 20180712 (Red Hat 7.3.1-12)\nCopyright (C) 2017 Free Software Foundation, Inc.\nThis is free software; see the source for copying conditions.  There is NO\nwarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n</code></pre>\n<p>This is GCC 7, but on Amazon Linux 2 it has been patched to enable -moutline-atomics by default.</p>\n<h3>Install latest version of GCC (version 11 experimental)</h3>\n<p>Here is how I compiled the latest GCC available:</p>\n<pre><code>\ngcc --version\nsudo yum -y install bzip2 git gcc gcc-c++ gmp-devel mpfr-devel libmpc-devel make flex bison\ngit clone https://github.com/gcc-mirror/gcc.git\ncd gcc\nmake distclean\n./configure --enable-languages=c,c++\nmake\nsudo make install\n</code></pre>\n<p>This basically get the latest GCC fron source, compiles and installs it (please remember this is a lab &#8211; use stable versions elswhere)</p>\n<pre><code>[ec2-user@ip-172-31-38-254 ~]$ gcc --version\ngcc (GCC) 11.0.1 20210309 (experimental)\nCopyright (C) 2021 Free Software Foundation, Inc.\nThis is free software; see the source for copying conditions.  There is NO\nwarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.</code></pre>\n<p>Here we are: gcc 11.0.1 20210309 (experimental)</p>\n<h3>PGIO LIOPS</h3>\n<p>I&#8217;m running the same PGIO as in previous post</p>\n<pre><code>\nDate: Wed Mar 10 14:39:38 UTC 2021\nDatabase connect string: \"pgio\".\nShared buffers: 8500MB.\nTesting 4 schemas with 1 thread(s) accessing 1024M (131072 blocks) of each schema.\nRunning iostat, vmstat and mpstat on current host--in background.\nLaunching sessions. 4 schema(s) will be accessed by 1 thread(s) each.\npg_stat_database stats:\n          datname| blks_hit| blks_read|tup_returned|tup_fetched|tup_updated\nBEFORE:  pgio    | 38262338086 |    562443 |  37644815538 | 37635763756 |          24\nAFTER:   pgio    | 49691750429 |    562449 |  48890461241 | 48878858651 |          49\nDBNAME:  pgio. 4 schemas, 1 threads(each). Run time: 3600 seconds. RIOPS &gt;793709&lt;\n</code></pre>\n<p>This is a little higher than what I had: 793709 LIOPS / CPU where I had 780651 with GCC 7 but that&#8217;s still lower than the 896280 I had on x86.</p>\n<p>Of course, there can be more optimisations as mentioned in <a href=\"https://github.com/aws/aws-graviton-getting-started/blob/master/c-c++.md\" target=\"_blank\" rel=\"noopener\">https://github.com/aws/aws-graviton-getting-started/blob/master/c-c++.md</a><br />\nI&#8217;ll recompile with the recommended flags</p>\n<pre><code>(\ncd postgres\nCFLAGS=\"-march=armv8.2-a+fp16+rcpc+dotprod+crypto -mtune=neoverse-n1 -fsigned-char\" ./configure\nmake clean\nmake\nmake install\n)</code></pre>\n<p>I didn&#8217;t make any difference in the PGIO run. Of course, this may change with a read-write workload (more spinlocks) with checksum.</p>\n<p>Note that I compiled with the default (empty) CFLAGS and then gcc was called with -march=armv8-a+crc (and -moutline-atomics is the default) so I&#8217;m in the same situation with run-time detection. Because the GCC &gt;=10 behaviour has been backported by Amazon to the GCC 7 in Amazon Linux 2. This was not clear for me initially (I got this clarified <a href=\"https://github.com/aws/aws-graviton-getting-started/issues/107\" target=\"_blank\" rel=\"noopener\">here</a>).</p>\n<p>By the way, Aurora on Graviton2 is still compiled with GCC 7.4<br />\n<a href=\"https://www.dbi-services.com/blog/wp-content/uploads/sites/2/2022/04/Screenshot-2021-03-15-091805-1.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-48465\" src=\"https://www.dbi-services.com/blog/wp-content/uploads/sites/2/2022/04/Screenshot-2021-03-15-091805-1.jpg\" alt=\"\" width=\"1123\" height=\"342\" /></a></p>\n<p><b>Update 15-MAY-2021</b>: I have rephrased a few things here which were not clear (even for myself) but I&#8217;ll write more on <a href=\"https://www.dbi-services.com/blog/postgresql-on-aws-graviton2-cflags/\" target=\"_blank\" rel=\"noopener\">PostgreSQL on ARM</a>, and on benchmarks in general. <a href=\"http://blog.pachot.net\" target=\"_blank\" rel=\"noopener\">http://blog.pachot.net</a> should send to the right place (or <a href=\"https://twitter.com/FranckPachot\" target=\"_blank\" rel=\"noopener\">@FranckPachot</a> twitter of course)</p>\n",
    "protected": false
  }
}
