You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by pe...@apache.org on 2021/04/15 08:56:23 UTC

[pulsar] branch master updated: Tune GitHub Runner VM options to increase working RAM and improve performance (#10239)

This is an automated email from the ASF dual-hosted git repository.

penghui pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pulsar.git


The following commit(s) were added to refs/heads/master by this push:
     new 4f2e451  Tune GitHub Runner VM options to increase working RAM and improve performance (#10239)
4f2e451 is described below

commit 4f2e451330c89fc5ca3c18eec00e10b77c75ef82
Author: Lari Hotari <lh...@users.noreply.github.com>
AuthorDate: Thu Apr 15 11:55:47 2021 +0300

    Tune GitHub Runner VM options to increase working RAM and improve performance (#10239)
    
    - The default vm.swappiness setting is 60 which has a tendency to start swapping when memory
      consumption is high.
      - Set vm.swappiness=1 to avoid swapping and allow high RAM usage
    
    - Use "madvise" Linux Transparent HugePages (THP) setting
      - https://www.kernel.org/doc/html/latest/admin-guide/mm/transhuge.html
      - "madvise" is generally a better option than the default "always" setting
    
    - Tune filesystem mount options, https://www.kernel.org/doc/Documentation/filesystems/ext4.txt
      - commit=999999, effectively disables automatic syncing to disk (default is every 5 seconds)
      - nobarrier/barrier=0, loosen data consistency on system crash (no negative impact to empheral CI nodes)
    
    - disable discard/trim at device level since remount with nodiscard doesn't seem to be effective
    
    - disable any background jobs that run SSD discard/trim
      - SSD discard/trim has negative performance impact
        - https://docs.microsoft.com/en-us/azure/virtual-machines/linux/attach-disk-portal#trimunmap-support-for-linux-in-azure
        - On Azure VMs, the reason to use discard/trim is to optimize storage cost on virtual disks.
        - This isn't useful on empheral CI nodes
---
 .github/actions/tune-runner-vm/action.yml | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/.github/actions/tune-runner-vm/action.yml b/.github/actions/tune-runner-vm/action.yml
index 59f977c..ec5599a 100644
--- a/.github/actions/tune-runner-vm/action.yml
+++ b/.github/actions/tune-runner-vm/action.yml
@@ -27,5 +27,31 @@ runs:
             # Ensure that reverse lookups for current hostname are handled properly
             # Add the current IP address, long hostname and short hostname record to /etc/hosts file
             echo -e "$(ip addr show eth0 | grep "inet\b" | awk '{print $2}' | cut -d/ -f1)\t$(hostname -f) $(hostname -s)" | sudo tee -a /etc/hosts
+
+            # The default vm.swappiness setting is 60 which has a tendency to start swapping when memory
+            # consumption is high.
+            # Set vm.swappiness=1 to avoid swapping and allow high RAM usage
+            echo 1 | sudo tee /proc/sys/vm/swappiness
+
+            # use "madvise" Linux Transparent HugePages (THP) setting
+            # https://www.kernel.org/doc/html/latest/admin-guide/mm/transhuge.html
+            # "madvise" is generally a better option than the default "always" setting
+            echo madvise | sudo tee /sys/kernel/mm/transparent_hugepage/enabled
+
+            # tune filesystem mount options, https://www.kernel.org/doc/Documentation/filesystems/ext4.txt
+            # commit=999999, effectively disables automatic syncing to disk (default is every 5 seconds)
+            # nobarrier/barrier=0, loosen data consistency on system crash (no negative impact to empheral CI nodes)
+            sudo mount -o remount,nodiscard,commit=999999,barrier=0 /
+            sudo mount -o remount,nodiscard,commit=999999,barrier=0 /mnt
+            # disable discard/trim at device level since remount with nodiscard doesn't seem to be effective
+            # https://www.spinics.net/lists/linux-ide/msg52562.html
+            for i in /sys/block/sd*/queue/discard_max_bytes; do
+              echo 0 | sudo tee $i
+            done
+            # disable any background jobs that run SSD discard/trim
+            sudo systemctl disable fstrim.timer || true
+            sudo systemctl stop fstrim.timer || true
+            sudo systemctl disable fstrim.service || true
+            sudo systemctl stop fstrim.service || true
         fi
       shell: bash
\ No newline at end of file