Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

I have made a sample app that emulates what my real one does. It simply iterates over all documents of a specific collection over and over.

I start mongo (as a windows service) and mongostat shows almost no resident memory.

insert  query update delete getmore command flushes mapped  vsize    res faults  locked db idx miss %     qr|qw   ar|aw  netIn netOut  conn       time
*0     *0     *0     *0       0     1|0       0      6.03g  6.12g    71m      0 local:0.0%          0       0|0     0|0    62b     3k     3   09:35:11

I use the touch command on the single collection I have (which is about 2GB in size) and mongostat shows:

insert  query update delete getmore command flushes mapped  vsize    res faults          locked db idx miss %     qr|qw   ar|aw  netIn netOut  conn       time
*0     *0     *0     *0       0     5|0       0      6.03g  6.12g   2.1g 427937 HamsterSchool:0.0%          0       0|0     0|0   408b     4k     3   09:39:59
*0     *0     *0     *0       0     1|0       0      6.03g  6.12g   2.1g      0         local:0.0%          0       0|0     0|0    62b     3k     3   09:40:00

Which seems as though the entire collection is now resident in memory, but when I run the sample app, no matter how long, there are always a lot of page faults:

insert  query update delete getmore command flushes mapped  vsize    res faults          locked db idx miss %     qr|qw   ar|aw  netIn netOut  conn       time
*0     68     *0     *0       0     1|0       0      6.03g  6.12g   2.1g  35616 HamsterSchool:0.0%          0       0|0     1|0     6k    74m     4   09:43:15
*0     68     *0     *0       0     4|0       0      6.03g  6.12g   2.1g  36068 HamsterSchool:0.0%          0       0|0     0|0     6k    75m     5   09:43:16

So, why are there any page faults at all if everything was already "touched"?. It's important to note that mongo runs on a 32GB RAM 64bit windows machine and 27GB of RAM is free at all times.

share|improve this question
    
You want the lock pages in memory option. –  Gaius Jul 6 at 9:45
    
@Gaius Enabled it for everyone, restarted and it had no effect. –  I3arnon Jul 6 at 11:39

1 Answer 1

up vote 1 down vote accepted

The page faults metric for MongoDB on Windows essentially contains hard (actually hitting disk) and soft (reallocating a pointer in memory) page faults. If you run the same experiment on Linux, the page fault metric only reports hard page faults and you will see the behavior you expect.

This is a known issue with the Windows version and the relevant issue for tracking/voting is SERVER-5799

share|improve this answer
    
Indeed. There are zero hard faults in the resource monitor. –  I3arnon Jul 7 at 7:23

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.