Performance in Microsoft SQL Server
-
Hello. I have opened a lot of
cn.open()
andcn.close()
in my web application. for example when a page is loading, almost 10 connections are opened and closed. Whether it creates performance problems?Regards. Mehdi Ghiasi
-
Hello. I have opened a lot of
cn.open()
andcn.close()
in my web application. for example when a page is loading, almost 10 connections are opened and closed. Whether it creates performance problems?Regards. Mehdi Ghiasi
-
Hello. I have opened a lot of
cn.open()
andcn.close()
in my web application. for example when a page is loading, almost 10 connections are opened and closed. Whether it creates performance problems?Regards. Mehdi Ghiasi
You would be much better off by using one connection and either returning multiple result sets from a stored procedure or using the MARS feature over a single connection.
onwards and upwards...
-
Hello. I have opened a lot of
cn.open()
andcn.close()
in my web application. for example when a page is loading, almost 10 connections are opened and closed. Whether it creates performance problems?Regards. Mehdi Ghiasi
I'd have a read of this MSDN Article: Connection Pooling[^] Also Connection pooling is turned on by default when using ADO.NET
Nagy Vilmos wrote:
And eat bacon. Bacon's real important for 'puters.
modified on Thursday, May 5, 2011 5:01 PM
-
Mehdi Ghiasi wrote:
Whether it creates performance problems?
No, it doesn't. Opening a connection to a server that you have already connected to is fast. You could write a small application to test and verify my statement :)
I are Troll :suss:
My server and sql server are different. (server of microsoft sql server is not localhost. it is sql.something.com) So, isn't there any performance problem?
Regards. Mehdi Ghiasi
-
You would be much better off by using one connection and either returning multiple result sets from a stored procedure or using the MARS feature over a single connection.
onwards and upwards...
Where can I learn about this?!
Regards. Mehdi Ghiasi
-
My server and sql server are different. (server of microsoft sql server is not localhost. it is sql.something.com) So, isn't there any performance problem?
Regards. Mehdi Ghiasi
Mehdi Ghiasi wrote:
So, isn't there any performance problem?
That depends on the network-card, the cabling and the amount of sunspots. Opening and closing a connection goes fast enough to simulate a file-system and open and close the connection on each operation that explorer requests. Simon's article on the ThreadPool explains how and why.
I are Troll :suss:
-
Where can I learn about this?!
Regards. Mehdi Ghiasi
I heard about this website called google.com. Apparently it has been around for a while and is very easy to use, but you should check for yourself. That's www.google.com
Craigslist Troll: litaly@comcast.net "I have a theory that the truth is never told during the nine-to-five hours. " — Hunter S. Thompson
-
Hello. I have opened a lot of
cn.open()
andcn.close()
in my web application. for example when a page is loading, almost 10 connections are opened and closed. Whether it creates performance problems?Regards. Mehdi Ghiasi
Mehdi Ghiasi wrote:
almost 10 connections
I hope you mean one connection is opened and closed almost ten times. If so, you might do better to open it once and close it at the end of the method.
-
Hello. I have opened a lot of
cn.open()
andcn.close()
in my web application. for example when a page is loading, almost 10 connections are opened and closed. Whether it creates performance problems?Regards. Mehdi Ghiasi
i think little bit issue will arise. If you instantiate an object for ten times or create ten object or some method of an object (like,- Open() and Close()) performance can be a issue . mostly its a bad programming practice.