Hi,
I'm implementing WFF extension library to integrate 3rd party load balancer that exposes SOAP API to control the nodes, pools, etc.
Based on F5 load balancer example it's pretty easy to implement basic web farm operations like "Add Farm", "Remove Farm", "Add Server", "Remove Server" and "Add to Load Balancing", but I'm having troubles with "Remove from Load Balancing" operation when load balancer is configured to use sticky sessions. There doesn't seem to be a non hacking way to implement this functionality using WFF.
1st try:
I implemented WebFarmOperationProvider named XXXDisableLoadBalancing that gets called by internal DisableLoadBalancingOperationProvider, starts draining if needed and uses Timer object to periodically check if node is drained before calling SetComplete() to
indicate that operation is completed. Provider was working, but I ended up with frozen IIS user interface after executing command "Remove from Load Balancing" :(
Obviously something was not good...
2nd try:
Internal DisableLoadBalancingOperationProvider uses LoadBalancerGateContext object to prevent disabling more server then configured via maximumStoppedServers setting. I decided to use the same approach to implement draining functionality but the result was
the same. It works, but IIS user interface still freeezes. I was a bit surprised to experience freezing behaviour as I'm using the same approach as GateContext, so I tested removing server nodes without my extension library. It's hard to believe, but LoadBalancerGateContext
itself freezes IIS user interface and at that point, task manager becomes your best friend for a moment :(
3rd try:
It became clear that WFF expects my provider to call SetComplete() even if the operation is not actually complete, so there must be a way to automatically repeat provider operation after some timeout. And there is... ServerOperationContext actually triggers
retry if you set its RetryTime property to non zero value. Looks promising but unfortunatelly Retry functionallity is not implemented on WebFarmOperationContext, which is used when internal DisableLoadBalancingOperationProvider triggers my XXXDisableLoadBalancingOperationProvider.
Ironically, internal provider uses ServerOperationContext internally, creates WebFarmOperationContext and passes it to my provider. I even thought about creating kind of proxy provider that would again create ServerOperationContext and pass that one to my
provider, but I couldn't find a way to create new ServerOperationContext because as usual, that last class you would need to make it happen, is marked as internal in Microsoft.Web.Farm library. :(
My creativity is at its limits so if anyone can share some alternative idea, I'm calling him James Bond for the rest of my life :)
Thank you,
Aleks