Rocket.Chat icon indicating copy to clipboard operation
Rocket.Chat copied to clipboard

High CPU usage

Open LiraNuna opened this issue 10 years ago • 37 comments

Rocket.Chat version: 0.42.0

When running Rocket.Chat on Ubuntu 14.04 and Apache with mod_proxy, CPU is always at a 100% as soon as a user is connected and stays at 100% even if the (single) user disconnects and no other users stay on the server.

Would be happy to help debug this if possible.

rocket chat

LiraNuna avatar Oct 05 '16 06:10 LiraNuna

You probably haven't enabled mongo's oplog, try enabling it and see if it helps

lucasvanhalst avatar Oct 05 '16 21:10 lucasvanhalst

@lucasvanhalst I'm not sure I understand what this means and googling the subject gets me into setting up replication with mongo. Does Rocket.Chat require replication?

LiraNuna avatar Oct 06 '16 06:10 LiraNuna

I think we have this same issue, difference being that we are running with CentOS 7.2 and Nginx.

Node version 6.5.0.

rocketchat_0420_cpu

pasmon avatar Oct 11 '16 05:10 pasmon

Note that I used Node version 6.5.0 since I had issues with "fibers" module, it required v8 version 5.1 for some reason.

I wonder if its the Meteor which is causing the CPU spiking, they had issues in v1.4 but they already stated that it was fixed in later versions.

pasmon avatar Oct 11 '16 09:10 pasmon

Not sure if this is of any relevance, but sometimes we have this in our logs:

Oct 12 10:16:48 i-bdbb4cb7 rocketchat[15455]: Exception while invoking method 'updateMessage' TypeError: Cannot read property '_id' of undefined Oct 12 10:16:48 i-bdbb4cb7 rocketchat[15455]: at packages/rocketchat:lib/server/methods/filterATAllTag.js:7:39 Oct 12 10:16:48 i-bdbb4cb7 rocketchat[15455]: at packages/rocketchat_lib/lib/callbacks.coffee:73:21 Oct 12 10:16:48 i-bdbb4cb7 rocketchat[15455]: at Array.reduce (native) Oct 12 10:16:48 i-bdbb4cb7 rocketchat[15455]: at Object.RocketChat.callbacks.run (packages/rocketchat_lib/lib/callbacks.coffee:68:103) Oct 12 10:16:48 i-bdbb4cb7 rocketchat[15455]: at Object.RocketChat.updateMessage (packages/rocketchat:lib/server/functions/updateMessage.js:18:33) Oct 12 10:16:48 i-bdbb4cb7 rocketchat[15455]: at updateMessage (packages/rocketchat_lib/server/methods/updateMessage.coffee:30:14) Oct 12 10:16:48 i-bdbb4cb7 rocketchat[15455]: at methodsMap.(anonymous function) (packages/rocketchat:lib/server/lib/debug.js:17:26) Oct 12 10:16:48 i-bdbb4cb7 rocketchat[15455]: at maybeAuditArgumentChecks (packages/ddp-server/livedata_server.js:1711:12) Oct 12 10:16:48 i-bdbb4cb7 rocketchat[15455]: at packages/ddp-server/livedata_server.js:711:19 Oct 12 10:16:48 i-bdbb4cb7 rocketchat[15455]: at withValue (packages/meteor/dynamics_nodejs.js:56:1) Oct 12 10:16:48 i-bdbb4cb7 rocketchat[15455]: at packages/ddp-server/livedata_server.js:709:40 Oct 12 10:16:48 i-bdbb4cb7 rocketchat[15455]: at withValue (packages/meteor/dynamics_nodejs.js:56:1) Oct 12 10:16:48 i-bdbb4cb7 rocketchat[15455]: at packages/ddp-server/livedata_server.js:707:46 Oct 12 10:16:48 i-bdbb4cb7 rocketchat[15455]: at Session.method (packages/ddp-server/livedata_server.js:681:23) Oct 12 10:16:48 i-bdbb4cb7 rocketchat[15455]: at packages/ddp-server/livedata_server.js:551:43

pasmon avatar Oct 13 '16 05:10 pasmon

I do not have these exceptions, so it's probably irrelevant? What's the status of this? I tried debugging this but couldn't get very far.

LiraNuna avatar Oct 15 '16 05:10 LiraNuna

I "solved" this issue by switching to using Rocket.Chat via docker. I'm not sure what the difference is.

LiraNuna avatar Oct 16 '16 20:10 LiraNuna

~sigh~ I upgraded to 0.45.0 from 0.42.0 and noticed this problem crop up. However, I had also upgraded to Node 6.9.1 at the same time. Downgrading to Node 4.6.1 has alleviated this issue. It's quite ridiculous that the current LTS release can't be used.

jsumners avatar Nov 04 '16 13:11 jsumners

I finally got the Docker version of our Rocket.Chat working with all our Hubot plugins and scripts, and true enough, there is no high CPU usage. Still not using oplog, as @lucasvanhalst suggested.

pasmon avatar Nov 11 '16 06:11 pasmon

@engelgabriel

bazarnew avatar Nov 12 '16 11:11 bazarnew

Hi, I'm also Mshklv one can say what's the problem?

bazarnew avatar Nov 12 '16 11:11 bazarnew

33324

bazarnew avatar Nov 12 '16 11:11 bazarnew

@Sing-Li

bazarnew avatar Nov 12 '16 11:11 bazarnew

@sampaiodiego

bazarnew avatar Nov 13 '16 06:11 bazarnew

For those who experienced the 100% + CPU, can you please let us know if:

  1. One or more of your disk volumes are mounted using nfs
  2. You have had, in the past, both Node 6 and Node 4.x installed

TIA

Sing-Li avatar Nov 13 '16 14:11 Sing-Li

@Sing-Li:

  1. No.
  2. Yes, via https://github.com/tj/n

jsumners avatar Nov 14 '16 00:11 jsumners

  1. No
  2. Can't remember. Using wheezy-backports now, so possibly.

sebbacon avatar Nov 14 '16 08:11 sebbacon

  1. No
  2. Yes, first Node 4.5 is installed but as we couldn't get Rocket.Chat working with that Node 6.5 was installed with Node version management software (https://github.com/tj/n)

pasmon avatar Nov 14 '16 10:11 pasmon

  1. No
  2. I never had both installed but I did upgrade from 4.x to 6.x before installing rocket.chat

LiraNuna avatar Nov 14 '16 18:11 LiraNuna

I should point out that my install of 4.x and 6.x were not concurrent, as far as Rocket.Chat is concerned.

It is clear to me that using 6.x is the problem, and it shouldn't be.

jsumners avatar Nov 14 '16 18:11 jsumners