CPU always on 15% on idle server

642 views
Skip to first unread message

Esteban Feldman

unread,
Jun 30, 2011, 6:53:22 PM6/30/11
to mongod...@googlegroups.com
Hi all. I have a test instance of mongodb on a VM and is using 15% CPU all time even with no connections, here is my server status
> db.serverStatus()
{
        "host" : "virtual-1",
        "version" : "1.8.2",
        "process" : "mongod",
        "uptime" : 2966,
        "uptimeEstimate" : 2221,
        "localTime" : ISODate("2011-06-30T22:47:11.318Z"),
        "globalLock" : {
                "totalTime" : 2965931789,
                "lockTime" : 134725,
                "ratio" : 0.00004542417344177162,
                "currentQueue" : {
                        "total" : 0,
                        "readers" : 0,
                        "writers" : 0
                },
                "activeClients" : {
                        "total" : 0,
                        "readers" : 0,
                        "writers" : 0
                }
        },
        "mem" : {
                "bits" : 64,
                "resident" : 1,
                "virtual" : 545,
                "supported" : true,
                "mapped" : 464
        },
        },
        "connections" : {
                "current" : 1,
                "available" : 15999
        },
        "extra_info" : {
                "note" : "fields vary by platform",
                "heap_usage_bytes" : 292752,
                "page_faults" : 99
        },
        "indexCounters" : {
                "btree" : {
                        "accesses" : 0,
                        "hits" : 0,
                        "misses" : 0,
                        "resets" : 0,
                        "missRatio" : 0
                }
        },
        "backgroundFlushing" : {
                "flushes" : 49,
                "total_ms" : 2676,
                "average_ms" : 54.61224489795919,
                "last_ms" : 1039,
                "last_finished" : ISODate("2011-06-30T22:46:46.635Z")
        },
        "cursors" : {
                "totalOpen" : 0,
                "clientCursors_size" : 0,
                "timedOut" : 0
        },
        "network" : {
                "bytesIn" : 1660,
                "bytesOut" : 18200,
                "numRequests" : 25
        },
        "opcounters" : {
                "insert" : 0,
                "query" : 2,
                "update" : 0,
                "delete" : 0,
                "getmore" : 0,
                "command" : 25
        },
        "asserts" : {
                "regular" : 0,
                "warning" : 0,
                "msg" : 0,
                "user" : 0,
                "rollovers" : 0
        },
        "writeBacksQueued" : false,
        "ok" : 1
}

Esteban Feldman

unread,
Jun 30, 2011, 7:11:06 PM6/30/11
to mongod...@googlegroups.com
Sorry... I meant to ask if that is a normal behavior or if there is something wrong...

cheers

Nat

unread,
Jun 30, 2011, 7:55:24 PM6/30/11
to mongod...@googlegroups.com
which VM do you use? How much CPU usage on the host? mongodb has some threads wake up regularly to perform jobs so VM may not allocate timeslice effectively.

Esteban Feldman

unread,
Jun 30, 2011, 8:24:28 PM6/30/11
to mongod...@googlegroups.com
Is a VirtualBox VM that I set up for testing MongoDB. Is sitting idle doing nothing but MongoDB.
htop reads 15% for CPU on 1 of mongodb processes always the same PID. The whole CPU is at 3% - 8% varying.




Esteban Feldman

unread,
Jun 30, 2011, 8:30:33 PM6/30/11
to mongod...@googlegroups.com
I ran an strace on mongodb pid and is doing

select(8, [6 7], NULL, NULL, {0, 10000}) = 0 (Timeout)

when I do that to other processes like cheroke they are on wait()




Esteban Feldman

unread,
Jun 30, 2011, 8:38:22 PM6/30/11
to mongod...@googlegroups.com
A better output will be:

00:34:52.075162 select(8, [6 7], NULL, NULL, {0, 10000}) = 0 (Timeout) <0.011655>
00:34:52.086935 select(8, [6 7], NULL, NULL, {0, 10000}) = 0 (Timeout) <0.013691>
00:34:52.100810 select(8, [6 7], NULL, NULL, {0, 10000}) = 0 (Timeout) <0.017073>
00:34:52.118109 select(8, [6 7], NULL, NULL, {0, 10000}) = 0 (Timeout) <0.013121>
00:34:52.131458 select(8, [6 7], NULL, NULL, {0, 10000}) = 0 (Timeout) <0.013683>
00:34:52.145345 select(8, [6 7], NULL, NULL, {0, 10000}) = 0 (Timeout) <0.011541>
00:34:52.157000 select(8, [6 7], NULL, NULL, {0, 10000}) = 0 (Timeout) <0.012111>
00:34:52.169335 select(8, [6 7], NULL, NULL, {0, 10000}) = 0 (Timeout) <0.017613>
00:34:52.187230 select(8, [6 7], NULL, NULL, {0, 10000}) = 0 (Timeout) <0.013577>
00:34:52.201143 select(8, [6 7], NULL, NULL, {0, 10000}) = 0 (Timeout) <0.017174>
00:34:52.218483 select(8, [6 7], NULL, NULL, {0, 10000}) = 0 (Timeout) <0.011901>
00:34:52.230518 select(8, [6 7], NULL, NULL, {0, 10000}) = 0 (Timeout) <0.011701>

Nat

unread,
Jun 30, 2011, 9:01:57 PM6/30/11
to mongod...@googlegroups.com
Ok. VirtualBox has another bug that uses CPU more than necessary. If you search on virtualbox bug database, you will find a couple of them. If that's the case, even when you pause your vm, you will still see some cpu usage on your vm process.
From: Esteban Feldman <ekagaur...@gmail.com>
Date: Thu, 30 Jun 2011 17:24:28 -0700 (PDT)
Subject: [mongodb-user] Re: CPU always on 15% on idle server

Is a VirtualBox VM that I set up for testing MongoDB. Is sitting idle doing nothing but MongoDB.
htop reads 15% for CPU on 1 of mongodb processes always the same PID. The whole CPU is at 3% - 8% varying.




--
You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To view this discussion on the web visit https://groups.google.com/d/msg/mongodb-user/-/gUUm2uBmVasJ.
To post to this group, send email to mongod...@googlegroups.com.
To unsubscribe from this group, send email to mongodb-user...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/mongodb-user?hl=en.

Esteban Feldman

unread,
Jun 30, 2011, 9:38:09 PM6/30/11
to mongod...@googlegroups.com, nat....@gmail.com
Nat: I understand that, I'm not measuring VM's CPU usage, I'm measuring Mongo's inside the VM, in that same VM I have cherokee and postgresql with 0% CPU usage cause they are idle as well. But if you say it is a VM bug I will believe you.

Thanks

Eliot Horowitz

unread,
Jul 1, 2011, 1:05:45 AM7/1/11
to mongod...@googlegroups.com
Its normal for mongo to use some cpu.
See: https://jira.mongodb.org/browse/SERVER-2114

> --
> You received this message because you are subscribed to the Google Groups
> "mongodb-user" group.
> To view this discussion on the web visit

> https://groups.google.com/d/msg/mongodb-user/-/TQG5PfIMG98J.

Reply all
Reply to author
Forward
0 new messages