Re: [nodejs] Re: persistent connections

2012-09-16 Thread Marco Rogers
You're misunderstanding. I'm talking about connection pools. If you want to avoid a new connection for every stream, you might use a connection pool. But getting a connection out of the pool may not be a synchronous action. If all connections are in use, you may have to wait. Thus you would need an

Re: [nodejs] Re: persistent connections

2012-09-16 Thread Mike Nichols
Looking into this more, I think this won't be a problem with holding resources or async connect. When you call net.createConnection the .connect is called right away on the underlying Socket. When you do a write to the connection that was created it will connect and buffer the writes until it i

Re: [nodejs] Re: persistent connections

2012-09-16 Thread Marco Rogers
You can definitely get into trouble if you plan to create lots of these steam objects. node_redis and other libs use a connection pool underneath so you don't overuse resources. Of course that means `createConnection` would need to be async here, because you may have to wait for an available conne

[nodejs] Re: persistent connections

2012-09-16 Thread Mike Nichols
Here is the code under consideration (from redis-stream module) which I am considering using. Writing to the underlying stream creates a new connection. It seems like this would be expensive, but that is what I am asking...whether it is or not. One might say to keep the stream open with {end:fa

[nodejs] Re: persistent connections

2012-09-16 Thread Marco Rogers
It depends on the module and what it's doing. Can you point to it and give some more info about your use case? :Marco On Sunday, September 16, 2012 1:59:02 PM UTC-7, Mike Nichols wrote: > > I am using a module which uses a net.createConnection (for redis) per > stream instance. This would seem