Next: Introduction, Previous: (dir), Up: (dir) [Contents][Index]
This is the quux-hunchentoot Reference Manual, version 1.0.2, generated automatically by Declt version 3.0 "Montgomery Scott" on Mon Apr 19 17:33:31 2021 GMT+0.
• Introduction | What quux-hunchentoot is all about | |
• Systems | The systems documentation | |
• Files | The files documentation | |
• Packages | The packages documentation | |
• Definitions | The symbols documentation | |
• Indexes | Concepts, functions, variables and data types |
quux-hunchentoot ================ TODO ---- Have an acceptor that listens on existing connections so that scheduled work is done per-request as opposed to per-connection.
Next: Files, Previous: Introduction, Up: Top [Contents][Index]
The main system appears first, followed by any subsystem dependency.
• The quux-hunchentoot system |
Francois-Rene Rideau
MIT
Thread pooling for hunchentoot
1.0.2
quux-hunchentoot.asd (file)
Files are sorted by type and then listed depth-first from the systems components trees.
• Lisp files |
• The quux-hunchentoot.asd file | ||
• The quux-hunchentoot/pkgdcl.lisp file | ||
• The quux-hunchentoot/thread-pooling.lisp file |
Next: The quux-hunchentoot/pkgdcl․lisp file, Previous: Lisp files, Up: Lisp files [Contents][Index]
quux-hunchentoot.asd
quux-hunchentoot (system)
Next: The quux-hunchentoot/thread-pooling․lisp file, Previous: The quux-hunchentoot․asd file, Up: Lisp files [Contents][Index]
quux-hunchentoot (system)
pkgdcl.lisp
Previous: The quux-hunchentoot/pkgdcl․lisp file, Up: Lisp files [Contents][Index]
pkgdcl.lisp (file)
quux-hunchentoot (system)
thread-pooling.lisp
Next: Definitions, Previous: Files, Up: Top [Contents][Index]
Packages are listed by definition order.
• The quux-hunchentoot package |
pkgdcl.lisp (file)
Definitions are sorted by export status, category, package, and then by lexicographic order.
• Exported definitions | ||
• Internal definitions |
Next: Internal definitions, Previous: Definitions, Up: Definitions [Contents][Index]
• Exported functions | ||
• Exported classes |
Next: Exported classes, Previous: Exported definitions, Up: Exported definitions [Contents][Index]
thread-pooling.lisp (file)
thread-pooling.lisp (file)
Previous: Exported functions, Up: Exported definitions [Contents][Index]
A taskmaster that maintains a pool of worker threads
and a queue of accepted connections to be processed.
If MAX-THREAD-COUNT is null, a new thread will always be created
when all existing workers are busy.
If MAX-THREAD-COUNT is supplied, the number of worker threads is
limited to that. Furthermore, if MAX-ACCEPT-COUNT is not supplied, an
HTTP 503 will be sent if the thread limit is exceeded. Otherwise, if
MAX-ACCEPT-COUNT is supplied, it must be greater than MAX-THREAD-COUNT;
in this case, requests are accepted up to MAX-ACCEPT-COUNT, and only
then is HTTP 503 sent.
It is important to note that MAX-ACCEPT-COUNT and the HTTP 503 behavior
described above is racing with the acceptor listen backlog. If we are receiving
requests faster than threads can be spawned and 503 sent, the requests will be
silently rejected by the kernel.
In a load-balanced environment with multiple Hunchentoot servers, it’s
reasonable to provide MAX-THREAD-COUNT but leave MAX-ACCEPT-COUNT null.
This will immediately result in HTTP 503 when one server is out of
resources, so the load balancer can try to find another server.
In an environment with a single Hunchentoot server, it’s reasonable
to provide both MAX-THREAD-COUNT and a somewhat larger value for
MAX-ACCEPT-COUNT. This will cause a server that’s almost out of
resources to wait a bit; if the server is completely out of resources,
then the reply will be HTTP 503.
thread-pooling.lisp (file)
multi-threaded-taskmaster (class)
Thread-unsafe operations without a clear owner use this lock
(bordeaux-threads:make-lock "taskmaster-master")
taskmaster-master-lock (generic function)
A process that dispatches connections to worker processes for handling, or withholds them when resources are missing.
taskmaster-dispatcher-process (generic function)
(setf taskmaster-dispatcher-process) (generic function)
:dispatcher-channel
taskmaster-dispatcher-channel (generic function)
(setf taskmaster-dispatcher-channel) (generic function)
A context function, taking a thunk as argument, and calling it within proper context, for workers in the thread pool.
:context
(quote funcall)
taskmaster-context (generic function)
(setf taskmaster-context) (generic function)
bindings (as an alist) to wrap around workers in the thread pool.
:bindings
taskmaster-bindings (generic function)
(setf taskmaster-bindings) (generic function)
A kernel to which to bind lparallel:*kernel* to handle the thread pool.
taskmaster-thread-pool (generic function)
(setf taskmaster-thread-pool) (generic function)
A list of pending connection socket
:pending-connections
(lil/transform/classy:empty-fifo-queue)
taskmaster-pending-connections (generic function)
(setf taskmaster-pending-connections) (generic function)
The maximum number of request threads this taskmaster will simultaneously run before refusing or queueing new connections requests. If the value is null, then there is no limit.
(or integer null)
:max-thread-count
taskmaster-max-thread-count (generic function)
The number of taskmaster processing threads currently running.
integer
0
taskmaster-thread-count (generic function)
(setf taskmaster-thread-count) (generic function)
The maximum number of connections this taskmaster will accept
before refusing new connections. If supplied and an integer,
this must be greater than MAX-THREAD-COUNT.
The number of queued requests is the difference between MAX-ACCEPT-COUNT
and MAX-THREAD-COUNT. If NIL, then behave as if it were MAX-THREAD-COUNT.
If T, then keep accepting new connections until resources are exhausted (not recommended).
(or integer boolean)
:max-accept-count
taskmaster-max-accept-count (generic function)
The number of connection currently accepted by the taskmaster. These connections are not ensured to be processed, they may be waiting for an empty processing slot or rejected because the load is too heavy.
integer
0
taskmaster-accept-count (generic function)
(setf taskmaster-accept-count) (generic function)
Initarg | Value |
---|---|
:max-thread-count | hunchentoot::*default-max-thread-count* |
:max-accept-count | hunchentoot::*default-max-accept-count* |
Previous: Exported definitions, Up: Definitions [Contents][Index]
• Internal macros | ||
• Internal functions | ||
• Internal generic functions |
Next: Internal functions, Previous: Internal definitions, Up: Internal definitions [Contents][Index]
thread-pooling.lisp (file)
thread-pooling.lisp (file)
Next: Internal generic functions, Previous: Internal macros, Up: Internal definitions [Contents][Index]
thread-pooling.lisp (file)
thread-pooling.lisp (file)
Previous: Internal functions, Up: Internal definitions [Contents][Index]
thread-pooling.lisp (file)
thread-pooling.lisp (file)
thread-pooling.lisp (file)
thread-pooling.lisp (file)
The number of connection currently accepted by the taskmaster. These connections are not ensured to be processed, they may be waiting for an empty processing slot or rejected because the load is too heavy.
thread-pooling.lisp (file)
bindings (as an alist) to wrap around workers in the thread pool.
thread-pooling.lisp (file)
A context function, taking a thunk as argument, and calling it within proper context, for workers in the thread pool.
thread-pooling.lisp (file)
automatically generated reader method
thread-pooling.lisp (file)
automatically generated writer method
thread-pooling.lisp (file)
A process that dispatches connections to worker processes for handling, or withholds them when resources are missing.
thread-pooling.lisp (file)
Thread-unsafe operations without a clear owner use this lock
thread-pooling.lisp (file)
A list of pending connection socket
thread-pooling.lisp (file)
A kernel to which to bind lparallel:*kernel* to handle the thread pool.
thread-pooling.lisp (file)
Previous: Definitions, Up: Top [Contents][Index]
• Concept index | ||
• Function index | ||
• Variable index | ||
• Data type index |
Next: Function index, Previous: Indexes, Up: Indexes [Contents][Index]
Jump to: | F L Q |
---|
Jump to: | F L Q |
---|
Next: Variable index, Previous: Concept index, Up: Indexes [Contents][Index]
Jump to: | (
C D E F G M R T W |
---|
Jump to: | (
C D E F G M R T W |
---|
Next: Data type index, Previous: Function index, Up: Indexes [Contents][Index]
Jump to: | A B C D M P S T |
---|
Jump to: | A B C D M P S T |
---|
Previous: Variable index, Up: Indexes [Contents][Index]
Jump to: | C P Q S T |
---|
Jump to: | C P Q S T |
---|