简体   繁体   English

具有节点的Mongodb在Docker上使用了较高的CPU使用率

[英]Mongodb with node is using high cpu usage on Docker

Hi I've installed Rocket.chat on ubuntu Aws micro instance, It running with Nginx, MongoDB, and node, where MongoDB is running with docker image mongo:3.0 嗨,我已经在ubuntu Aws微型实例上安装了Rocket.chat ,它与Nginx,MongoDB和node一起运行,其中MongoDB与docker image mongo:3.0一起运行
It was running smoothly on the day of installation but after some times It server was getting slow, I examined within the server with top command. 在安装当天,它运行平稳,但是一段时间后,服务器运行缓慢,我使用top命令在服务器内部进行了检查。 It was MongoDB using cpu% around 70. and the next day It flickers with more than 90%. 是MongoDB在70左右使用cpu%。第二天,它以90%以上的速度闪烁。

I've reinstalled everything on the server but it is same again, no luck. 我已经在服务器上重新安装了所有内容,但是还是一样,没有运气。

Here is the screenshot for top cmd. 这是top cmd的屏幕截图。
Please let me know if any other stats are needed for this. 如果需要其他统计信息,请告诉我。 在此处输入图片说明

How can I examined the main problem here, how can I optimize it to make it work properly. 我如何在这里检查主要问题,如何优化它以使其正常工作。

Thanks 谢谢

I got to know why this issue arises. 我知道为什么会出现这个问题。 I started implementing my custom chat platform with Meteor. 我开始使用Meteor实现我的自定义聊天平台。 So the cause of the problem was services.resume.loginTokens in the user object. 因此,导致此问题的原因是用户对象中的services.resume.loginTokens
We were trying implementing rocket chat methods/api on the custom native android application. 我们正在尝试在自定义的本机android应用程序上实现火箭聊天方法/ api。 Whenever application is calling the login method from the android app, It was adding a new login token without deleting the previous ones (for multi-system logins) 每当应用程序从android应用程序调用login方法时,它都会添加一个新的登录令牌而不删除先前的登录令牌(对于多系统登录)

so if you'll delete the previous one with some date check, It won't create overheads to the user object. 因此,如果您要通过日期检查删除前一个,则不会对用户对象造成开销。

Accounts.registerLoginHandler (loginRequest) ->

  # ... Do whatever you need to do to authenticate the user

  stampedToken = Accounts._generateStampedLoginToken();
  Meteor.users.update userId,
    $push: {'services.resume.loginTokens': stampedToken}

  # Delete old resume tokens so they don't clog up the db
  cutoff = +(new Date) - (24*60*60)*1000
  Meteor.users.update userId, {
    $pull:
      'services.resume.loginTokens':
        when: {$lt: cutoff}
  },
  {multi : true}

  return {
    id: userId,
    token: stampedToken.token
  }

I got this solution from this so question 我从这个问题得到了这个解决方案

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM