|Perl Monk, Perl Meditation|
Mojolicious / Hypnotoad / concurrency / data scopeby 1nickt (Abbot)
|on Jan 06, 2018 at 15:10 UTC||Need Help??|
1nickt has asked for the wisdom of the Perl Monks concerning the following question:
Hi brethren, I am newly developing with Mojolicious. I have a question about scope. I've read some of the Mojo doc but not found a clear answer to my concern.
If I understand correctly, by default running a Mojo app under Hypnotoad will allow each worker process to accept N concurrent client connections, where N defaults to 1000 (from max_connections in Mojo::IOLoop). One can override this with the clients option, all the way down to 1 so that the worker process exits and a new one is spawned after each request. This is recommended only for applications that are heavily blocking.
What I haven't been able top confirm is whether each client connection is completely separate from the others within a single worker process. Here's the scenario:
So what I want to make sure of is that the data stashed in the logger context hash is not shared, obviously. Do I need to set Hypnotoad so that only one client connection is handled per worker? Or is the scope limited to client connection already? Or, am I missing some fundamental Mojo concept?
The way forward always starts with a minimal test.