Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have recently moved my MS Sql Server DB to MongoDB (2.0) on Windows Server 2008. Its containing 2 databases with following stats. (both databases get around 100 reads/writes per second). These writes are performed by a .Net application running on the same DB server.

> db.stats()
{
        "db" : "FirstDB",
        "collections" : 112,
        "objects" : 94020788,
        "avgObjSize" : 62.86065307174409,
        "dataSize" : 5910208136,
        "storageSize" : 14340792320,
        "numExtents" : 1277,
        "indexes" : 110,
        "indexSize" : 4279800784,
        "fileSize" : 27837595648,
        "nsSizeMB" : 16,
        "ok" : 1
}

> db.stats()
{
        "db" : "SecondDB",
        "collections" : 10,
        "objects" : 2926198,
        "avgObjSize" : 158.5025346883567,
        "dataSize" : 463809800,
        "storageSize" : 720027648,
        "numExtents" : 49,
        "indexes" : 8,
        "indexSize" : 115248896,
        "fileSize" : 2080374784,
        "nsSizeMB" : 16,
        "ok" : 1
}

I have found that MongoDB can hold all my data with required read/write speed. Now I need experts assistance to enforce reliability to my single-server (DB + application) setup;

But, during a period of 1 month, I have experienced following MongoDB-On-Windows issues;

  • Un-expected shutdown resulting as corrupt collections
  • MongoDB not releasing disk space for deleted objects (currently its around 28-GB and growing)
  • Increased number of Page Faults
  • No control over data in RAM (unable to pre-load required data in RAM and remove after few minutes)
  • Frequent DB Errors like: Unable to read data from the transport connection...

What would be the best rescue setup for me towards Reliability/Backup/Performance;

  1. Move MongoDB to Linux (provided that my .Net application using this DB will reside on Windows Server within same LAN)? OR
  2. Setup a 2-servers replica set with Master on Windows and Slave on Linux ? OR
  3. What you suggest... ?

Edit-1:

> db.serverStatus()
{
        "host" : "OWNEROR-GTPD0H9",
        "version" : "2.2.2",
        "process" : "mongod",
        "pid" : 5972,
        "uptime" : 2246315,
        "uptimeMillis" : NumberLong("2246314871"),
        "uptimeEstimate" : 1418073,
        "localTime" : ISODate("2013-02-01T18:20:48.371Z"),
        "locks" : {
                "." : {
                        "timeLockedMicros" : {
                                "R" : NumberLong(1009609910),
                                "W" : NumberLong("41166641284")
                        },
                        "timeAcquiringMicros" : {
                                "R" : NumberLong("233444382285"),
                                "W" : NumberLong("26675293061")
                        }
                },
                "admin" : {
                        "timeLockedMicros" : {
                                "r" : NumberLong("20598738435"),
                                "w" : NumberLong(0)
                        },
                        "timeAcquiringMicros" : {
                                "r" : NumberLong("681905051780"),
                                "w" : NumberLong(0)
                        }
                },
                "local" : {
                        "timeLockedMicros" : {
                                "r" : NumberLong(7054206),
                                "w" : NumberLong(0)
                        },
                        "timeAcquiringMicros" : {
                                "r" : NumberLong(323140436),
                                "w" : NumberLong(0)
                        }
                },
                "FirstDB" : {
                        "timeLockedMicros" : {
                                "r" : NumberLong("40372661580"),
                                "w" : NumberLong("54059509747")
                        },
                        "timeAcquiringMicros" : {
                                "r" : NumberLong("769458843030"),
                                "w" : NumberLong("357708107433")
                        }
                },
                "SecondDB" : {
                        "timeLockedMicros" : {
                                "r" : NumberLong("25053503869"),
                                "w" : NumberLong("395081595504")
                        },
                        "timeAcquiringMicros" : {
                                "r" : NumberLong("69429086729"),
                                "w" : NumberLong("9163194312205")
                        }
                }
        },
        "globalLock" : {
                "totalTime" : NumberLong("2246314871000"),
                "lockTime" : NumberLong("41166641284"),
                "currentQueue" : {
                        "total" : 54,
                        "readers" : 52,
                        "writers" : 2
                },
                "activeClients" : {
                        "total" : 2,
                        "readers" : 0,
                        "writers" : 2
                }
        },
        "mem" : {
                "bits" : 64,
                "resident" : 69,
                "virtual" : 34059,
                "supported" : true,
                "mapped" : 16793,
                "mappedWithJournal" : 33586
        },
        "connections" : {
                "current" : 114,
                "available" : 19886
        },
        "extra_info" : {
                "note" : "fields vary by platform",
                "page_faults" : 631285910,
                "usagePageFileMB" : 6848,
                "totalPageFileMB" : 49132,
                "availPageFileMB" : 34274,
                "ramMB" : 24567
        },
        "indexCounters" : {
                "note" : "not supported on this platform"
        },
        "backgroundFlushing" : {
                "flushes" : 37430,
                "total_ms" : 86130745,
                "average_ms" : 2301.115281859471,
                "last_ms" : 3853,
                "last_finished" : ISODate("2013-02-01T18:19:49.233Z")
        },
        "cursors" : {
                "totalOpen" : 227,
                "clientCursors_size" : 227,
                "timedOut" : 125,
                "totalNoTimeout" : 226
        },
        "network" : {
                "bytesIn" : 46807928165,
                "bytesOut" : 24400717839,
                "numRequests" : 462799358
        },
        "opcounters" : {
                "insert" : 92590009,
                "query" : 92755757,
                "update" : 183285338,
                "delete" : 7489,
                "getmore" : 1004,
                "command" : 94208472
        },
        "asserts" : {
                "regular" : 0,
                "warning" : 0,
                "msg" : 0,
                "user" : 97431,
                "rollovers" : 0
        },
        "writeBacksQueued" : false,
        "dur" : {
                "commits" : 17,
                "journaledMB" : 0.139264,
                "writeToDataFilesMB" : 0.033338,
                "compression" : 2.2571516556184057,
                "commitsInWriteLock" : 0,
                "earlyCommits" : 0,
                "timeMs" : {
                        "dt" : 3291,
                        "prepLogBuffer" : 0,
                        "writeToJournal" : 8,
                        "writeToDataFiles" : 1,
                        "remapPrivateView" : 38
                }
        },
        "recordStats" : {
                "accessesNotInMemory" : 3942359,
                "pageFaultExceptionsThrown" : 15956,
                "FirstDB" : {
                        "accessesNotInMemory" : 163718,
                        "pageFaultExceptionsThrown" : 6931
                },
                "SecondDB" : {
                        "accessesNotInMemory" : 3778641,
                        "pageFaultExceptionsThrown" : 9025
                },
                "admin" : {
                        "accessesNotInMemory" : 0,
                        "pageFaultExceptionsThrown" : 0
                },
                "local" : {
                        "accessesNotInMemory" : 0,
                        "pageFaultExceptionsThrown" : 0
                }
        },
        "ok" : 1
}
share|improve this question

closed as not constructive by Brent Pabst, John Gardeniers, Khaled, Alex, Scott Pack Jan 28 '13 at 16:26

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.If this question can be reworded to fit the rules in the help center, please edit the question.

    
It would be good if you could provide detailed error information. As it stands now your question is overly broad and not really answerable in the Q&A format. It solicits too many opinions. –  Brent Pabst Jan 28 '13 at 9:41

1 Answer 1

up vote 0 down vote accepted

I'd recommend not using Windows for hosting a MongoDB server.. Here's a few reasons why:

  1. You've already seen unexpected behavior, such as unexpected shutdowns, disk space issues, RAM problems and so on.
  2. The support community is "expecting" standard MongoDB on Linux, it makes everything easier especially when you're after community support.
  3. Someone posted recently about MySQL server on Windows which was broken by an incompatible upgrade, it's not entirely beyond the realm of possibility to imagine that the same thing might occur, as most updates will be tested against things like SQL Server, but probably not against Mongo.

I'd be even more cautious about running Mongo on Linux with a Slave on a different OS. I'd even be worried about running a slave on a different Linux Distribution, to some extent (mostly because of glibc variations, and so on). I can't begin to imagine circumstances where I'd see a cluster like this a good thing.

So here's the plan:

Migrate your MongoDB servers so that they're on linux. Seriously.

Increase the number of MongoDB servers: A 2-server replica set is fine, except having odd numbers of servers (especially odd primes) mean that the majority selection is a lot easier, if you have 2 servers, and neither one can see each other, then you have an awkward-to-resolve split-brain scenario.

You can have 2 primary servers, and one node which only does arbitration..

If you have 3, 5, 7, servers, then you have at least one node which can be the arbiter, and make a decision about which set is the active set. This is why a 3-member set is the minimum recommended by 10Gen.

share|improve this answer

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