memoria_swap
Különbségek
A kiválasztott változat és az aktuális verzió közötti különbségek a következők.
| Következő változat | Előző változat | ||
| memoria_swap [2022/07/26 06:30] – létrehozva daevidt | memoria_swap [2024/04/16 11:45] (aktuális) – daevidt | ||
|---|---|---|---|
| Sor 1: | Sor 1: | ||
| - | == Swapfile == | + | ===== Swapfile |
| - | === Swapfile készítése === | + | ==== Swapfile készítése |
| - | === Swap ki / bekapcsolása === | + | ==== Swap ki / bekapcsolása |
| Nézd meg, hogy van-e elég memóriád, hogy a swap beleférjen. Ha nincs, akkor valamit zárj be, mert ha nem, az oomkiller fogja. | Nézd meg, hogy van-e elég memóriád, hogy a swap beleférjen. Ha nincs, akkor valamit zárj be, mert ha nem, az oomkiller fogja. | ||
| + | <code bash> | ||
| swapoff -a | swapoff -a | ||
| swapon -a | swapon -a | ||
| + | </ | ||
| Sok használatban lévő memória esetén nagyon sokáig is tarthat a swapoff. Ez esetben az alábbit érdemes kipróbálni. | Sok használatban lévő memória esetén nagyon sokáig is tarthat a swapoff. Ez esetben az alábbit érdemes kipróbálni. | ||
| - | ==== Python script a swapoff felgyorsítására | + | === Python script a swapoff felgyorsítására === |
| forrás: [[https:// | forrás: [[https:// | ||
| Yup, the swapoff mechanism is horrendously inefficient. The workaround is easy: iterate over processes, instead iterating over the swapped pages. Use this python script (I am not affiliated): | Yup, the swapoff mechanism is horrendously inefficient. The workaround is easy: iterate over processes, instead iterating over the swapped pages. Use this python script (I am not affiliated): | ||
| + | <code bash> | ||
| git clone https:// | git clone https:// | ||
| cd ./ | cd ./ | ||
| sudo python3 deswappify_auto.py -d -v info | sudo python3 deswappify_auto.py -d -v info | ||
| + | </ | ||
| Note that the daemon mode of operation is only for desktops/ | Note that the daemon mode of operation is only for desktops/ | ||
| + | <code bash> | ||
| swapoff /dev/x | swapoff /dev/x | ||
| + | </ | ||
| Since most of the pages are now present both in swap and in memory, the swapoff has very little to do and should be now blazingly fast (I saw hundreds of MB/s). | Since most of the pages are now present both in swap and in memory, the swapoff has very little to do and should be now blazingly fast (I saw hundreds of MB/s). | ||
| - | ===== History section ahead ===== | + | == History section ahead == |
| The aforementioned python script is based on the rest of this answer, which in turn was my improvement of this older answer authored by jlong. As the script is much much safer I recommend to only try the rest of my answer as the last line of defense: | The aforementioned python script is based on the rest of this answer, which in turn was my improvement of this older answer authored by jlong. As the script is much much safer I recommend to only try the rest of my answer as the last line of defense: | ||
| - | | + | <code bash> |
| This runs maybe 2 seconds and won't actually do anything, just list the top 10 memory segments (actually it prints more one-liners; yes I do love one-liners; just examine the commands, accept the risk, copy and paste into your shell; these will actually read from swap). | This runs maybe 2 seconds and won't actually do anything, just list the top 10 memory segments (actually it prints more one-liners; yes I do love one-liners; just examine the commands, accept the risk, copy and paste into your shell; these will actually read from swap). | ||
| ...Paste the generated one-liners... | ...Paste the generated one-liners... | ||
| + | <code bash> | ||
| swapoff / | swapoff / | ||
| + | </ | ||
| The main one-liner is safe (for me), except it reads a lot of /proc. | The main one-liner is safe (for me), except it reads a lot of /proc. | ||
| Sor 60: | Sor 64: | ||
| The output starts with the size, so it's easy enough to pass it trough | sort -Vr | head to get top 10 largest segments by size (SSIZE). The -V stands for version-number-suitable sorting, but it works for my purpose. I couldn' | The output starts with the size, so it's easy enough to pass it trough | sort -Vr | head to get top 10 largest segments by size (SSIZE). The -V stands for version-number-suitable sorting, but it works for my purpose. I couldn' | ||
| + | |||
| + | ===== Programok memóriahasználata, | ||
| + | |||
| + | https:// | ||
| + | |||
memoria_swap.1658817028.txt.gz · Utolsó módosítás: 2022/07/26 06:30 szerkesztette: daevidt
