http://qs321.pair.com?node_id=1206819

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:

Why bother composing the Logger role and not just get a logger in the main class? Because the existing code relies on the logger being provided in a role.

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?

Thanks!


The way forward always starts with a minimal test.