GmCapsule [main]

Use multiple processes to handle requests

=> Jaakko Keränen

Sat Jun 17 10:24:30 2023 +0300

Normal Python threading is subject to the Global Interpreter Lock,

which means only one thread gets to execute Python code at once.

This still allows concurrent I/O operations, but if request handling

requires long-running Python code, only one request would be handled

at any given time, slowing things down.

This commit adds a configurable number of RequestHandlers

that offload the processing of requests to separately running

processes. Several changes were necessary to allow passing data

between the main process and the workers, mostly to ensure that

everything is pickleable.

The main process still uses multiple threads to handle incoming

connections and do I/O with the clients.

 README.md                      |   2 +-
 docs/api.rst                   |  12 +-
 example.ini                    |  25 +-
 gmcapsule/__init__.py          |   9 +-
 gmcapsule/gemini.py            | 623 +++++++++++++++++++++++++----------------
 gmcapsule/modules/99_static.py |   4 +-
 6 files changed, 415 insertions(+), 260 deletions(-)

=> Diff (Colored) | Diff (Colored, Plain Text) | 🔨 Patch

=> Parent d17e4e2 | Repository

Proxy Information
Original URL
gemini://git.skyjake.fi/gmcapsule/main/commits/e54db584a4a3d225b29d41eebc594b216aeaf033
Status Code
Success (20)
Meta
text/gemini; charset=utf-8
Capsule Response Time
27.275852 milliseconds
Gemini-to-HTML Time
0.514591 milliseconds

This content has been proxied by September (3851b).