Some more concrete example, to support my assertion, and to have a clear
picture of what can be used.

I just found:

https://github.com/felixge/node-mysql

It manage a pool:
https://github.com/felixge/node-mysql/blob/master/lib/Pool.js
A pool manage a list of available Connection
https://github.com/felixge/node-mysql/blob/master/lib/Connection.js
and connection use require('net')

That's the magic! ;-) The driver author uses LibUv indirectly.

Angel "Java" Lopez
@ajlopez



On Wed, Feb 26, 2014 at 4:45 PM, Angel Java Lopez <[email protected]>wrote:

> Ummm... You can write a driver in JS code that use require('net'). And in
> that module, the socket I/O is, at the end, managed by LibUv. The same for
> require('fs') for file I/O.
>
> Am I right?
>
> And yes, the driver could be implemented in C, and then, it should call
> LibUv in some way.
>
> Angel "Java" Lopez
> @ajlopez
>
>
>
> On Wed, Feb 26, 2014 at 4:26 PM, Matt <[email protected]> wrote:
>
>> But unfortunately isn't how it works at all, unless the database driver
>> in question is using C libraries which use the thread pool (which most of
>> them don't these days).
>>
>> It's all about the event loop. Here's how an event loop works:
>> http://baudehlo.com/2013/02/14/how-an-event-loop-works/
>>
>>
>> On Wed, Feb 26, 2014 at 12:53 PM, Reza Razavipour <
>> [email protected]> wrote:
>>
>>> makes perfect sense, thank you
>>>
>>> Regards,
>>> Reza
>>>
>>>
>>> On Wed, Feb 26, 2014 at 9:16 AM, Angel Java Lopez <[email protected]
>>> > wrote:
>>>
>>>> JavaScript in Node is single thread. But async I/O is derived to LibUv,
>>>> that uses threads. Usually, a DB driver calls the database server, using
>>>> sockets. Then, that communication will be handle by LibUv, returning the
>>>> results in a callback. Your single JS threads is available for other tasks
>>>>
>>>> Angel "Java" Lopez
>>>> @ajlopez
>>>>
>>>>
>>>>
>>>> On Wed, Feb 26, 2014 at 2:14 PM, Reza Razavipour <
>>>> [email protected]> wrote:
>>>>
>>>>> If node is single threaded and I can only be making one database call
>>>>> at any time, what is the point of having a pool of db connnections?
>>>>>
>>>>> --
>>>>> --
>>>>> Job Board: http://jobs.nodejs.org/
>>>>> Posting guidelines:
>>>>> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
>>>>> You received this message because you are subscribed to the Google
>>>>> Groups "nodejs" group.
>>>>> To post to this group, send email to [email protected]
>>>>> To unsubscribe from this group, send email to
>>>>> [email protected]
>>>>> For more options, visit this group at
>>>>> http://groups.google.com/group/nodejs?hl=en?hl=en
>>>>>
>>>>> ---
>>>>> You received this message because you are subscribed to the Google
>>>>> Groups "nodejs" group.
>>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>>> an email to [email protected].
>>>>>
>>>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>>>
>>>>
>>>>  --
>>>> --
>>>> Job Board: http://jobs.nodejs.org/
>>>> Posting guidelines:
>>>> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
>>>> You received this message because you are subscribed to the Google
>>>> Groups "nodejs" group.
>>>> To post to this group, send email to [email protected]
>>>> To unsubscribe from this group, send email to
>>>> [email protected]
>>>> For more options, visit this group at
>>>> http://groups.google.com/group/nodejs?hl=en?hl=en
>>>>
>>>> ---
>>>> You received this message because you are subscribed to a topic in the
>>>> Google Groups "nodejs" group.
>>>> To unsubscribe from this topic, visit
>>>> https://groups.google.com/d/topic/nodejs/-_pSIeB7Vws/unsubscribe.
>>>> To unsubscribe from this group and all its topics, send an email to
>>>> [email protected].
>>>>
>>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>>
>>>
>>>  --
>>> --
>>> Job Board: http://jobs.nodejs.org/
>>> Posting guidelines:
>>> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
>>> You received this message because you are subscribed to the Google
>>> Groups "nodejs" group.
>>> To post to this group, send email to [email protected]
>>> To unsubscribe from this group, send email to
>>> [email protected]
>>> For more options, visit this group at
>>> http://groups.google.com/group/nodejs?hl=en?hl=en
>>>
>>> ---
>>> You received this message because you are subscribed to the Google
>>> Groups "nodejs" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to [email protected].
>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>
>>
>>  --
>> --
>> Job Board: http://jobs.nodejs.org/
>> Posting guidelines:
>> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
>> You received this message because you are subscribed to the Google
>> Groups "nodejs" group.
>> To post to this group, send email to [email protected]
>> To unsubscribe from this group, send email to
>> [email protected]
>> For more options, visit this group at
>> http://groups.google.com/group/nodejs?hl=en?hl=en
>>
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "nodejs" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected].
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>
>

-- 
-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to