Felhasználói eszközök

Eszközök a webhelyen


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.

Összehasonlító nézet linkje

Előző változat mindkét oldalonElőző változat
Következő változat
Előző változat
memoria_swap [2022/07/26 06:32] daevidtmemoria_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
 +</code>
 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://unix.stackexchange.com/questions/45673/how-can-swapoff-be-that-slow]] forrás: [[https://unix.stackexchange.com/questions/45673/how-can-swapoff-be-that-slow]]
  
 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://github.com/wiedemannc/deswappify-auto   git clone https://github.com/wiedemannc/deswappify-auto
   cd ./deswappify-auto   cd ./deswappify-auto
   sudo python3 deswappify_auto.py -d -v info   sudo python3 deswappify_auto.py -d -v info
 +</code>
 Note that the daemon mode of operation is only for desktops/laptops that are often hibernated. I wouldn't run it as a daemon on a server system - just run it for a while, wait until it reports it took care of some processes then stop it and try: Note that the daemon mode of operation is only for desktops/laptops that are often hibernated. I wouldn't run it as a daemon on a server system - just run it for a while, wait until it reports it took care of some processes then stop it and try:
 +<code bash>
   swapoff /dev/x   swapoff /dev/x
 +</code>
 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:
  
Sor 30: Sor 32:
  
 ...Paste the generated one-liners... ...Paste the generated one-liners...
 +<code bash>
   swapoff /your/swap    # much faster now   swapoff /your/swap    # much faster now
 +</code>
  
 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't figure how to make numerical sort work. 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't figure how to make numerical sort work.
 +
 +===== Programok memóriahasználata, swap =====
 +
 +https://lib.hofelho.hu/#book_id=4117&library_id=db&panel=book_details
 +
memoria_swap.1658817176.txt.gz · Utolsó módosítás: 2022/07/26 06:32 szerkesztette: daevidt