Re: non-blocking XML-RPC

From: Jeremy Jones (zanesdad_at_bellsouth.net)
Date: 10/25/04


Date: Mon, 25 Oct 2004 07:18:00 -0400
To: Roose <moof@boof.moof>

Roose wrote:

>Is there a way to make the xmlrpclib calls using ServerProxy not block?
>Basically I am kicking off programs on remote machines, and they take hours
>to run. I want to use the features of marshaling arguments over, but most
>of the functions will not return any value at all.
>
>Is there some other mechanism I should be using?
>
>thanks,
>Roose
>
>
>
>

What problem are you trying to solve?

Do you want any and all XMLRPC requests (or even all requests of a
certain method) to return back quickly because you don't (want to / have
to) wait around for them and they don't return anything meaningful
anyway? Then you can follow Skip's recommendation of stuffing the
request into a queue and letting another thread pull things out of the
queue and spin off a thread to process it. Or you could use a
threadpool and have one thread pull requests out of the queue that Skip
recommended and pass the request to the threadpool. There's a pretty
useful threadpool recipe in the online Python Cookbook at
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/203871. I
couldn't find it in the dead tree Python Cookbook. Actually, if you use
that particular threadpool, you could just have the request handler pass
the request directly into the threadpool.

Or, do you want to be able to make more than one simultaneous request to
the XMLRPCServer and not have requests have to wait for each other
(assuming you're using the SimpleXMLRPCServer with no threaded mix-in)?
In this case, if it's still unimportant to return anything meaningful to
the caller, which it appears that it is not, you could still get away
with using a queue or threadpool. If you're interested in returning
something meaningful after computation is completed, then you could look
into creating a threaded XMLRPCServer using a threading mix-in. If you
are interested in this approach, post back and I'll scrounge some sample
code.

Jeremy Jones



Relevant Pages

  • Re: Threading in ASP.NET
    ... minLocalRequestFreeThreads would be more explicitly clear. ... When a request comes in, ASP.NET just uses these settings to decide if it ... "minXXXFreeThreads" available in the ThreadPool, ... external then it uses the minFreeThreads setting, ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Threading streams
    ... Use the Async web request features BeginGetRequest(), EndGetRequest, ... more efficiently on the threadpool and not block further processing as much. ...
    (microsoft.public.dotnet.framework.performance)
  • ThreadPool and contacting remote resources
    ... (not a webservice/http request per se but our concept of a request -- ... type of client request, we may have to contact an outside provider thru a ... webmethod response is not dependent on the 'outside' request completing ... I know that the ThreadPool class is used internally by various .NET classes. ...
    (microsoft.public.dotnet.languages.csharp)
  • Implement a Time-out in the waitQueue of the ThreadPool
    ... A function will Queues the method calls to the default ThreadPool. ... If a request is queued in the ThreadPool for a pre-defined amount ... the Original request will get executed before the Timeout delegate. ... all the remaining eight items in the queue. ...
    (microsoft.public.dotnet.framework)
  • Re: alternative file.copy
    ... files from uncs shares at same time with a independent thread for each one of ... them, im gonna try with the threadpool and the asyncronous io, thanks for all. ... > the Queue, copy the file, then get another request. ... which may require reducing the number of Workers. ...
    (microsoft.public.dotnet.languages.vb)