Perhaps I was not clear in my original post, but by "threads" I meant the situation when a server forks/creates a new thread to handle new incoming connections:
... My concern is that because of the use of threads in such framework +s, keeping a DB handle over time will lead to problems.
I think it is a pretty sensible thing to ask: what happens to the parent's DB handle on fork and what's the good practice in this case. Perhaps a db handle should not be created on the parent (i.e. before a fork) but only created on each child (after forking), and closes when the child's life ends. But that excludes the use of DB handles pool and also the persistent use of a DB handle "for ever" within the server (and not within on each of its children).
I have updated my question to include this clarification and also test code for a simple mojo server ... which unfortunately refuses to fork!
In reply to Re^2: Database access and async web framework (like Mojolicious)
by bliako
in thread Database access and async web framework (like Mojolicious)
by bliako
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |