The quux-hunchentoot Reference Manual

Table of Contents

Next: , Previous: , Up: (dir)   [Contents][Index]

The quux-hunchentoot Reference Manual

This is the quux-hunchentoot Reference Manual, version 1.0.1, generated automatically by Declt version 2.3 "Robert April" on Wed Mar 14 04:29:40 2018 GMT+0.


Next: , Previous: , Up: Top   [Contents][Index]

1 Introduction

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: , Previous: , Up: Top   [Contents][Index]

2 Systems

The main system appears first, followed by any subsystem dependency.


Previous: , Up: Systems   [Contents][Index]

2.1 quux-hunchentoot

Author

Francois-Rene Rideau

License

MIT

Description

Thread pooling for hunchentoot

Version

1.0.1

Dependencies
Source

quux-hunchentoot.asd (file)

Components

Next: , Previous: , Up: Top   [Contents][Index]

3 Files

Files are sorted by type and then listed depth-first from the systems components trees.


Previous: , Up: Files   [Contents][Index]

3.1 Lisp


Next: , Previous: , Up: Lisp files   [Contents][Index]

3.1.1 quux-hunchentoot.asd

Location

quux-hunchentoot.asd

Systems

quux-hunchentoot (system)


Next: , Previous: , Up: Lisp files   [Contents][Index]

3.1.2 quux-hunchentoot/pkgdcl.lisp

Parent

quux-hunchentoot (system)

Location

pkgdcl.lisp

Packages

quux-hunchentoot


Previous: , Up: Lisp files   [Contents][Index]

3.1.3 quux-hunchentoot/thread-pooling.lisp

Dependency

pkgdcl.lisp (file)

Parent

quux-hunchentoot (system)

Location

thread-pooling.lisp

Exported Definitions
Internal Definitions

Next: , Previous: , Up: Top   [Contents][Index]

4 Packages

Packages are listed by definition order.


Previous: , Up: Packages   [Contents][Index]

4.1 quux-hunchentoot

Source

pkgdcl.lisp (file)

Use List
Exported Definitions
Internal Definitions

Next: , Previous: , Up: Top   [Contents][Index]

5 Definitions

Definitions are sorted by export status, category, package, and then by lexicographic order.


Next: , Previous: , Up: Definitions   [Contents][Index]

5.1 Exported definitions


Next: , Previous: , Up: Exported definitions   [Contents][Index]

5.1.1 Functions

Function: channel-recv CHANNEL &key BLOCKP
Package

quux-hunchentoot

Source

thread-pooling.lisp (file)

Function: channel-send CHANNEL MESSAGE
Package

quux-hunchentoot

Source

thread-pooling.lisp (file)


Previous: , Up: Exported definitions   [Contents][Index]

5.1.2 Classes

Class: thread-pooling-taskmaster ()

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.

Package

quux-hunchentoot

Source

thread-pooling.lisp (file)

Direct superclasses

multi-threaded-taskmaster (class)

Direct methods
Direct slots
Slot: master-lock

Thread-unsafe operations without a clear owner use this lock

Initform

(bordeaux-threads:make-lock "taskmaster-master")

Readers

taskmaster-master-lock (generic function)

Slot: dispatcher-process

A process that dispatches connections to worker processes for handling, or withholds them when resources are missing.

Readers

taskmaster-dispatcher-process (generic function)

Writers

(setf taskmaster-dispatcher-process) (generic function)

Slot: dispatcher-channel
Initargs

:dispatcher-channel

Readers

taskmaster-dispatcher-channel (generic function)

Writers

(setf taskmaster-dispatcher-channel) (generic function)

Slot: context

A context function, taking a thunk as argument, and calling it within proper context, for workers in the thread pool.

Initargs

:context

Initform

(quote funcall)

Readers

taskmaster-context (generic function)

Writers

(setf taskmaster-context) (generic function)

Slot: bindings

bindings (as an alist) to wrap around workers in the thread pool.

