|
| 1 | +# Swap-performance |
| 2 | +Using a raspbian lite / zram-config and https://github.com/StuartIanNaylor/MagicMirror-Install-Guide-Raspberry-0-to-3 |
| 3 | +with mirrorcomplex and plymouth pretty. |
| 4 | + |
| 5 | +15 min boots logging /proc/loadavg every 2 secs stored in a spreadsheet with the average of 3 datasets looking at:- |
| 6 | +1st 30 seconds |
| 7 | +1st Minute |
| 8 | +1st 2 minutes |
| 9 | +Overall load |
| 10 | +Last 2 minutes |
| 11 | +Last minute |
| 12 | + |
| 13 | + |
| 14 | + |
| 15 | +_____ |
| 16 | + |
| 17 | +### Performance |
| 18 | +LZO/4 offer the best performance and for swaps they are probably the defacto choice. |
| 19 | +You maybe have text based low impact directories such a /var/log /var/cache where highly |
| 20 | +effective text compressors, such as deflate(zlib) & zstd are used in preference of disk size |
| 21 | +and effective compression that can be up to 200% of what a LZ may achieve. |
| 22 | +/tmp I am not so sure about incur any further load on what can be small blistering fast |
| 23 | +ram mounted tmpfs as if memory gets short then zram swaps will provide. |
| 24 | +That way your system is performance optimised and also memory optimised via zram swap, |
| 25 | +with compression overhead of some common working directories. |
| 26 | +The choice is yours though and its very dependent on the loading you commonly run with. |
| 27 | +Its only at intense load the slight overhead of zram compression becomes noticeable. |
| 28 | +A Pi-Zero obviously shows far more effect than a Pi-3B+ |
| 29 | +LZO-RLE has roled out in the latest kernels and is the new default for zram and still don't |
| 30 | +know if that will change my own personal pick of LZ4. |
| 31 | +Until I can find another comparative benchmark that includes all this list is a good yardstick. |
| 32 | + |
| 33 | +| Compressor name | Ratio | Compression | Decompress. | |
| 34 | +|------------------------|----------|-------------|-------------| |
| 35 | +|zstd 1.3.4 -1 | 2.877 | 470 MB/s | 1380 MB/s | |
| 36 | +|zlib 1.2.11 -1 | 2.743 | 110 MB/s | 400 MB/s | |
| 37 | +|brotli 1.0.2 -0 | 2.701 | 410 MB/s | 430 MB/s | |
| 38 | +|quicklz 1.5.0 -1 | 2.238 | 550 MB/s | 710 MB/s | |
| 39 | +|lzo1x 2.09 -1 | 2.108 | 650 MB/s | 830 MB/s | |
| 40 | +|lz4 1.8.1 | 2.101 | 750 MB/s | 3700 MB/s | |
| 41 | +|snappy 1.1.4 | 2.091 | 530 MB/s | 1800 MB/s | |
| 42 | +|lzf 3.6 -1 | 2.077 | 400 MB/s | 860 MB/s | |
| 43 | + |
| 44 | +With Swaps Zram changes what are static assumptions of HHD providing swaps in terms of swapiness |
| 45 | +and page-cache where default swapiness is 60 and page-cache is 3 to buffer page-writes of 8. |
| 46 | +Employing near memory based swaps needs tuning for near memory based swaps and the current defaults |
| 47 | +are far from optimised. |
| 48 | +Depending on avg load Zram will benefit from a setting of 80 -100 and changing page-cache to 0 so that |
| 49 | +singular pages are written will greatly reduce latency. |
| 50 | +Its a shame swapiness is not dynamically based on load as for many systems there is often a huge difference |
| 51 | +in boot startup to settled load. |
| 52 | +In some cases you may find you are reducing swapiness purely because of boot load. |
0 commit comments