in reply to LWP::UserAgent non-blocking calls
without forking
No help with your question...sorry...
But...I'm curious why forking is not an option
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: LWP::UserAgent non-blocking calls
by cavac (Prior) on Oct 25, 2024 at 09:40 UTC | |
Open file handles, open database transactions and (other) open network connections. For forking to be clean without side effects, i would need to close all those, fork and then reopen them in the parent process. My worker processes are cyclic executives that run many modules, each doing it's own thing. The main loop is basically something like this:
It may not be very elegant, but it's simple, easy to debug and easy to balance worker loads by moving module configurations between different XML config files. Yeah, the stuff dynamically configures itself on startup. Yes, depending on strict limits to the configuration of a specific worker, i can support forking. But this makes it a pain to work with, which is why i have been going to full "use non-blocking stuff" route for the last decade in my workers. Most of the stuff is low level protocols or web APIs that are already fire-and-check-back-later. I haven't encountered a web API that blocks for up to a minute in like 15 years, so i was unaware which modules were available to solve/circumvent that specific problem.
PerlMonks XP is useless? Not anymore: XPD - Do more with your PerlMonks XP Also check out my sisters artwork and my weekly webcomics | [reply] [d/l] |