Site Tools


start:zramswap

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
start:zramswap [2023/03/09 01:51] peterstart:zramswap [2023/09/13 18:36] (current) peter
Line 1: Line 1:
 +DATE CHECKED THIS PAGE WAS VALID: 13/09/2023 
 +
 Ubuntu and Debian are fairly similar - zramswap lets you get more ram use/tricks system into thinking there is more by compressing parts of your RAM. Ubuntu and Debian are fairly similar - zramswap lets you get more ram use/tricks system into thinking there is more by compressing parts of your RAM.
  
Line 14: Line 16:
  
 {{:images:htop.png|}} {{:images:htop.png|}}
 +
 +=== Actual Setup ===
  
 Either way, lets setup zramswap. Either way, lets setup zramswap.
Line 94: Line 98:
  
 Some suggested values:  Some suggested values: 
-1,or 4GB systems : zramswap the same size as RAM but zstd compression and a swapfile the same size as zramswap value eg: +1GB,2GB or 4GB systems : zramswap the same size as RAM but zstd compression and a swapfile the same size as zramswap value eg: 
-4GB RAM example - zramswap set to 4GB also and Swap partition of 4GB also. Thus you see 4GB RAM in htop and 8GB swap (4gb being zramswap). 1,and 4gb systems tend to have too little RAM (eg: raspberry pi etc) and setting a large value and accepting a slower compression at cost of CPU can improve performance in most cases.+4GB RAM example - zramswap set to 4GB also and Swap partition of 4GB also. Thus you see 4GB RAM in htop and 8GB swap (4gb being zramswap). 1GB,2GB and 4GB systems tend to have too little RAM (eg: raspberry pi etc) and setting a large value and accepting a slower compression at cost of CPU can improve performance in most cases. (See swappiness page on systems for low ram - you may wish to set swappiness to 101).
  
-8GB, 16GB systems : zramswap half the size of RAM, swapfile half the size of RAM (equal to zramswap value).+8GB, 16GB systems : zramswap half the size of RAM, swapfile half the size of RAM (equal to zramswap value). lz4 for all RAM values 8GB or more (faster, not RAM constrained machines).
  
 32GB RAM and beyond : zramswap 25% of RAM, swapfile same value. 32GB RAM and beyond : zramswap 25% of RAM, swapfile same value.
  
 Reason for 32GB and more systems using this is that zramswap tends to be less speedy than just using RAM alone so if you already have a ton of RAM its benefit starts to tail off as you have more and more available RAM. In some cases you might find a use case for it but mostly when you start getting to the stage where you have ample RAM, its benefit is of lower value so you may as well not set large values anymore, or use it at all. Reason for 32GB and more systems using this is that zramswap tends to be less speedy than just using RAM alone so if you already have a ton of RAM its benefit starts to tail off as you have more and more available RAM. In some cases you might find a use case for it but mostly when you start getting to the stage where you have ample RAM, its benefit is of lower value so you may as well not set large values anymore, or use it at all.
 +
 +Some exceptions might be a 64GB system with a large database and increasing RAM could be too costly so you are forced to increase RAM some other way. This situation it might be best to use zstd and a 75% value of ram for zramswap. This could be a balance until you can afford to pay for more RAM or upgrade your VPS.
 +
 +Note if you are running any sort of database do not go beyond 85% of your ram under any circumstances and regardless of how much or little ram you have. Dont do it. 
  
  
-Etc. Test your own values. Milage might vary.+Etc. Test your own values. Mileage might vary.
start/zramswap.1678326683.txt.gz · Last modified: 2023/03/09 01:51 by peter