Web service invoke

J

Jaiganesh

I have a web service which synchronizes data between 2 data bases by passing
the connection strings to a web method.This web service will be hosted in a
server and utilized by more than 30 different applications hosted in
different servers.It is working fine initially but after some time as the
requests
from these applications increases web service is not responding or not
processing its job.When I tried to browse the web service I am getting the
error "Exception of type System.OutOfMemoryException was thrown".Currently I
am calling the web method asynchronously.

Please help me in solving this problem.

Thanks in Advance,
Jaiganesh

from
 
G

GCR

OK, I see your problem, and it dosen't has to do with web service calls! You
are creating database connections based on the connection strings delivered
as web method parameters, and use these connections for database
synchronization. Since these operations usually take some time to complete,
and since you have a lot of consumers, you quickly get into the situation of
having some hundreds of open database connections with sync operations
running over them, which is quite expensive in terms of memory and processing
time.
I would guess that the web service gets only a limited number different
connection strings, so I would put them in the web.config. Then I would use
the Application_Start event handler in global.asax to initialize one instance
for each of these connections, and taking care that the connections are
pooled. Then I'd change the web method, so insetead of the connection string,
I'd have an identifier for the connection pool. The web method implementation
would select the apropriate connection pool from the Application, based on
the provided identifier, and use the pool as you do it now. Las, I'd place
cleanup code in the Application_End event handler to close the connection
pools.
This way you use just a limited number of connections, which are also pooled.
Hope it helps!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top