[Fedora-suds-list] Multi-threading question

Michael_Taylor at playstation.sony.com Michael_Taylor at playstation.sony.com
Thu Apr 23 00:47:06 UTC 2009


Hi suds mailing list,

My question is if the suds library is thread safe or not.  Specifically, 
I thinking of the following scenario.  A singleton instance of a class 
SOAPClient is created in a multi-threaded server, and upon 
initialization the class creates a sud Client that it maintains a 
reference to in an instance variable.  The suds Client would then be 
used across SOAPClient methods, which are being invoked by multiple 
threads (whose creation is driven by user requests).  The reason I am 
considering this design is that it eliminates the need to reprocess the 
wsdl (ie client = Client(url)) for every request.  My question is 
whether or not this usage pattern is safe.  (I've googled around for 
thread safety issues with urllib2, and as far as I can tell urllib2 
itself is thread safe, but I'm wondering if such thread safety extends 
to suds).  I'd also be interested in hearing if such an optimization is 
in your opinion even warranted (Another idea I'm considering is using 
thread locals to bind a Client instance to a thread, thus allowing for 
thread safety but still cutting down the parsing suds is forced to do).

Thanks for your time,

Mike Taylor




More information about the fedora-suds-list mailing list