github-ci: switch off swap use
Github Actions provides hosts for Linux base runners in the following configurations: 2 Cores 7 Gb memory 4 Gb swap memory To avoid of issues with hanging/slowing tests on high memory use like [1], hosts configurations must avoid of swap memory use. All of the tests workflows run inside dockers containers. This patch sets in docker run configurations memory limits based on current github actions hosts - 7Gb memory w/o swap memory increase. Checked 10 full runs (29 workflows in each run used the change) and got single failed test on gevent() routine in test-run. This result much better than w/o this patch when 3-4 of workflows fail on each full run. It could happen because swappiness set to default value: cat /sys/fs/cgroup/memory/memory.swappiness 60 From documentation on swappiness [2]: This control is used to define the rough relative IO cost of swapping and filesystem paging, as a value between 0 and 200. At 100, the VM assumes equal IO cost and will thus apply memory pressure to the page cache and swap-backed pages equally; lower values signify more expensive swap IO, higher values indicates cheaper. Keep in mind that filesystem IO patterns under memory pressure tend to be more efficient than swap's random IO. An optimal value will require experimentation and will also be workload-dependent. We may try to tune how often anonymous pages are swapped using the swappiness parameter, but our goal is to stabilize timings (and make them as predictable as possible), so the best option is to disable swap at all and work on descreasing memory consumption for huge tests. For Github Actions host configurations with 7Gb RAM it means that after 2.8Gb RAM was used swap began to use. But in testing we have some tests that use 2.5Gb of RAM like 'box/net_msg_max.test.lua' and memory fragmentation could cause after the test run swap use [3]. Also found that disk cache could use some RAM and it also was the cause of fast memory use and start swapping. It can be periodically dropped from memory [4] using 'drop_cache' system value setup, but it won't fix the overall issue with swap use. After freed cached pages in RAM another system kernel option can be tuned [5][6] 'vfs_cache_pressure'. This percentage value controls the tendency of the kernel to reclaim the memory which is used for caching of directory and inode objects. Increasing it significantly beyond default value of 100 may have negative performance impact. Reclaim code needs to take various locks to find freeable directory and inode objects. With 'vfs_cache_pressure=1000', it will look for ten times more freeable objects than there are. This patch won't do this change, but it can be done as the next change. To fix the issue there were made changes: - For jobs that run tests and use actions/environment and don't use Github Actions container tag, it was set 'sudo swapoff -a' command in actions/environment action. - For jobs that run tests and use Github Actions container tag the previous solution doesn't work. It was decided to hard-code the memory value based on found on Github Actions hosts memory size 7Gb. It was set for Github container tag as additional options: options: '--init --memory=7G --memory-swap=7G' This changes were made temporary till these containers tags will be removed within resolving tarantool/tarantool-qa#101 issue for workflows: debug_coverage release release_asan_clang11 release_clang release_lto release_lto_clang11 static_build static_build_cmake_linux - For VMware VMs like with FreeBSD added 'sudo swapoff -a' command before build commands. - For OSX on Github actions hosts swapping already disabled: sysctl vm.swapusage vm.swapusage: total = 0.00M used = 0.00M free = 0.00M (encrypted) Also manual switching off swap currently not possible due to do System Integrity Protection (SIP) must be disabled [7], but we don't have such access on Github Actions hosts. For local hosts it must be done manually with [8]: sudo nvram boot-args="vm_compressor=2" Added swap status control to be sure that host correctly configured: sysctl vm.swapusage Closes tarantool/tarantool-qa#99 [1]: https://github.com/tarantool/tarantool-qa/issues/93 [2]: https://github.com/torvalds/linux/blob/1e43c377a79f9189fea8f2711b399d4e8b4e609b/Documentation/admin-guide/sysctl/vm.rst#swappiness [3]: https://unix.stackexchange.com/questions/2658/why-use-swap-when-there-is-more-than-enough-free-space-in-ram [4]: https://kubuntu.ru/node/13082 [5]: https://www.kernel.org/doc/Documentation/sysctl/vm.txt [6]: http://devhead.ru/read/uskorenie-raboty-linux [7]: https://osxdaily.com/2010/10/08/mac-virtual-memory-swap/ [8]: https://gist.github.com/dan-palmer/3082266#gistcomment-3667471
Showing
- .github/actions/environment/action.yml 31 additions, 0 deletions.github/actions/environment/action.yml
- .github/workflows/debug_coverage.yml 3 additions, 1 deletion.github/workflows/debug_coverage.yml
- .github/workflows/release.yml 3 additions, 1 deletion.github/workflows/release.yml
- .github/workflows/release_asan_clang11.yml 3 additions, 1 deletion.github/workflows/release_asan_clang11.yml
- .github/workflows/release_clang.yml 3 additions, 1 deletion.github/workflows/release_clang.yml
- .github/workflows/release_lto.yml 3 additions, 1 deletion.github/workflows/release_lto.yml
- .github/workflows/release_lto_clang11.yml 3 additions, 1 deletion.github/workflows/release_lto_clang11.yml
- .github/workflows/static_build.yml 3 additions, 1 deletion.github/workflows/static_build.yml
- .github/workflows/static_build_cmake_linux.yml 3 additions, 1 deletion.github/workflows/static_build_cmake_linux.yml
- .travis.mk 7 additions, 0 deletions.travis.mk
Loading
Please register or sign in to comment