mysql_real_query is blocking #59

Open
erikdubbelboer opened this Issue Mar 2, 2012 · 0 comments

Comments

Projects
None yet
1 participant

Hi,

It seems you are using mysql_real_query() which is a blocking call. Nodejs only runs a maximum of 4 threads so running 4 slow queries using your library will block everything else.

You can try this by running 4 SELECT SLEEP(10) queries and then doing some fast query. The fast query will only run after the 4 slow queries are done. Example code here: https://gist.github.com/1957486

(The example code actually causes a Segmentation fault but if you want I can create another ticket for that)

An example on how to do async queries can be found here: http://jan.kneschke.de/2008/9/9/async-mysql-queries-with-c-api/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment