2

I just want to use mongos as a tool to scale up the number of connections I can open to mongo. So can I run the mongos without any config servers?

Has any one done this before?

1
  • 1
    No. You have varying connection scaling options depending on which driver used – orid Dec 30 '13 at 21:46
2

You cannot run a mongos without a config server, but you shouldn't have to in order to "scale up" your connections in any case - all you would be doing is adding an unnecessary layer between the driver you are using and the replica set. Unless you are using sharding, having that layer is not necessary, and can introduce performance issues in some cases (such as unbatching delays).

Your driver (which you don't mention) will have connection pool settings (the Java version can be found here) and perhaps multiplier options to determine how many connections you will open to your replica set, and how many threads will block and wait for a connection from the pool.

Some general advice:

  • If you do go down the route of having a single shard (which is what your replica set would effectively become with config servers and mongos processes), then do not run with a single config server - always run with 3 config servers in production, period.
  • Be careful with connections - each connection on the MongoDB side will require 1MB of memory (as will each connection on a mongos). If you ramp up connection levels you will be using memory for connection heap rather than data - this can be significant (10GB of memory for 10,000 concurrent connections)
  • If you do ramp up connections, make sure your ulimit settings can handle it

Finally, this use of mongos as a general proxy has been proposed before. In theory it would simplify some of the driver code needed if there was always a mongos in the connection path, but it is not as simple as just allowing it. The relevant feature request can be found (and voted for, watched etc.) here:

https://jira.mongodb.org/browse/SERVER-1594

0

No, mongos requires the presence of config-servers. The documentation doesn't say so explicitly, but it's really strongly implied in the fact that it has a --configdb parameter but nothing that could talk directly to a mongod.

You can run a single config-server just fine; it's a single-point-of-failure, but it's quite doable. It would allow you to fan-in your connections to your mongodb instance.

Your Answer

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