Initargs

:bindings

Readers

taskmaster-bindings (generic function)

Writers

(setf taskmaster-bindings) (generic function)

Slot: thread-pool

A kernel to which to bind lparallel:*kernel* to handle the thread pool.

Readers

taskmaster-thread-pool (generic function)

Writers

(setf taskmaster-thread-pool) (generic function)

Slot: pending-connections

A list of pending connection socket

Initargs

:pending-connections

Initform

(lil/transform/classy:empty-fifo-queue)

Readers

taskmaster-pending-connections (generic function)

Writers

(setf taskmaster-pending-connections) (generic function)

Slot: max-thread-count

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.

Type

(or integer null)

Initargs

:max-thread-count

Readers

taskmaster-max-thread-count (generic function)

Slot: thread-count

The number of taskmaster processing threads currently running.

Type

integer

Initform

0

Readers

taskmaster-thread-count (generic function)

Writers

(setf taskmaster-thread-count) (generic function)

Slot: max-accept-count

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).

Type

(or integer boolean)

Initargs

:max-accept-count

Readers

taskmaster-max-accept-count (generic function)

Slot: accept-count

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.

Type

integer

Initform

0

Readers

taskmaster-accept-count (generic function)

Writers

(setf taskmaster-accept-count) (generic function)

Direct Default Initargs
InitargValue
:max-thread-counthunchentoot::*default-max-thread-count*
:max-accept-counthunchentoot::*default-max-accept-count*

Previous: , Up: Definitions   [Contents][Index]

5.2 Internal definitions


Next: , Previous: , Up: Internal definitions   [Contents][Index]

5.2.1 Macros

Macro: with-taskmaster-accessors SLOTS TASKMASTER &body BODY
Package

quux-hunchentoot

Source

thread-pooling.lisp (file)

Macro: with-thread-pool (TASKMASTER) &body BODY
Package

quux-hunchentoot

Source

thread-pooling.lisp (file)


Next: , Previous: , Up: Internal definitions   [Contents][Index]

5.2.2 Functions

Function: call-with-thread-pool TASKMASTER THUNK
Package

quux-hunchentoot

Source

thread-pooling.lisp (file)

Function: work-on-connection TASKMASTER CONNECTION
Package

quux-hunchentoot

Source

thread-pooling.lisp (file)


Previous: , Up: Internal definitions   [Contents][Index]

5.2.3 Generic functions

Generic Function: dispatcher-recv TASKMASTER &key &allow-other-keys
Package

quux-hunchentoot

Source

thread-pooling.lisp (file)

Methods
Method: dispatcher-recv (TASKMASTER thread-pooling-taskmaster) &key &allow-other-keys
Generic Function: dispatcher-send TASKMASTER MESSAGE &key &allow-other-keys
Package

quux-hunchentoot

Source

thread-pooling.lisp (file)

Methods
Method: dispatcher-send (TASKMASTER thread-pooling-taskmaster) MESSAGE &key &allow-other-keys
Generic Function: ensure-dispatcher-process TASKMASTER
Package

quux-hunchentoot

Source

thread-pooling.lisp (file)

Methods
Method: ensure-dispatcher-process (TASKMASTER thread-pooling-taskmaster)
Generic Function: run-dispatcher-thread TASKMASTER
Package

quux-hunchentoot

Source

thread-pooling.lisp (file)

Methods
Method: run-dispatcher-thread (TASKMASTER thread-pooling-taskmaster)
Generic Function: taskmaster-accept-count OBJECT
Generic Function: (setf taskmaster-accept-count) NEW-VALUE OBJECT
Package

quux-hunchentoot

Methods
Method: taskmaster-accept-count (THREAD-POOLING-TASKMASTER thread-pooling-taskmaster)
Method: (setf taskmaster-accept-count) NEW-VALUE (THREAD-POOLING-TASKMASTER thread-pooling-taskmaster)

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.

