Table of Contents Previous Next
Logo
Glacier2 : 43.8 Request Buffering
Copyright © 2003-2007 ZeroC, Inc.

43.8 Request Buffering

A Glacier2 router can forward requests in buffered or unbuffered mode. In addition, the buffering mode can be set independently for each direction (client-to-server and server-to-client).
The configuration properties Glacier2.Client.Buffered and Glacier2.Server.Buffered govern the buffering behavior. The former affects buffering of requests from clients to servers, and the latter affects buffering of requests from servers to clients. If a property is not specified, the default value is 1, which enables buffering. A property value of 0 selects the unbuffered mode.

43.8.1 Unbuffered Mode

In unbuffered mode, the router forwards an incoming request in the same thread that received the request. This mode uses fewer resources than buffered mode, but it also has some limitations:
• Nested twoway requests are not supported.
• Twoway requests are serialized. After forwarding a twoway request to a server, the router cannot forward any more requests from that client until the server has responded to the first request. The same is true for twoway requests from servers to clients.
• It is susceptible to denial-of-service attacks by hostile clients when used for requests from servers to clients (i.e., only when the property Glacier2.Server.Buffered is set to zero). For example, a client that receives a callback from a server and blocks indefinitely inside the callback can disable communications for all other clients.
However, for some applications, the lower resource requirements of the unbuffered mode are attractive enough to warrant a careful application design that addresses this mode’s limitations.

43.8.2 Buffered Mode

In buffered mode, the router queues incoming requests and creates an extra thread (or two1) dedicated to processing the request queue of each connected client. While buffered mode consumes more resources than unbuffered mode, it does not suffer the limitations of unbuffered mode described in Section 43.8.1. Furthermore, buffered mode offers some additional functionality not available in unbuffered mode, such as the ability to batch requests (see Section 43.9.3).
The configuration properties Glacier2.Client.SleepTime and Glacier2.Server.SleepTime can be used to ensure that a single client or server, respectively, does not flood the router with requests. A non-zero value causes the router’s thread dedicated to a connection to sleep for the specified number of milliseconds after it has sent all of the pending requests. Incoming requests are queued while the connection’s thread is asleep.
If a property is not defined, or its value is zero, then the router’s thread does not sleep after sending queued requests.

1
The router creates a thread if Glacier2.Client.Buffered=1, and another thread if Glacier2.Server.Buffered=1.

Table of Contents Previous Next
Logo