تحميل عالي جدًا لوحدة المعالجة المركزية بشكل متقطع

Occasionally I get very high CPU load. Generally the operation is very smooth but then there are those burst of full CPU load. While that is happening, the forum give 502 errors or is VERY slow. I have a Hetzner server with 3 vCPUs and 4 GB of RAM.

Anyone has an idea what could cause this?

This is what the console in the Hetzner backend shoes:

Can you run htop or similar on the server, to identify the process name which is causing the high CPU load?

A periodic process is running. Do you have swap? You’re running out of memory. I would add 2 to 4gb of swap.

إعجاب واحد (1)

I had to wait to catch an high CPU event. I ran htop and took some screenshots (I never used it so I don’t know what I’m looking at).

This is the first thing to do.

إعجابَين (2)

No swap is not a good look here, you are dangerously close to major issues.

إعجاب واحد (1)

@GeorgSeifert were you able to resolve your issue?

If adding swap is the fix, please mark @pfaffman’s post as the solution. It’s the button on the post menu that looks like a square with a checkmark in it.

I tried a different sever that has more RAM but slower CPU and is cheaper. I’ll monitor this for a few days.

Did you add swap? That is essential.

I thought double the physical RAM should do for now.

The Discourse page says that a server with 1-2 MB RAM is enough to run it. So I thought I’m kind of save with 4 MB? Now it has 8.

I’m not sure if our forum has a lot trafic (I just check the Reports and it says 15 logged in and 1000 not logged in users).

It is enough — without plugins and few other things, like users and an active admin/moderator. That is absolut minimum and even forum itself can work, rebuilding will fail.

We have here quite few topics about that question and one kind consensus is 2 MB is enought for small forums, if there is swap too.

إعجاب واحد (1)

@pfaffman refresh my memory.. does the ./discourse-setup command not create the swap file automatically?

@GeorgSeifert have you followed the official install instructions to set up your site? If not it is goin to be hard for us to support you here. As everyone is telling you, you need to have a swap file, no matter how much memory you have, otherwise you will run into difficulties.

You often still need swap even with what should be more than enough memory. I think because processes see that more ram is available and they take it and when more RAM is needed it’s not available to other processes.

It does, but only if you have 2GB or less.

He likely did follow the standard install. It’s unclear why he’s running out of ram, but that’s the case. There’s some chance that adding actual RAM will solve the problem.

I just did what the install page told me.

So how do I check if I have swap enabled or not?

Run the command df -h