Last post Jun 19, 2014 09:37 PM by BetsyASP
Jun 18, 2014 03:27 AM|gaurav2ks|LINK
I need to solve a problem of preventing access to a expensive resource from the application. This application is hosted on Azure on two instance (and can be more based upon the load), there are finite number of calls that i can make to this expensive resource
[which is a web service]
I have to maintain a counter which can tell me how many calls are in progress and if threshold [number of allowed service calls are reached] i have to prevent further access to the web service until the counter comes down from the threshold value.
Currently i am doing this with the help of In Role Azure cache where I maintain the threshold values and the concurrency counter [which represents the current counter of the number of service calls]. Incrementing/decrementing logic for the councurrency counter
is thread safe, but the logic which checks if the concurrency counter is less than threshold value is not thread safe [as multiple threads can read the same value and if is found that the counter is less then threshold service call is allowed] and this is
giving me a hard time in managing the counter accurately.
I want to redesign this from start and want to use something like object pool, if the connection object is available in pool, allow the service call else wait for a retry after 2 seconds. Once the service call is complete return the object to the pool. Now
the challenge I am facing is how I can achieve this as the two instances of the application is running in load balanced way and i need to make sure the object pool is shared between these two instances.
Any pointers helping in designing this for a load balance application would be really appreciated.
Jun 19, 2014 09:37 PM|BetsyASP|LINK
The Service Application Framework provides a platform that enables developers to build scalable middle-tier applications hosted in SharePoint 2010, that provide data or processing resources to other SharePoint 2010 Web services. The Service Application Framework
enables services to be shared between computers on a server farm; it also helps load balance and manage services in SharePoint 2010.