Source

thread-pooling.lisp (file)

Generic Function: taskmaster-bindings OBJECT
Generic Function: (setf taskmaster-bindings) NEW-VALUE OBJECT
Package

quux-hunchentoot

Methods
Method: taskmaster-bindings (THREAD-POOLING-TASKMASTER thread-pooling-taskmaster)
Method: (setf taskmaster-bindings) NEW-VALUE (THREAD-POOLING-TASKMASTER thread-pooling-taskmaster)

bindings (as an alist) to wrap around workers in the thread pool.

Source

thread-pooling.lisp (file)

Generic Function: taskmaster-context OBJECT
Generic Function: (setf taskmaster-context) NEW-VALUE OBJECT
Package

quux-hunchentoot

Methods
Method: taskmaster-context (THREAD-POOLING-TASKMASTER thread-pooling-taskmaster)
Method: (setf taskmaster-context) NEW-VALUE (THREAD-POOLING-TASKMASTER thread-pooling-taskmaster)

A context function, taking a thunk as argument, and calling it within proper context, for workers in the thread pool.

Source

thread-pooling.lisp (file)

Generic Function: taskmaster-dispatcher-channel OBJECT
Generic Function: (setf taskmaster-dispatcher-channel) NEW-VALUE OBJECT
Package

quux-hunchentoot

Methods
Method: taskmaster-dispatcher-channel (THREAD-POOLING-TASKMASTER thread-pooling-taskmaster)

automatically generated reader method

Source

thread-pooling.lisp (file)

Method: (setf taskmaster-dispatcher-channel) NEW-VALUE (THREAD-POOLING-TASKMASTER thread-pooling-taskmaster)

automatically generated writer method

Source

thread-pooling.lisp (file)

Generic Function: taskmaster-dispatcher-process OBJECT
Generic Function: (setf taskmaster-dispatcher-process) NEW-VALUE OBJECT
Package

quux-hunchentoot

Methods
Method: taskmaster-dispatcher-process (THREAD-POOLING-TASKMASTER thread-pooling-taskmaster)
Method: (setf taskmaster-dispatcher-process) NEW-VALUE (THREAD-POOLING-TASKMASTER thread-pooling-taskmaster)

A process that dispatches connections to worker processes for handling, or withholds them when resources are missing.

Source

thread-pooling.lisp (file)

Generic Function: taskmaster-master-lock OBJECT
Package

quux-hunchentoot

Methods
Method: taskmaster-master-lock (THREAD-POOLING-TASKMASTER thread-pooling-taskmaster)

Thread-unsafe operations without a clear owner use this lock

Source

thread-pooling.lisp (file)

Generic Function: taskmaster-pending-connections OBJECT
Generic Function: (setf taskmaster-pending-connections) NEW-VALUE OBJECT
Package

quux-hunchentoot

Methods
Method: taskmaster-pending-connections (THREAD-POOLING-TASKMASTER thread-pooling-taskmaster)
Method: (setf taskmaster-pending-connections) NEW-VALUE (THREAD-POOLING-TASKMASTER thread-pooling-taskmaster)

A list of pending connection socket

Source

thread-pooling.lisp (file)

Generic Function: taskmaster-thread-pool OBJECT
Generic Function: (setf taskmaster-thread-pool) NEW-VALUE OBJECT
Package

quux-hunchentoot

Methods
Method: taskmaster-thread-pool (THREAD-POOLING-TASKMASTER thread-pooling-taskmaster)
Method: (setf taskmaster-thread-pool) NEW-VALUE (THREAD-POOLING-TASKMASTER thread-pooling-taskmaster)

A kernel to which to bind lparallel:*kernel* to handle the thread pool.

Source

thread-pooling.lisp (file)


Previous: , Up: Top   [Contents][Index]

Appendix A Indexes


Next: , Previous: , Up: Indexes   [Contents][Index]

A.1 Concepts

Jump to:   F   L   Q  
Index Entry  Section

