Shared memory features? #317
Replies: 1 comment 4 replies
-
Hi @mcharytoniuk, this sounds quite like the discussion happened in #264. I feel that some shared memory feature in Granian is quite out of the project scope (at least at the moment), especially considering workers in Granian are separated processes, not threads (at least in the GIL version, we'll see what happens with Python 3.13 and the no-gil version), so that will require inter-process communication rather than just shared memory to address what you have in mind. I have some plans to add a broadcasting feature to RSGI (think about it like channels) in order to avoid the need of external tools to broadcast messages to websockets connected to different Granian processes, but right now it is just an idea and there's no ETA for that; it's also quite unclear at the moment if it could be added as extension to ASGI as well so other frameworks in the Python ecosystem can take advantage of that in addition to Emmett. I'd appreciate help on that side, especially in designing the protocol for RSGI inter-process communication (would that be TCP or UDP? Should we define a binary message spec or use something already available? Do we need any sort of consensus algorithm? etc), but I'm not on that page yet :) |
Beta Was this translation helpful? Give feedback.
-
Hello! :)
I really love Granian. It reminds me of Swoole (https://wiki.swoole.com/en/#/), which is similar in concept but for PHP (which is a good thing to me :)). That is the point of view I'm coming from.
Swoole has some shared memory features, like Table (https://wiki.swoole.com/en/#/memory/table), which is really useful for, for example, storing information about all the WebSocket connections started in the server among multiple workers; also things like Atomics, which are sometimes useful.
I know that similar use cases can be solved with an external in-memory store like Redis, but do you plan to implement shared memory features in the future? If so, do you need some help maybe? I do not mean re-implementing the Redis protocol, just the shared memory slices, atomics, and such, or communicating between the worker threads.
Best wishes!
Beta Was this translation helpful? Give feedback.
All reactions