Click here to Skip to main content
15,911,525 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have developed a .net windows TOP-UP application (HTTP LISTENERS) which accepts requests from Embeded devices

the application creates a thread along with unique database connection (SQL SERVER 2008 )for every request received from the devices and that connection rotates along the thread and the database connection closes when thread ends

i have observed that at peak hours number of requests received reaches to multiples of 100 also i have observed from the database by executing "SP_WHO" nearly 150-200 connection status is under "sleeping"

Is there any problem in creating these many database connections or any burden to the database

any other way to maintain these many requests at a time

Please Guide me......
Posted
Comments
Prasad Avunoori 20-Jun-14 1:49am    
Why don't you kill the long sleeping process by running any sql job?
sagar.panuganti 20-Jun-14 1:54am    
i have assigned 200 seconds in the connection string itself , Is there any problem with these SLEEPING connections.

1 solution

1.In generally the database connection are resources that should be used, then released as soon as possible, otherwise the speed and memory used by your database server will suffer.

2.So in your code open the connection only when is needed (access of the database data) and closed and release it as soon as possible (after the reading or updating of the data), and you should use try-catch-finally blocks for doing this!
 
Share this answer
 
Comments
sagar.panuganti 20-Jun-14 2:14am    
as mentioned in the question opening a unique for a thread and i am accessing the database 5 times (select,insert,updates) and i will close the connection at the end of all these transactions ... so as u mentioned in the solution if i opened and closed the connections i have to open 5 times and close 5 times for every request... these many switching will create any problem...?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900