F
File, Lisp, quux-hunchentoot.asd: The quux-hunchentoot<dot>asd file
File, Lisp, quux-hunchentoot/pkgdcl.lisp: The quux-hunchentoot/pkgdcl<dot>lisp file
File, Lisp, quux-hunchentoot/thread-pooling.lisp: The quux-hunchentoot/thread-pooling<dot>lisp file

L
Lisp File, quux-hunchentoot.asd: The quux-hunchentoot<dot>asd file
Lisp File, quux-hunchentoot/pkgdcl.lisp: The quux-hunchentoot/pkgdcl<dot>lisp file
Lisp File, quux-hunchentoot/thread-pooling.lisp: The quux-hunchentoot/thread-pooling<dot>lisp file

Q
quux-hunchentoot.asd: The quux-hunchentoot<dot>asd file
quux-hunchentoot/pkgdcl.lisp: The quux-hunchentoot/pkgdcl<dot>lisp file
quux-hunchentoot/thread-pooling.lisp: The quux-hunchentoot/thread-pooling<dot>lisp file

Jump to:   F   L   Q  

Next: , Previous: , Up: Indexes   [Contents][Index]

A.2 Functions

Jump to:   (  
C   D   E   F   G   M   R   T   W  
Index Entry  Section

(
(setf taskmaster-accept-count): Internal generic functions
(setf taskmaster-accept-count): Internal generic functions
(setf taskmaster-bindings): Internal generic functions
(setf taskmaster-bindings): Internal generic functions
(setf taskmaster-context): Internal generic functions
(setf taskmaster-context): Internal generic functions
(setf taskmaster-dispatcher-channel): Internal generic functions
(setf taskmaster-dispatcher-channel): Internal generic functions
(setf taskmaster-dispatcher-process): Internal generic functions
(setf taskmaster-dispatcher-process): Internal generic functions
(setf taskmaster-pending-connections): Internal generic functions
(setf taskmaster-pending-connections): Internal generic functions
(setf taskmaster-thread-pool): Internal generic functions
(setf taskmaster-thread-pool): Internal generic functions

C
call-with-thread-pool: Internal functions
channel-recv: Exported functions
channel-send: Exported functions

D
dispatcher-recv: Internal generic functions
dispatcher-recv: Internal generic functions
dispatcher-send: Internal generic functions
dispatcher-send: Internal generic functions

E
ensure-dispatcher-process: Internal generic functions
ensure-dispatcher-process: Internal generic functions

F
Function, call-with-thread-pool: Internal functions
Function, channel-recv: Exported functions
Function, channel-send: Exported functions
Function, work-on-connection: Internal functions

G
Generic Function, (setf taskmaster-accept-count): Internal generic functions
Generic Function, (setf taskmaster-bindings): Internal generic functions
Generic Function, (setf taskmaster-context): Internal generic functions
Generic Function, (setf taskmaster-dispatcher-channel): Internal generic functions
Generic Function, (setf taskmaster-dispatcher-process): Internal generic functions
Generic Function, (setf taskmaster-pending-connections): Internal generic functions
Generic Function, (setf taskmaster-thread-pool): Internal generic functions
Generic Function, dispatcher-recv: Internal generic functions
Generic Function, dispatcher-send: Internal generic functions
Generic Function, ensure-dispatcher-process: Internal generic functions
Generic Function, run-dispatcher-thread: Internal generic functions
Generic Function, taskmaster-accept-count: Internal generic functions
Generic Function, taskmaster-bindings: Internal generic functions
Generic Function, taskmaster-context: Internal generic functions
Generic Function, taskmaster-dispatcher-channel: Internal generic functions
Generic Function, taskmaster-dispatcher-process: Internal generic functions
Generic Function, taskmaster-master-lock: Internal generic functions
Generic Function, taskmaster-pending-connections: Internal generic functions
Generic Function, taskmaster-thread-pool: Internal generic functions

M
Macro, with-taskmaster-accessors: Internal macros
Macro, with-thread-pool: Internal macros
Method, (setf taskmaster-accept-count): Internal generic functions
Method, (setf taskmaster-bindings): Internal generic functions
Method, (setf taskmaster-context): Internal generic functions
Method, (setf taskmaster-dispatcher-channel): Internal generic functions
Method, (setf taskmaster-dispatcher-process): Internal generic functions
Method, (setf taskmaster-pending-connections): Internal generic functions
Method, (setf taskmaster-thread-pool): Internal generic functions
Method, dispatcher-recv: Internal generic functions
Method, dispatcher-send: Internal generic functions
Method, ensure-dispatcher-process: Internal generic functions
Method, run-dispatcher-thread: Internal generic functions
Method, taskmaster-accept-count: Internal generic functions
Method, taskmaster-bindings: Internal generic functions
Method, taskmaster-context: Internal generic functions
Method, taskmaster-dispatcher-channel: Internal generic functions
Method, taskmaster-dispatcher-process: Internal generic functions
Method, taskmaster-master-lock: Internal generic functions
Method, taskmaster-pending-connections: Internal generic functions
Method, taskmaster-thread-pool: Internal generic functions

R
run-dispatcher-thread: Internal generic functions
run-dispatcher-thread: Internal generic functions

T
taskmaster-accept-count: Internal generic functions
taskmaster-accept-count: Internal generic functions
taskmaster-bindings: Internal generic functions
taskmaster-bindings: Internal generic functions
taskmaster-context: Internal generic functions
taskmaster-context: Internal generic functions
taskmaster-dispatcher-channel: Internal generic functions
taskmaster-dispatcher-channel: Internal generic functions
taskmaster-dispatcher-process: Internal generic functions
taskmaster-dispatcher-process: Internal generic functions
taskmaster-master-lock: Internal generic functions
taskmaster-master-lock: Internal generic functions
taskmaster-pending-connections: Internal generic functions
taskmaster-pending-connections: Internal generic functions
taskmaster-thread-pool: Internal generic functions
taskmaster-thread-pool: Internal generic functions

W
with-taskmaster-accessors: Internal macros
with-thread-pool: Internal macros
work-on-connection: Internal functions

Jump to:   (  
C   D   E   F   G   M   R   T   W  

Next: , Previous: , Up: Indexes   [Contents][Index]

A.3 Variables

Jump to:   A   B   C   D   M   P   S   T  
Index Entry  Section

A
accept-count: Exported classes

B
bindings: Exported classes

C
context: Exported classes

D
dispatcher-channel: Exported classes
dispatcher-process: Exported classes

M
master-lock: Exported classes
max-accept-count: Exported classes
max-thread-count: Exported classes

P
pending-connections: Exported classes

S
Slot, accept-count: Exported classes
Slot, bindings: Exported classes
Slot, context: Exported classes
Slot, dispatcher-channel: Exported classes
Slot, dispatcher-process: Exported classes
Slot, master-lock: Exported classes
Slot, max-accept-count: Exported classes
Slot, max-thread-count: Exported classes
Slot, pending-connections: Exported classes
Slot, thread-count: Exported classes
Slot, thread-pool: Exported classes

T
thread-count: Exported classes
thread-pool: Exported classes

Jump to:   A   B   C   D   M   P   S   T  

Previous: , Up: Indexes   [Contents][Index]

A.4 Data types

Jump to:   C   P   Q   S   T  
Index Entry  Section

C
Class, thread-pooling-taskmaster: Exported classes

P
Package, quux-hunchentoot: The quux-hunchentoot package

Q
quux-hunchentoot: The quux-hunchentoot system
quux-hunchentoot: The quux-hunchentoot package

S
System, quux-hunchentoot: The quux-hunchentoot system

T
thread-pooling-taskmaster: Exported classes

Jump to:   C   P   Q   S   T