Checking out the following modules for connecting to mysql db:
https://github.com/sidorares/nodejs-mysql-native
http://github.com/felixge/node-mysql
http://github.com/Sannis/node-mysql-libmysqlclient
Do they actually use asynchronous IO or they just use green threads?
Thank you!
The first two are JS based. I believe they both use events but also take callbacks. The last one uses lib_eio to take a callback and fire it when the C++ method finishes firing.
Node, in JS land, doesn’t have threads. Node runs in an event loop. That is why it is important for tasks that wait for responses or have latency (network calls, FS read/write, etc.) to be async.
These DB drivers would be next to useless if they weren’t because they would block the execution thread until they got a response from mysql.