High `CPU > 100%` on MUP deploying (DigitalOcean)?


#1

I use MUP to deploy my app on DigitalOcean (base on Ram 4, CPU 2)
Problem with CPU increase > 100%

Please help me to any check


#2

you mean cpu spikes while deploying only ?

try this one see if its mup cause cpu problem?

and there’s a free server monitor have a good overview about cpu mem etc…


#3

Thanks for your reply.
High CPU when I entry data or view report on my app/system (not deployment).


#4

Or maybe problem with my Coding.


#5

+1 for using netdata as a real-time server performance and health monitoring solution. It is really easy to install, light on resource usage and provide comprehensive information.

We run it on all our servers that host Meteor webapps.

Another fantastic feature that netdata provides is that it implements a statsd server that lets you easy collect run-time metrics from your Meteor webapp and display an informative graph in the netdata web interface.

In our Meteor apps, we use node-statsd-client to send metrics to netdata’s inbuilt statds server:

The package works out of the box, using UDP to send statsd data to the default statsd port 8125 on localhost , which netdata listens on.

The beauty of using UDP is that it is a connectionless protocol, so your Meteor app will still run normally on a development machine that doesn’t have netdata (or another statsd) server running.

Sending statsd metrics from a Meteor is a piece of cake. First, you install the NPM package using meteor install --save statsd-client

Then in your server-side code, you instantiate the node-statsd-client with the following snippet:

import SDC from 'statsd-client';
sdc = new SDC();

Here is an example of how to record a running count of some event in your Meteor app, e.g. the number of button click, Meteor method calls etc.

sdc.increment("myApp.buttonClick.count");

And here is an example of how to record a duration of time, e.g. the time taken to retrieve data from a database:

First, record the starting timestamp:

var dbRetrieveStartTime = new Date();

Then at right after the completion of the event call sdc.timing():

sdc.timing("myApp.db.retrievalTime", dbRetrieveStartTime);

Netdata will automatically use the names passed as the first parameter, i.e. "myApp.buttonClick.count" and "myApp.db.retrievalTime" as the titles of the graphs.

Check the node-statsd-client docs for other examples of metrics you can record.

And how do I install netdata?

The netdata installation instructions are available here:

https://github.com/firehol/netdata/wiki/Installation

The netdata installation procedure us beyond what I intended to talk about in this post, but I had my notes right in front of me and maybe this could help someone:

For people running CentOS 7 Linux (like me) you can build and install it using the following procedure:

First, install netdata’s required dependencies and development tools:

yum groupinstall "Development Tools"
yum install autoconf automake curl gcc git libmnl-devel libuuid-devel lm_sensors make MySQL-python nc pkgconfig python python-psycopg2 PyYAML zlib-devel

Then clone netdata from GitHub and run the installation script:

git clone https://github.com/firehol/netdata.git --depth=1
cd netdata
./netdata-installer.sh

If you’re using Nginx as your web server, here are the instructions for making netdata accessible behind Nginx:

https://github.com/firehol/netdata/wiki/Running-behind-nginx


#6

Very thanks, I will try


#7

I had problem with high cpu when node version on server was not supported by my meteor version.


#8

what is your node version on production

i heard someone downgrade to 8.9.4 works in some case

do u have oplog enabled with your mongo?

you can open mongodb log see if there’s query that cause cpu

and we use this script to deploy kadira

if cpu spikes u can check log to see which cause the prob…

and don’t forget running a cronjob to clean kadira’s data
i do this each 1 week


#9

@raragao and @crapthings, I used MUP to deploy my project.
So how to check node version on docker?
I tried on root

root@localhost:~# node -v
The program 'node' is currently not installed. You can install it by typing:
apt install nodejs-legacy

#10

I tried this to check node version on docker

root@localhost:~# docker run -it --rm node /bin/bash -c 'node --version'
v9.11.1

How to downgrade node version on docker container?


#11

Sorry, I dont know. You can check with DO support team.


#12

@theara, can you adjust this topic ?