Note that there are some explanatory texts on larger screens.

plurals
  1. POWhat is reason that Node.Js application uses 90% of CPU?
    primarykey
    data
    text
    <p>I made simple notification application that subscribes to redis channel and when it will have new message then this application send it to user.</p> <pre><code> client.on("auth", function(sessId, userId){ console.log('AUTH: userId ' + userId) var userIdFromRedis; redis1.get('PHPREDIS_SESSION:' + sessId, function (err , reply) { if (reply){ reply = reply.toString(); var result = reply.match(/s:2:\"id\";i:(\d+);/); if (result) { userIdFromRedis = result[1] console.log('AUTH: userIdFromRedis ' + userIdFromRedis) } else { result = reply.match(/s:7:\"guestId\";i:(\d+);/); if (result) { var guestIdFromRedis = result[1] console.log('AUTH: guestIdFromRedis ' + guestIdFromRedis) } } if (userIdFromRedis == userId) { client.userId = userId; subscribe.subscribe(channelPrefix + userId); clients[userId] = client; client.emit("auth", {"success":true}); console.log('AUTH: result - ok') } else if (guestIdFromRedis) { client.guestId = guestIdFromRedis; subscribe.subscribe(channelPrefix + guestIdFromRedis); clients[guestIdFromRedis] = client; client.emit("auth", {"success":true}); console.log('AUTH: result - ok') } else { client.disconnect(); console.log('AUTH: result - fail') } } else { client.disconnect(); } }); }) subscribe.on("message", function(channel, message) { var userId = Math.round(channel.substr(channelPrefix.length)); if (client.userId == userId || client.guestId == userId) { console.log('Subscriber: ' + message) client.send(message); } }); client.on("message", function(text){ client.send(text); }) </code></pre> <p>And in log file sometimes in top hour I can find error message</p> <blockquote> <p>(node) warning: possible EventEmitter memory leak detected. 11 listeners added. Use emitter.setMaxListeners() to increase limit.</p> </blockquote> <p>And node.js application's process uses 90% of CPU. Please advice how can I resolve this problem?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload