Re: Use of multiprocessing in Pyro
Scott Leerssen <[email protected]> Sun, 8 Dec 2013 09:45:31 -0500
| Newsgroups | gmane.comp.python.pyro |
|---|---|
| Message-ID | <[email protected]> |
Sent from my iPad > On Dec 8, 2013, at 5:56 AM, Irmen de Jong <[email protected]> wrote: > >> On 4-12-2013 14:40, Dick Kniep wrote: >> Hi list, >> >> We are running a system that has been built in the last decade. I want to implement a >> daemon that acts as middleware and stores the state of each logged on user. >> >> The businesslogic that has been built is NOT threadsafe. But I really need the daemon >> to be multithreaded. So I thought about multiprocessing where the memory is >> separated. >> >> What I am thinking about is to run Pyro in multiplexed mode and when a user logs on >> build the session in a multiprocessing way. Then when the session has been started, >> any subsequent request must be channeled to the correct process, but should satisfy >> my needs. >> >> Is this a viable path? > > Perhaps, I've never used Pyro in combination with multiprocessing. Give it a try! > > But personally I would rather use Pyro in a regular fashion and put some form of thread > safe layer between your business logic and Pyro's server objects. For instance a > thread-synchronisation mechanism based on queue. > > If the classes are not thread safe, you could have Pyro return a new instance of your object for each new proxy connection. We do this for isolation of some of our Pyro service objects. If the modules are not thread safe, then swap out Threading with Multiprocessing when you create each new object. Should work great! ------------------------------------------------------------------------------ Sponsored by Intel(R) XDK Develop, test and display web and hybrid apps with a single code base. Download it for free now! http://pubads.g.doubleclick.net/gampad/clk?id=111408631&iu=/4140/ostg.clktrk