Please help: My Discourse got really slow due to Topic Preview plugin

(Krischan) #1

Either I got a lot faster or my Discourse got slower recently. Speed times are like these. Is this normal for a 1GB Digital Ocean installation with the recommended swap file?

I updated Linux yesterday, did a clean up - to no avail:

Can anyone help? Thanks!

(Sam Saffron) #2

Looks to me like stuff is swapping, try a rebuild to see if it clears stuff up

(Jeff Atwood) #3

Couple things to report

free -m
df -m
docker version

And as always, please SSH into your server and run:

cd /var/discourse
git pull
./launcher rebuild app

(Krischan) #4

Rebuilding didn’t fix it.

Thanks so much!

(Rafael dos Santos Silva) #5

It’s swapping a lot.

I would try to reboot the server, and if it happens again you will need to either try to tweak configuration (minimum to everything) or bump the server.

(Krischan) #6


Sounds good. Could you give me a hint how to do this?

(Jeff Atwood) #7

2GB swap is the minimum required amount now, so you might want to bump that. Can you also show the stats in /about ?

(Kane York) #8

I think the most important thing to do right now is to increase the amount of RAM from 1 to 2. Moving the swap from 1GB to 2GB can happen after.

(Krischan) #9

Sure, not a big party yet and a few tumbleweeds here and there:


It looks like you have the plugin Topic List Previews installed? I also had it active and the loading times were noticeable slow. But after I removed the plugin last night the loading times made it look snappy. Also the swap usage is now roughly half compared to before on my DO 1GB instance with 2GB swap.

Here is a comparison of the internal timings from my dev-env (with and without the plugin installed):

@angus might wanna look into that huge number of sql requests.

Topic List Previews
(Angus McLeod) #11

Wow, yes indeed. I’ll see if I can figure out what’s causing that. Thanks.


Hello @angus;

Did you find the problem ? My discourse is slow, and i think it’s caused by topic preview too.

(Angus McLeod) #13

This performance issue has now been resolved. See further here:

(Stephen Chung) #14

I just installed the latest version of Topic Preview and CPU usage shot up to 50% persistently. It has been over an hour now; the install doesn’t have many topics inside, so something is happening to eat up globs of CPU time.

The VM has two cores, so it is practically using up one core persistently. RAM is 3GB. Traffic is very light, so it must be a background job.

I’ll wait a few more hours to see. If this situation persists, I’ll uninstall the plugin and declare the experiment a failure.

@angus, any idea what will be causing this?

EDIT: Curiouser and curiouser. After about one hour of this, I see a log entry saying Sidekiq is not sending a heartbeat and then is restarted. Then CPU drops back down to normal levels. I think something about turning on Topic Preview will cause Sidekiq to go into a frenzy…

(Angus McLeod) #15

Hm ok. I haven’t seen anything like 50% CPU on my own instance when using TLP (alongside a number of other plugins) with just a 1 GB Memory / 30 GB Disk instance on DO.

Are you sure the CPU increase is being caused by TLP?

It sounds like there might be an issue with your environment?

PM me the logs and I’ll take a closer look.

(Stephen Chung) #16

The logs has nothing but that line saying Sidekiq restarted in there, plus a bunch of other unrelated stuff like email rejections.

Could be something else though… Thing is, I just installed Topic Preview and restarted and it started happening, until Sidekiq dieded. A bit suspicious…

(Angus McLeod) #17

Indeed. Maybe there’s a content-specific issue here (i.e. something about the content on your instance TLP can’t handle). If possible, PM me a full log, there may be something hidden in there.

(Stephen Chung) #18

Where to find the full log? :sweat_smile:

(Angus McLeod) #19

The docker container shares various logs in shared/standalone/log.

So, assuming you have ssh access to your server, you can download them using scp. For example, you can get the latest rails log like this (replacing my server details with yours).

scp ~/downloads/production.log