I have a client/server application that depends on MS SQL database for backend storage, the server application is a WCF TCP service that handles the clients requests by selecting from the database set of information.
The service is configured as PerSession and support 500 sessions. In the client side the user can open different views each view has an object of my service (proxy object) so each view is a session; each view has a Threading timer that requests the data from the server using the proxy object every second.
The application is running good for small number of users with 8 views but when I increase the number a Time out exception occured in the SqlConnection.Open as there is no avilable connection in the connection pool.
There is session/object for each view as the WCF service is not thread safe; it depends on single threaded database access layer that uses SqlDataReaders and SqlAdapters.
Is there a way to increase the number of database connections? it seems 800 is the maximum!! From your point of view how can I increase the number of users?
Shall I change the DB layer and make it multithreaded and make the WCF service single? I think this is the bottleneck in the design (can you recommend an article for multithreading in ADO.net)
P.S:
can I replace the database with in memory database or any faster storage?
According to answers:
I changed the backend service to close the connection per method call, but I am facing the same problem as the number of users increases the latency increases (more than one second) , does this mean I have to change the database solution? and what is the alternative solution?.
After that:
I tried two solutions
- Open and close the sql connection per method call
- Increase the size of the connection pool in the connection string
But both gives me latency if I increase the number of users, at the same time I monitor the queries in the sql porfiler it seems each query does not take more than 20 milliseconds.