I noticed a couple of warnings when rebuilding my container:
- WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
- WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add ‘vm.overcommit_memory = 1’ to /etc/sysctl.conf and then reboot or run the command sysctl vm.overcommit_memory=1’ for this to take effect
- WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command ‘echo never > /sys/kernel/mm/ transparent_hugepage/enabled’ as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled.
My question: are these just some warnings to be ignored? If they should not be ignored (I do feel that my discourse forum is extremely slow), then what exactly should be done? To start with: are these paths and files that the warnings refer to inside or outside the container? If they’re inside, I have no idea how to manipulate them…
The only one of those warnings that could possibly cause problems on a small site is the THP one (and even then only if you’re unlucky). If you ever hit that
somaxconn limit you’re doing very well, and
overcommit_memory will cause problems on save, but won’t slow anything down.
All those referenced paths are on the outer system, not in the container.
90% of Discourse performance is having a CPU with very fast single threaded performance. The other 10% is having enough memory for the max number of concurrent active logged in users your site receives.
I’m on a 1 GB DigitalOcean droplet. My Forum currently has three users, two of which are system and discobot. There is no traffic except for my own and the odd web crawler. Still, some pages take way over a second to load. Sometimes 2 or 3. Normal?
That’s very bizarre. I would turn off any third party plugins you have. Digital Ocean isn’t blazing CPU or anything but it is reasonable™ speed.
I installed third party plugins for the first time only this weekend. The speed was slow already before that.
Definitely odd. It is possible you have a bad droplet with a “noisy neighbor” who is eating lots of shared CPU. For Discourse, as I said, most of performance is indeed CPU.
I was getting faster page load times than 1-3 sec on a 1 GB free tier AWS (Ubuntu 16.04) with 1.8 million posts. I’ve bumped it to a 2GB instance, and the page loads are a bit faster.
posts:rebake isn’t exactly snappy, but for a sandbox ok.
(I changed all 3 of the settings you mention in your first post - this made no difference whatsoever to page loads, or anything else as far as I could tell).
Is this an import? What does htop show?
I don’t know what an import is but here is htop:
Is this just an empty forum with no posts in it, or have you imported or otherwise generated content?
Yes, it’s basically empty. But there is also a Wordpress site running on the same droplet. But it’s also virtually empty and trafficless. I have a couple of plugins installed though.
With no content, and no users, even with plugins, I think it should be faster than you are reporting.
What plugins? Are you page loads slow in /safe-mode too?
Is there any swap activity on the machine while you’re using the Discourse site?
I was referring to Wordpress plugins. I do have a couple of discourse plugins installed. I can’t really compare with safe-mode right now because, for whatever reason, all pages are loading well below 1 second at the moment…
Edit: When the delays kicked in again, I tried safe mode and it doesn’t seem to make a difference. This is from safe mode:
I’m not sure what the right way is to assess that, but if swap activity means that the amount of swap used varies by a couple of MBs while I navigate the site (as shown in htop), then yes, there is some activity. When I started testing, it was at 491 MB and as I was clicking on various posts, pages etc in discourse, it went up to 497. Now it’s at 538 though I’m not sure what exactly caused that increase.
I noticed that, a lot of the time, the delay seems to be connected to problems.json (whatever that is):
Edit: but maybe it’s not the worst:
sar -W 1 in a console then go play with the site. If you come back and there’s any sustained values other than
0.00, you’re swapping and need to reassess your memory usage. Based on your description
I’m pretty sure you’re going to find that you’re swapping, and from there I’d bet good money that’s the cause of your performance problems.
Is the emphasis here on sustained or on other than zero?
Here’s what I can see: as long as I (the only human user on the forum) do nothing, I see virtually only zeros. But as soon as I play around on the site, I get mostly small one or two digit numbers in pswin/s. It is very visible how most of my clicks cause the zeros to go away, if only for a single data row.
But in some cases, I can also provoke much more swapping activity. This, for example is from calling /admin/upgrade:
08:04:46 PM pswpin/s pswpout/s
08:04:47 PM 11.00 64.00
08:04:48 PM 15.31 2380.61
08:04:49 PM 7.00 3387.00
08:04:50 PM 4.08 3315.31
08:04:51 PM 1.01 367.68
08:04:52 PM 0.00 270.00
08:04:53 PM 0.00 0.00
08:04:54 PM 2.02 0.00
08:04:55 PM 0.98 12.75
08:04:56 PM 19.00 288.00
08:04:57 PM 8.00 0.00
08:04:58 PM 390.00 327.00
08:04:59 PM 7.07 0.00
08:05:00 PM 0.99 0.00
08:05:01 PM 45.00 0.00
08:05:02 PM 17.48 0.00
08:05:03 PM 0.00 0.00
And when I then call a page on the wordpress site, things get crazy:
08:06:14 PM pswpin/s pswpout/s
08:06:15 PM 4.04 0.00
08:06:16 PM 7689.00 0.00
08:06:17 PM 5163.16 1111.58
08:06:18 PM 1932.00 0.00
08:06:19 PM 3594.00 115.00
08:06:20 PM 0.00 1.02
08:06:21 PM 439.00 31.00
08:06:22 PM 0.00 0.00
08:06:23 PM 0.00 3.96
08:06:24 PM 0.00 2.00
08:06:25 PM 0.00 0.00
08:06:26 PM 0.00 36.63
08:06:27 PM 0.00 4.04
So does this confirm your diagnosis or is there not enough swapping going on (the non-zero numbers are never sustained, only bursts).
By “sustained”, I meant “more than the occasional “flicker” of a non-zero”. That swap activity, especially when you hit the wordpress page, indicates that you’re swapping like crazy. For instance, at 5000 pages swapped in per second, that’s 20 megabytes per second of data being read off disk. It’s not surprising that your performance is not, to put it mildly, optimal.
Okay, let’s hope that a better server will solve this. I was planning anyway to move to a hoster that gives me 2 instead of 1 GB of RAM for the same price.
But I am somewhat surprised that I seem to be the first one to find out that a 1GB digital ocean droplet is not enough to host a Discourse Wordpress combo. Not even for a small community.Or maybe I missed something when I did my research some weeks ago? It appeared to me that people are generally saying it’s possible if you use swap. And, of course, in a way it is true, because it is possible. But who wants a lagging forum? So I hope people find this hint here, although it is buried in a topic that does not seem to match performance questions very well. I guess I’ll change it.
That doesn’t surprise me. Our WordPress install for blog.discourse.org had out of memory errors (and memory termination problems) with 1GB RAM until we added swap. That’s a DO droplet doing nothing but some pretty basic WordPress action with very few plugins.
So to answer your question, and I’ve edited the title to reflect this:
Is 1GB RAM enough for both WordPress and Discourse?
No. No it is not.