Remote database performance?

hi
im not using mongo but reading about it and finding it interesting but I have a question about remote vs. local DB.
to me it seams that the focus of mongodb is that im supposted to use the cloud versions and that the local install is not what it suggested. I have no experience in this so the question that seams to pop up is performance. if my webserver is hosted somewere else im thinking the performance must be somewhat suffering?
I have a project using vaadin/tomcat and the DB is a mysql instance and for me when running the development version agains the hosted mysql is so much more slower, of cause, than the production web version running on the same server as the DB.

no suprise - but then the question - will using mongodb not have the same issue of … if not poor then at least somewhat slower perforance and why would I accept that? its nice that deploying the DB on a cloud is easy, backup secure and so on but if the performance is “bad”?

or is it a question of WHERE the webserver is hosted/located?

best regards
jan

Hi Jan,

On the contrary: one of the great things about MongoDB is that you can run it anywhere–on your laptop with MongoDB Community with the Atlas CLI’s local setup option, in the corporate data center with MongoDB Enterprise, and of course in the public cloud with MongoDB Atlas.

Using MongoDB locally, even offline or air-gapped, is a joy for developers everywhere!

You describe a web server hosted somewhere: ideally you’d host it in the same geographic region as your database.

Regarding performance: as a general rule, it’s important to understand that in the public cloud you’re talking about routnely making network calls that cross racks and availability zones in a physically specific region: the close proximity means network hops take <2ms… This is not significant for general purpose database performance use cases and has the major added advantage of a multi-availability zone posture for high availability including, for MongoDB replica sets in MongoDB Atlas, automatic failover. (Note there are some non-general purpose exceptions that are extremely latency intolerant–think high frequency trading and ad serving where you may optimize latency at the cost of high availability).

You should not see a material difference between running a web server locally connected to a local MongoDB instance and running the web server in the cloud connected to a nearby MongoDB Atlas cluster. However, depending on how you’re using the database, there can be some “gotchas” that manifest as a difference. For example if you’re not using authentication and TLS network encryption locally, you may notice that the time required to initiate a connection is lower than the TLS and auth handshake necessary to connect to a cluster in MongoDB Atlas… Sometimes folks find themselves pathologically opening and closing connections in their code, instead of re-using a connection pool. This is the kind of thing to “look out” for that could manifest as a meaningfully different performance experience in the cloud compared to local!

Hope that helps: and happy local development + remote cloud journeys ahead!
-Andrew

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.