>2GB RAM needed to avoid swap file?


(Ben) #1

I’m following the directions here to install Discourse on a Digital Ocean server: How To Install Discourse on Ubuntu 16.04 | DigitalOcean

The guide says:

Note: Discourse requires a swap file if you are using 1GB of RAM. Although swap is generally recommended for systems utilizing traditional spinning hard drives, using swap with SSDs can cause issues with hardware degradation over time.

The Discourse FAQ lists the memory requirements as 1GB of RAM:

You can deploy our standard Discourse Docker container on any virtualized cloud server (digital ocean, amazon ec2, rackspace, azure) with 1GB RAM.

So I upgraded the Digital Ocean droplet to 2GB of RAM to be able to install without the swap. However, upon attempting to install I get the following message:

WARNING: Discourse requires at least 2GB of swap when running with 2GB of RAM
or less. This system does not appear to have sufficient swap space.

Without sufficient swap space, your site may not work properly, and future
upgrades of Discourse may not complete successfully.

ENTER to create a 2GB swapfile now, or Ctrl+C to exit

From Googling, it seems that in September the change was made to display this message when dealing with <= 2GB of RAM, rather than < 2GB RAM (if I’m reading that link correctly): FIX: make swap when mem is <= (not <) 2GB by pfaffman · Pull Request #290 · discourse/discourse_docker · GitHub

Is it currently possible to install Discourse on a 2GB RAM server without using a swapfile? If so, how?

Thanks,
Ben


(cpradio) #3

Sure, you can do it by deleting the swap file and disabling swap after you run ./discourse-setup, but it is not recommended. It is recommended to have a 2 GB swap file when you have 2 GB of RAM or less.


(Ben) #4

Thanks for the quick reply. Why is it recommended to use the swap file with 2GB of RAM? In other words, what are the potential negative effects of disabling swap in this way and keeping the instance at 2GB?


(Joshua Rosenfeld) #5

Upgrades could fail. Upgrades require significantly more RAM than typical day-to-day operations, and running out of RAM during an upgrade is bad.


(Ben) #6

Would upgrading the instance to more RAM before install/upgrade and then downgrading after be an acceptable solution?


(Joshua Rosenfeld) #7

Yes, but to me that seems like quite a bit of hassle to do every upgrade. Is there a reason you’re trying to avoid swap? The snappiness is set to 10 so it will only be used when really needed.


(Ben) #8

Based on the DigitalOcean guide which reads:

Discourse requires a swap file if you are using 1 GB of RAM. Although swap is generally recommended for systems utilizing traditional spinning hard drives, using swap with SSDs can cause issues with hardware degradation over time. Due to this consideration, we do not recommend enabling swap on DigitalOcean or any other provider that utilizes SSD storage. Doing so can impact the reliability of the underlying hardware for you and your neighbors.

(As found here: How To Install Discourse on Ubuntu 16.04 | DigitalOcean)


(Joshua Rosenfeld) #9

Give me a sec to find @mpalmer’s response to that…one moment.

Edit:

Keep in mind, while most of that guide was written by @techAPJ from the Discourse team, that note was added by Digital Ocean.


(Ben) #10

Fair enough. Thanks for the help!


(Jeff Atwood) #11

Yet again, this is a political issue for Digital Ocean, it is not really based on any technical problem.

It is unfortunate that Sprockets causes us to need 4GB RAM during upgrades, but there’s little we can do about it at the current time.


(Jeff Wong) #12

Is that why my updates stall now on my Digital Ocean install? I’ve been getting no output from the web update, and have been just updating through launcher for the last couple of betas. On a 1GB RAM + 2GB swap.

             total       used       free     shared    buffers     cached
Mem:           994        914         79         31          4        118
-/+ buffers/cache:        790        203
Swap:         2047        881       1166

(Jeff Atwood) #13

Yep, all Sprockets issues. The newer versions take even more memory, so we need to throw it all away and build our own…

(That said, I am able to use the web updater on my 1GB + 2GB swap instances just fine, so… not sure what’s up if you can’t)