pykka icon indicating copy to clipboard operation
pykka copied to clipboard

Support multiprocessing

Open acertain opened this issue 11 years ago • 6 comments

multiprocessing is like threading but a bit slower and allows multiple processors fully.

acertain avatar Mar 30 '13 00:03 acertain

Has anyone tried this? After a quick glance through the pykka source, and based on what I know about multiprocessing, it doesn't seem like this should be too difficult. But perhaps there are some issues that aren't immediately apparent.

abingham avatar Aug 15 '14 05:08 abingham

If you leave out any considerations about having actors running on different executors talking to each other, e.g. a system with only multiprocessing actors, you basically just need:

  • something that can run an actor (threads, eventlets),
  • something that can be the actor inbox which is safe to use concurrently under the given concurrency model (queue.Queue for threads), and
  • something that can return a single value or exception (often the same type as the actor inbox).

jodal avatar Aug 15 '14 06:08 jodal

In a "classic" actor model the actors should only be communicating through message passing, so it sounds like multiprocessing should be easy to implement in principle.

Do you think there are many people sharing state across actors without message passing?

abingham avatar Aug 15 '14 06:08 abingham

I don't know of that many projects using Pykka, but at least in Mopidy we usually keep quite strictly to the actor rules.

That said, I think that you'll have problems using pykka.ActorRegistry in a multiprocessing context, since it is simply based on module-level global state, protected by locks.

jodal avatar Aug 15 '14 06:08 jodal

http://thespianpy.com/doc/

efibutov avatar Jun 19 '18 05:06 efibutov

I'd love to see a backend implementation for both multiprocessing and asyncio. The multiprocessing backend should support Process and WorkerPool actors. Sadly I'm too new to Python to give it a serious try, but maybe I will once I've learnt more about the language.

cerlestes avatar Aug 05 '19 19:08 cerlestes