运行Discourse需要多少内存?

Hi,

I’ve recently installed Discourse on my own VPS. I have only 2 GB of RAM. Is this sufficient to run a forum in production? There have been times where I got a 502 gateway error which maybe due to lack of memory. Sometimes, after installing a plugin, I have to refresh my admin panel several times.

Other threads say 1 GB of RAM is enough, but what is realistic? I’m using the latest docker image by bitnami. Some say that sidekiq can take up to 4 GB of RAM: https://github.com/bitnami/bitnami-docker-discourse/issues/150

1 个赞

You can easily run Discourse off a VPS with 2GB of RAM. You may want to consider setting up swap if you don’t have that already. Running ./discourse-setup will do this for you.

3 个赞

I did initially setup swap, but if I use swap memory, it slows it down by a lot, so by default, I didn’t want to do that.

1 个赞

Our default configuration should only use swap under pressure, like during web updates.

If you host a large community and start experiencing slows response times from the Discourse API you can increase the CPU/RAM of your server and re-run ./discourse-setup so it starts using the augmented resources.

6 个赞

Is this a new community or did you import a large database? How much traffic do you expect? Single thread cpu speed as well as SSD for storage are critical.

1 个赞

I didn’t import any database. This is a fresh forum with 0 posts. The only traffic is me at the moment. However, I do expect traffic that could be up to 1000 users visiting the site a day.

Oh. Don’t do that. Or ask them why your performance sucks.

See: Discourse official Standard Installation

4 个赞

Curious as to why you advocate against using the bitnami image? (assumably @AntiMetaman is referring to their new helm charts here.

But also, they’ve got new a new helm chart here

We, the team that develop Discourse, only test it against our own base image. Installs that don’t follow the Install Discourse in production with the official, supported instructions may subtle break anytime and we won’t provide support for it.

4 个赞

Just FYI, and offering a different perspective @AntiMetaman

Although Discourse can run on a VPS with minimal RAM, when you build and rebuild Discourse it will be quite slow compared to building on a machine with more RAM. I personally would not run a “truly” production Discourse app on 2GB of RAM, but that is just me.

FWIW (just my opinion only), I have installed Discourse on machines with 1GB, 2GB, 8GB, 32GB and 64 GB RAM servers, both VPM and dedicated, and honestly I like building Discourse on my 64 GB and 32GB machines. It’s so fast to build on 64GB :). Blazing fast to rebuild and runs so good, smooth like butter on hot toast. So, I prefer to run Discourse on “bigger” machines (more RAM, more disk space) with other applications than run in standalone mode on very small slices with minimal RAM.

However, that is based on my personal experience with Discourse and Docker and preferences. I like Discourse to rebuild fast and have plenty of “head room” in production and 2GB does not meet my requirements for build speed.

4 个赞

Discourse recommends 1GB as the minimum and I have ran installations this way and it gets slow quick, therefore I would go with 2GB.

This first 2GB last a long mile I currently run a community with ~3500 visits/day without Crawlers and some 20-30 posts per day I haven’t seen any issue with the 2GB of RAM and haven’t noticed any slow downs.

I’m almost sure @AntiMetaman that your issue is with the Bitnami image and not resources. Make sure you CPU is fast enough and if you’re able give it a second CPU (I only use 1vCPU and does the job).

4 个赞

The bitnami image is still using the stable 2.4.4. The only reason I went with bitnami was because it had a standard docker-compose.yml, so the installation process was easier. Some people who have tried to upgrade to 2.6.0 beta 1 using the official Discourse image failed. I’ll try the official discourse image and see how it goes.

1 个赞

Good idea, third party packages such as the bitnami install get zero support here.

As you’ve already noted it’s also quite out of date.

2 个赞

您好 @Falco - 您是指在控制台中运行该命令,还是运行设置向导 www.mysite.com/wizard 就足够了?

1 个赞

它们实际上是两件不同的事情。:slight_smile:

/wizard 用于 UI 和管理员设置,以便在安装后设置您的网站,并且可以通过您的网站/浏览器访问。

discourse-setup 是安装过程本身的一部分,它(部分)分配服务器资源,并在服务器上运行。

您可以多次重新运行 discourse-setup,它不会覆盖您任何的网站数据。

3 个赞

感谢您的澄清@JammyDodger,非常感谢。

我的网站变得相当卡顿,所以我给服务器增加了内存,现在分配 2048MB 的共享缓冲区(之前是 128MB),运行得好多了。

我之前一直是手动编辑 app.yml 文件并使用 SFTP 上传,刚才在重建应用程序时注意到一个权限警告,app.yml 文件应该设置为多少?

644 或 600。我相信您提到的消息会告诉您应该是什么。

1 个赞

谢谢 @pfaffman

1 个赞