Expanding memory capabilities ~ RAM+SWAP


#1

So I’d like to change MineOS so that it uses swap instead of physical memory. I know that it’s not recommended to use swap/ramfs/tempfs but with my hardware I’d prefer to use swap. I’ve created a swap img at 4GB in “/var”, mounted it, the system shows it mounted (and remounts after reboot) but it still shows that none of swap is being used. What I’m really trying to do is minimize the usage of physical RAM and use swap sort of as a replacement, but not fully. The MineOS main services (such as the web server, ssh) would run off RAM, but the Minecraft Server would run completely from swap. Is there any way for that to be accomplished?


#2

This may be of help https://www.digitalocean.com/community/tutorials/how-to-add-swap-on-ubuntu-14-04


#3

Yeah I’ve already configured everything, it’s just not being used.

When I do free it shows 0 as well as on login

root@core ~# free
            total       used       free     shared    buffers     cached
Mem:       1994112    1845908     148204          0      22428     170240
-/+ buffers/cache:    1653240     340872
Swap:      6124536          0    6124536

  System information (as of Fri Mar 20 13:57:00 2015)

System load:  0.60              Memory usage:  92%
Processes:    83                Swap usage:    0%
Usage of /:   9.2% of 72.52GB   IP address for eth0:  192.168.1.11

#4

I’m not certain there should be any case, at all–any edge case or any one-off–that could warrant preferring swap over real memory.

Real memory is orders of magnitude quicker, on the order of hundreds even if you have an SSD. In fact, I would think it might actually be literally impossible to run Minecraft completely from swap.

Can you explain what is to be gained by having “minimized the usage of physical RAM?” RAM is designed for precisely what it’s doing, which is holding frequently accessed, frequently changed values…none of which could be even slightly tolerable performance-wise even if on the fastest SSD available on the market.

What is your goal with trying to use swap?


#5

I actually don’t mind that RAM is faster, however the server would run out of memory constantly with only about 5+ players unless they’re in the same area and I occasionally AsyncWorldEdit some huge schematics in but asynchronously still fails because the server runs out of memory. My real goal is to avoid having to save about $500-$700 to buy/build a new system since I’m on a very tight budget so it would take months just to get that done. If I can run the server from swap and it works (the speed, etc doesn’t matter to me as long as it works) I’ll setup an online shop to raise money that way so eventually I would be using RAM over swap.


#6

alright, let me rephrase: no minecraft game server can run strictly off of swap. That’s not how computers work.


#7

Well I’ve been playing around with it for a few weeks, and I got it to actually use swap with the server (so it moves any idle plugins, chunks, etc into swap until they eventually unload, or back into RAM when needed) but anyways forget about the above; I’ve found this script called zram but couldn’t get it working. I installed Ubuntu on another computer with less capabilities (which of course took alittle longer and periodically froze) then installed zram there and surprisingly all the stories about zram making your PC “faster” were true (yes I know it doesn’t really make it faster but it just didn’t freeze when I performed the same tests over and over again) so I’d like to know is there any way I could get this to work with MineOS?


#8

Don’t think of this in terms of “how do I get zram to work with MineOS”–MineOS is an application, a front-end, even for Minecraft servers.

MineOS runs commands on your behalf to run Java instances that run the Minecraft jar. It is Minecraft that would need to leverage this zram. And you don’t need to tell Minecraft/Java to use this RAM, that’s zram's job to jump in on its own, based on your configuration.

That said, Googling seems to be in agreement about how zram is installed on Ubuntu: apt-get install zram-config.