I would like to ask a couple of things about MongoDB and replica sets:

I have different meteor applications running on my private server; each one of them uses a different meteor database (and does not need to access other databases); right now only one mongod instance is running on the server, serving all applications; should I run different mongod instances (one for every application)?

I would like to create a replica-set with oplog; my question is: this is only useful for performance when there are a lot of requests (coming from many different clients) or will improve performance also in every single request? (The different members of the replica set will cooperate to find faster the documents requested by a single client?)

  • Setting up a replica set will not improve performance. It will provide redundancy for your data set and high availability. Depending on the read preference set by your application, it will always only perform a read against a single mongod instance. – James Wahlin Jan 7 '15 at 21:30
  • Ok, thanks for clarifing this; If I have everything running on a single dedicated server, with a lot of unused resources (memory, CPU and disk), is there something I can do to improve performance of mongodb? – Cereal Killer Jan 7 '15 at 22:15
  • If your server is too big try to use virtualization, like VMWare, to make many small servers to better cover your needs. What actually is the performance issue you facing? – Antonios Jan 8 '15 at 0:06
  • the apps running on the server (built with meteor.js) are not as fast as expected; in particular every app renders fast enough, but then takes too much time loading (few) documents from mongo; the server is not consuming resources, and so I'm trying to understand how to improve this performance; you can see the loading time in this page for example: paesidisandalmazzo.it/ita/beni-in-rete – Cereal Killer Jan 8 '15 at 0:16
  • Try running a .explain() on your queries. It may be that you need an index to support your reads. (See docs.mongodb.org/manual/applications/indexes for more on indexing) – James Wahlin Jan 8 '15 at 14:48

I would like to create a replica-set with oplog

As per MongoDB Documentation sources from MongoDB IN ACTION The Replica sets rely on two basic mechanisms: an oplog and a heartbeat. The oplog enables the replication of data, and the heartbeat monitors health and triggers failover.

At the heart of MongoDB’s replication stands the oplog. The oplog is a capped collection that lives in a database called local on every replicating node and records all changes to the data. Every time a client writes to the primary, an entry with enough information to reproduce the write is automatically added to the primary’s oplog.Once the write is replicated to a given secondary, that secondary’s oplog also stores a record of the write. Each oplog entry is identified with a BSON timestamp, and all secondaries use the timestamp to keep track of the latest entry they’ve applied.

Applications sometimes query secondary nodes for read scaling. If that’s happening, this kind of failure will cause read failures, So it’s important to design your application with failover in mind.

let’s look more closely at a real oplog and at the operations recorded in it. First connect with the shell to the primary node and switch to the local database.

amj:PRIMARY> use local
switched to db local

The local database stores all the replica set metadata and the oplog. Naturally, this database isn’t replicated itself. Thus it lives up to its name; data in the local database is supposed to be unique to the local node and therefore shouldn’t be replicated.If you examine the local database, you’ll see a collection called oplog.rs, which is where every replica set stores its oplog. You’ll also see a few system collections. Here’s the complete output:

amj:PRIMARY> show collections

replset.minvalid contains information for the initial sync of a given replica set member, and system.replset stores the replica set config document. Not all of your mongod servers will have the replset.minvalid collection. me and slaves are used to implement write concerns, and system.indexes is the standard index spec container.

right now only one mongod instance is running on the server, serving all applications; should I run different mongod instances (one for every application)

I don't think so it's good idea to run different one mongod instance for one application.

For Your Further Ref Here and Here

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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