On Sat, Jan 18, 2014 at 4:37 AM, Stefan Adams
<[email protected]>wrote:

> You even gave me the straight up answer (use -w large -c 1) but I didn't
> understand it and I read that message about 100 times.


I remember now one reason this was so difficult for me to grasp.

"Number of worker processes, defaults to 4. A good rule of thumb is two
worker processes per CPU
core."<http://mojolicio.us/perldoc/Mojo/Server/Prefork#workers>

I thought to myself, I have 1 CPU core, so 2 worker processes is what I
need!  And so I thought I was being told to crank up my number of process
from 1 (daemon) to 2 (prefork).  I feel it would be very advantageous to
adjust this statement to say something like:

"Number of worker processes, defaults to 4. A good rule of thumb for apps
which don't block is two worker processes per CPU core.  Otherwise if your
app does block, crank this up and set the number of max
clients<http://mojolicio.us/perldoc/Mojo/Server/Daemon#max_clients>to
1."


Now, this may not be the most truthful or accurate sentence or may mislead
in other ways, but I think it at least opens it up a bit more and feel free
to improve the wording.  Just as with my note on scalability, I thought for
little-ol-me writing a silly 10-20 person app, a good rule of thumb would
surely apply to me!

A couple other thoughts on this matter, and please forgive my ignorance if
these questions or ideas are stupid.  No big deal.

1) Can the prefork server be more dynamic with the number of running
processes?  That is, more like Apache, run the minimum number but allow it
to spike up to a maximum number?  This would be an unnecessary feature if
the only reason for it is to make it more Apache like, but does it have
other benefits?  Or, for those of us coming off of Apache, is it a nice way
to ween us off?  Or, rather, does it just encourage us to continue to write
bad apps?  Just an idea I was thinking about.

2) Is it possible for Mojo::IOLoop to detect that code is blocking??  I'm
thinking of the simplification you and Ben demonstrated with respect to
what an even loop is.  Could you set some stop watches that determine how
much time is spent within each of the "functions" of the event loop and if
that time is greater than some reasonable (but adjustable) number, it would
log a message stating so: "3.2 seconds spent in handle_writable_fds(), your
app is blocking; perhaps find where it's blocking and make it stop or
increase the number of workers and set max_clients to 1."  Now, that's an
overly verbose log message, but it gets my point across.  Could something
like this be done?  Is it a bad idea for some reason?  Some other possible
log messages: "3.2 seconds spent in handle_writable_fds(), your app is
blocking; See the official FAQ or unofficial Wiki for more info." or even
just "3.2 seconds spent in handle_writable_fds()"

-- 
*----------------------------------------------------------------*
*Keystone IT made the following notation*
*----------------------------------------------------------------*
*Email Confidentiality Notice: The information contained in this 
transmission is confidential, proprietary or privileged and may be subject 
to protection under the law, including the Health Insurance Portability and 
Accountability Act (HIPAA). *

*This message is for the sole use of the intended individual or entity to 
whom it is addressed. If you are not the intended recipient, you are 
notified that any use, distribution or copying of the message is strictly 
prohibited and may subject you to criminal or civil penalties. If you 
received this transmission in error, please contact the sender immediately 
at (314) 621-9500 and delete the material from all computers.*

-- 
You received this message because you are subscribed to the Google Groups 
"Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to