Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8343803
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T06:10:28+00:00 2026-06-09T06:10:28+00:00

I’m about ready to go live with my node.js/mongo app running on the Amazon

  • 0

I’m about ready to go live with my node.js/mongo app running on the Amazon Cloud. I have a 3x replica set for the Mongo servers. Everything was working fine until, suddenly, about 20 minutes ago, the PRIMARY mongo server jumped to 100% CPU usage (usually it has barely any usage). I’m currently testing the app with only ~10 users, so this is very worrysome.

My first reaction was, of course, to grab the mongodb log file from the server. I expected this to be revealing, but now I’m more confused than ever. One of the primary functions of my database is to cache data for users, so I have a Collection (‘DataCache’) which simply stores a JSON string (Mongoose code):

new Model('DataCache',{ 
  '_id': { type: String, unique: true }, 
 'data': String, 
 'updated': Date });

Looking at the logs from the “100% CPU” time I see that the standard update requests were performed, but taking as much as ~47 seconds !!

Mon Aug  6 08:58:36 [conn28821] update storage.datacache query: { _id: "14954006/mentions/dcc3c69e72da714a0f3bffc518183ebb" } update: { $set: ... } } 47174ms

This request was not any longer in data than usual (about 1000 characters in the JSON string; data was truncated here for brevity).

I’m really not sure where else to be looking to figure out why my usage suddenly jumped so far up. I can’t imagine what was unusual/unique about this scenario, and I don’t see anything else in the logs, but I’m very worried about what will happen when our 10 users scale to thousands…

The problem disappeared as suddenly as it appeared, about 20 minutes after starting, but the CPU is still seeing weird spikes (RightScale dashboard image):
RightScale


UPDATE: Here’s some info printed from mongo about the cache collection, in particular. I’m not certain that the problem has to do with the cache collection, but it is the one query I was seeing the most consistently during the lag-time…

     {
        "ns" : "storage.datacache",
        "count" : 43949,
        "size" : 132274592,
    "avgObjSize" : 3009.729277116658,
    "storageSize" : 158887936,
    "numExtents" : 13,
    "nindexes" : 5,
    "lastExtentSize" : 33828864,
    "paddingFactor" : 1.0099999999994833,
    "flags" : 1,
    "totalIndexSize" : 10972192,
    "indexSizes" : {
        "_id_" : 4570384,
    },
    "ok" : 1
}

EDIT: More graphs
enter image description here
enter image description here

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T06:10:30+00:00Added an answer on June 9, 2026 at 6:10 am

    Generally with MongoDB a CPU spike comes from a couple of specific problems. Typically, MongoDB is very low CPU. It is normally entirely bound by IO or Memory footprint.

    Here is (hopefully) a useful short list:

    1. Bad queries. That’s any query without an index. I notice that DataCache has an Updated field that is un-indexed. Do you every query by that field?
    2. Map / Reduce. A Map / Reduce job will typically “peg” one core at 100%. How many cores do you have on these DBs? Are you running MR jobs?
    3. IO masking as CPU. Depending on the reporting, CPU may actually be CPU_WAIT, which is often disk IO.

    So if you go back to the graphs, take a look at your IO times and your RAM usage. Figure out your RAM:DATA ratio and figure out your IO needs. And let us know what type of machines you’re using.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I have a French site that I want to parse, but am running into
I don't have much knowledge about the IPv6 protocol, so sorry if the question
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
I have just tried to save a simple *.rtf file with some websites and
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a jquery bug and I've been looking for hours now, I can't
I am reading a book about Javascript and jQuery and using one of the
this is what i have right now Drawing an RSS feed into the php,
I have this code to decode numeric html entities to the UTF8 equivalent character.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.