Thursday, 22 August 2013

Would lots of idle clients cause a "service too busy" exception?

Would lots of idle clients cause a "service too busy" exception?

I have a WCF service that has an instance mode of Single and a concurrency
mode of Multiple. I have the following code:
public static ICmsDataServiceWcf data
{
get
{
if (HttpContext.Current != null && HttpContext.Current.Session
!= null && HttpContext.Current.Session["DataService"] == null)
{
HttpContext.Current.Session.Add("DataService",
GetDataService());
}
if (HttpContext.Current != null && HttpContext.Current.Session
!= null && HttpContext.Current.Session["DataService"] != null)
{
return
(ICmsDataServiceWcf)HttpContext.Current.Session["DataService"];
}
return GetDataService();
}
}
The idea is that every client gets their own WCF client which only blocks
for their requests and I don't have to suffer the overhead of
creating/destroying clients multiple times.
Recently I have been getting some "service too busy" exceptions. Most of
these clients are sat idle most of the time. Does an idle client still
consume resources on the server? Is its instance persisted somehow server
side?
Can anyone see a reason why this could cause issues? (Except for the
memory wastage of letting lots of clients sit around until sessions get
abandoned - I'm looking at using a pool of clients and periodically
culling inactive/errored ones.)
Thanks,
Joe

No comments:

Post a Comment