[hunchentoot-devel] turning off logging, and socket backlogs (patches included)
Hans Hübner
hans.huebner at gmail.com
Tue Mar 15 05:54:50 UTC 2011
Hi John,
thank you for your suggestions and patches. I have committed slight
variations of them:
ACCEPTOR-ACCESS-LOG-PATHNAME and ACCEPTOR-MESSAGE-LOG-PATHNAME have
been renamed to ACCEPTOR-ACCESS-LOG-DESTINATION and
ACCEPTOR-MESSAGE-LOG-DESTINATION, respectively. Both can be set to
either a string or pathname designating a file, to an open stream or
to NIL. NIL suppresses logging, the other two option should be
obvious. *ERROR-OUTPUT* is the default for both.
A new LISTEN-BACKLOG slot has been added to the ACCEPTOR class which
can be set by the corresponding initarg during ACCEPTOR creation.
Patch review comments:
- Documentation was missing
- Use :INITARG instead of :INITFORM, in particular if you want a value
to be configurable. In Hunchentoot, we use :INITFORM only for slots
which can't be set by the user in the MAKE-INSTANCE call. Rather, we
use :INITARG together with the :DEFAULT-INITARG clause in DEFCLASS.
- If a slot cannot be set meaningfully, use :READER instead of
:ACCESSOR. This was the case for the backlog slot, as it is never
consulted after the listen() call has been made.
- We do not use all-uppercase for CL symbols like T or NIL in our source code.
(Obviously, these are just stylistic issues which are only valid in
this form for Hunchentoot. I don't claim that they are universal).
Thanks again! Please test what I've committed and send more patches
if you need to.
-Hans
On Mon, Mar 14, 2011 at 9:53 PM, JTK <jetmonk at gmail.com> wrote:
>
> [This is all in a recent bknr svn hunchentoot running on opencml and sbcl on
> a mac 10.6]
>
> 1. Logging:
> I've been playing with running hunchentoot under heavy loads using
> easy-acceptor,
> and running against apache-bench (ab)
> I noticed that logging to *error-output* often causes socket failures under
> heavy
> load, at least in SLIME. Is there a reason why with-open-file-or-console in
> log.lisp
> couldn't use a NIL pathname to simply not log, and pathname=T would log
> to *error-output*, which is what NIL presently means? Now, there seems to
> be no
> way to turn off logging (besides subclassing acceptor).
>
>
> 2. Backlog in listener:
> I found that in the start-listening method in acceptor.lisp, there is no
> BACKLOG
> set for usocket:socket-listen. I think that others have pointed this out as
> well.
> The default apache backlog seems to be 100 to 512
> [1,2,3] though the default on a macintosh seems silently limited to 128 [4].
> In the usocket
> routines used by hunchentoot backlog seems to be only 5. This seems
> two orders of magnitude smaller than what is standard for web servers.
> I tried putting in :BACKLOG 50 into the start-listening method in
> acceptor.lisp
> and it eliminated most failures of ab. Is there any reason why acceptor
> objects
> shouldn't have a new backlog slot default value in them much larger than
> 5,
> which should be used in the start-listening method?
> The appended patches implement both changes, if these suggestions are judged
> useful.
> The backlog is 50. I hope they're done correctly; I'm not experienced in
> submitting patches.
> John
>
> [1] http://groups.google.com/group/modwsgi/browse_thread/thread/b6d66d3fe5a53d2c
> [2] http://weblog.pigfoot.org/pigfoot/2007/07/05/whats-the-maximum-value-of-backlog-argument-in-listen2-system-call/
> [3] /usr/include/apache2/mpm_common.h:#define DEFAULT_LISTENBACKLOG 511
> [4] http://developer.apple.com/library/mac/#documentation/darwin/reference/manpages/man2/listen.2.html
> _______________________________________________
> tbnl-devel site list
> tbnl-devel at common-lisp.net
> http://common-lisp.net/mailman/listinfo/tbnl-devel
>
More information about the Tbnl-devel
mailing list