Reputation: 1574
Yeah, I'm just wondering whether is it a good idea to use a MySQL or MongoDB driver written in pure JS.. I mean, it shouldn't be problem when running a small app with small db for 100 users / month, but what about heavy load / really huge DBs?
Aren't there any professional MySQL and Mongo drivers for NodeJS that I can compile? The performance of these should be way much better.
Or am I wrong about this? For example, Mongoose uses a driver written in pure JS. Is that good enough to efficiently query 500 million documents?
Any suggestion / advice would be appreciated!
Thanks
EDIT:
So thanks for the response guys. Well I'm still a but unsure about this :). I mean, writing drivers in Python or Java or even C# surely makes sense, but those languages are much more powerful and faster than JS.
Here is what makes me worried:
My MySQL driver (written in pure JS) executes the query SHOW COLUMNS FROM Table in 300-400ms. If I execute the exact same query from MySQL shell, it takes 20ms.
I use an ORM (JugglingDB) which makes use of https://github.com/felixge/node-mysql module. The 300ms is the raw query query execution time, as printed in debug mode.
Why do we see such a big difference? Is it the ORM, or Node/JS or the driver is too slow?
Upvotes: 0
Views: 156
Reputation: 36784
Most MongoDB drivers are written in the language that they are used with. The Python driver is written in Python, the Perl driver in Perl. There are a few exceptions, as the PHP driver is written in C and the Python driver as an optional C extension to speed things up.
The node-mongodb-native driver is written all in JavaScript: https://github.com/mongodb/node-mongodb-native. It make sense as the NodeJS platform is optimised for this and there should be no adverse effects.
Upvotes: 1