I've understood that connection objects are an expensive rescource that should be dropped when finnished using them. Is this true for closed connections or just for open ones? I've implemented a background jobs queue that will run jobs one after one in their own threads on my webserver. Each job gets it's own connection object that it will open when the job will run. Is this a waste of resources or is it OK to have each job keep it's closed connection, which may be several minutes, until the job will run? TIA mortb
Hello mortb, It's expensive, because DB Server should keep this connection. When you close connection, you save DB server resources You solution can't help save resources. Besides using DB connection pool you should use pool threading - to avoid spending resources on creating new Threads m> I've understood that connection objects are an expensive rescource m> that m> should be dropped when finnished using them. Is this true for closed m> connections or just for open ones? m> I've implemented a background jobs queue that will run jobs one after m> one in m> their own threads on my webserver. Each job gets it's own connection m> object m> that it will open when the job will run. Is this a waste of resources m> or is m> it OK to have each job keep it's closed connection, which may be m> several m> minutes, until the job will run? m> TIA m> mortb --- WBR, Michael Nemtsev :: blog: http://spaces.msn.com/members/laflour "At times one remains faithful to a cause only because its opponents do not cease to be insipid." (c) Friedrich Nietzsche
Have you tried object pooling your object that stores the connection object? Have each job pull an object from the pool when it needs it, and put it back in the pool when done. If you would like to see an example, I released an open source project that does just that. I also have a help file on-line that demonstrates how to use the component. Here is an thread I just published announcing the component: http://groups.google.com/group/microsoft.public.dotnet.datatools/browse_frm/thread/0605fb3028d5aa37/b2402ef4443ec499#b2402ef4443ec499 You can get the component here: http://sourceforge.net/projects/xqs-data/ The help file is here: http://www.xquisoft.com/xqsdn/documentation/index.html See XQuiSoft.Data.DataManager, and XQuiSoft.Data.IDataFactory or http://www.xquisoft.com/xqsdn/documentation/xquisoft.data.datamanager.html http://www.xquisoft.com/xqsdn/documentation/XQuiSoft.Data.IDataFactory.html Michael Lang XQuiSoft LLC http://www.xquisoft.com/