What is the best practice around implementing WCF proxy pooling? What precautions should be taken in the design?
Any pointers in this direction is greatly appreciated.
What is the best practice around implementing WCF proxy pooling? What precautions should be taken in the design?
Any pointers in this direction is greatly appreciated.
Why do you want to pool proxies?
Pools usually only exist when a resource (like a database connection) is scarce, expensive to build and possibly costly to maintain.
This should not be the case with WCF proxies, really - you create them as needed, and discard them when no longer needed.
I don't see any benefit or real use in trying to pool WCF proxies - what problem or issue are you trying to solve?
OK, thanks for your reply - I do understand what you're trying to accomplish - but I'm afraid, you're pretty much on your own, since I don't think there's any bits and pieces in the .NET framework and/or the WCF subsystem to would aid in creating proxy pools.
Marc
PS: as the article that Tuzo linked to shows, maybe you can get away with just caching the channelFactory objects. Creating those is indeed quite expensive, and if you can cache those for the lifetime of the app, maybe that'll be good enough for your needs. Check it out!
If you want to go down that path, from Performance Improvement for WCF Client Proxy Creation in .NET 3.5 and Best Practices:
You need to implement the right synchronization logic for managing the proxies.
You need to make sure the proxies are used equally. Sometimes, you may want to implement a round-robin pattern for the proxies.
You need to handle exceptions and retries for the pool.
The pool size needs to be limited and configurable.
You may need to be able to create proxies even if when no proxy is available from the pool.