Request Schedulers

Request Schedulers

Request Schedulers

Defining Schedulers

Enfold Proxy can filter incoming connections and use different schedulers. In order to make use of this functionality, first, you must define a scheduler in the eep.ini file:

[scheduler sched1]
vh_host = localhost:8080 localhost:8081
scheduler = leastconns
rules = HEADER1|regexp1

The various options alter the scheduler's configuration as follows:

Defines which back-ends to schedule to respond to incoming requests. For a typical Plone setup, these back-ends correspond to ZEO clients.

Defines your scheduling algorithm of choice. The different algorithm options are:

Route each request to the back-end (from the pool of back-ends enumerated in the vh_host section) with the least number of connections.
Route the first request to the first back-end (enumerated in the vh_host section). Route the second request to the second back-end, route the third request to the third back-end, etc., then cycle back to the first back-end.
Route each request to a random back-end (enumerated in the vh_host section).

Defines a list of filtering rules. Enfold Proxy uses the specified scheduler only if all of the rules are matched. The Python code corresponding to this logic is as follows:

regexp1.match(environ[HEADER1]) and regexp2.match(environ[HEADER2]

HEADER1 and HEADER2 are keys in the environment dictionary logged to the proxy.log file at the debug log level.

Associating Schedulers with Hosts

Now that you've defined one or more schedulers (per the previous section of this document), you can define which schedulers to use for a particular host in the eep.ini file like so:

[host website]
vh_host = localhost:8080 localhost:8081
schedulers = sched1 sched2

In this example, you must have previously defined schedulers sched1 and sched2 (per the previous section of this document).

If Enfold Proxy's log level is set to debug, it will log the request environment as well as additional scheduling information to the proxy.log file:

SCHEDULER 'sched1' DOES NOT MATCH on criteria 'REMOTE_ADDR|' for '/content.html'


SCHEDULER 'sched1' MATCH on criteria 'REMOTE_ADDR|' for '/news.html'


Here's an example configuration that uses ZEO clients localhost:8081 and localhost:8082 for requests originating from our local network 192.168.1.xx, and ZEO clients localhost:8083 for GoogleBot:

[scheduler local]
vh_host = localhost:8081 localhost:8082
scheduler = leastconns
rules = REMOTE_ADDR|^192.168.1.

[scheduler googlebot]
vh_host = localhost:8083
scheduler = leastconns
rules = HTTP_USER_AGENT|Googlebot

[host site]
schedulers = local googlebot