Grizzly is an HTTP Listener using Java's NIO technology and implemented entirely in Java. This re-usable, NIO–based framework can be used for any HTTP related operations (HTTP Listener/Connector) as well as non-HTTP operations, thus allowing the creation of any type of scalable multi-threaded server. The Grizzly HTTP Listener uses a keep-alive system based on the NIO Selector classes of the Java platform, which support connection monitoring and help prevent Denial-of-Service attacks. The Denial–of–Service systems will add basic support for IP validation, number of transactions completed per IP, detection of inactive connections, etc. in order to predict resource exhaustion or "flooding" attacks. All these services are performed in conjunction with the Keep-Alive systems. The Grizzly connector will forward requests for both static and dynamic resources to the servlet container, which processes requests for static resources via a dedicated, container-provided servlet (org.apache.catalina.servlets.DefaultServlet).
For more information about Grizzly, you can read the weblog at http://weblogs.java.net/blog/jfarcand/archive/2005/06/grizzly_an_http.html
Grizzly is available as a replacement to NSAPI/WebCore in Application Server Enterprise Edition8.2. Application Server provides some special properties to support the configuration of Grizzly. To enable Grizzly, add the following property:
Dcom.sun.enterprise.web.httpservice.ee=false.
Currently, the implementation of Grizzly supports all the Application Server Enterprise Edition functionality, except dynamic configuration.
The following properties control the Grizzly configuration:
-Dcom.sun.enterprise.web.connector.grizzly.keepAliveTimeoutInSeconds=30
-Dcom.sun.enterprise.web.connector.grizzly.maxHttpHeaderSize=4096
-Dcom.sun.enterprise.web.connector.grizzly.ssBackLog=4096
-Dcom.sun.enterprise.web.connector.grizzly.queueSizeInBytes=-1
-Dcom.sun.enterprise.web.connector.grizzly.maxKeepAliveRequests=250
-Dcom.sun.enterprise.web.connector.grizzly.fileCache.isEnabled=false
-Dcom.sun.enterprise.web.connector.grizzly.fileCache.maxEntrySize=1024
-Dcom.sun.enterprise.web.connector.grizzly.fileCache.maxLargeFileCacheSize= 10485760
Like all Sun Java System Application Server 8.2 configurations, Grizzly also performs better when the Asynch Startup mechanism is disabled. You can disable it using this property: -Dcom.sun.enterprise.server.ss.ASQuickStartup=false
The following table brings out the corresponding properties of Grizzly and the production web container (PWC).
Table 3–3 Correspondence of Grizzly and PWC Properties
Property Name in Grizzly |
Default Value |
Description |
Corresponding setting in a production web container |
---|---|---|---|
maxAcceptWorkerThread |
0 |
Number of threads used to serve OP_ACCEPT (socket.accept()). |
acceptor threads in http listener |
selector.timeout |
60000 |
Time in milliseconds before Selector.select() times out. |
request processing timeout |
minWorkerThreads |
5 |
The minimum number of threads every thread pool uses at creation. |
request processing initial thread count |
fileCache.isEnabled |
false |
Indicates if file caching is enabled. |
file cache enabled |
fileCache.minEntrySize |
Minimum size that a small file can have. |
small file size limit |
|
fileCache.maxEntrySize |
1024 |
Maximum size that a medium file can have. |
medium file size limit |
fileCache.maxLargeFileCacheSize |
10485760 |
Cache space for medium files. |
medium file size |
fileCache.maxSmallFileCacheSize |
Cache space for small files. |
small file size |
|
fileCache.maxCacheEntries |
Maximum number of cached entries. |
max files count |
|
keepAliveTimeoutInSeconds |
30 |
keep alive timeout |
|
maxKeepAliveRequests |
250 |
keep alive max connections |
|
InitialRuleCount |
128 |
The initial number of KeepAliveRule created by the Keep-Alive subsystem. | |
useNioNonBlocking |
true |
Indicates whether to use NIO blocking mode or not. | |
displayConfiguration |
false |
Display Grizzly internal configuration. | |
useDirectByteBuffer |
true |
Indicates if ByteBuffer.allocateDirect() is used when creating Grizzly buffers. | |
pipelineClass |
com.sun.enterprise.web.connector.grizzly.LinkedListPipeline |
The default Pipeline (Thread Pool wrapper) used by Grizzly. | |
maxSelectorReadThread |
1 |
The number of selector threads for handing OP_READ operations. | |
useByteBufferView |
false |
Specifies whether to use a large ByteBuffer and slice it amongst Grizzly buffers. | |
algorithmClassName |
com.sun.enterprise.web.connector.grizzly.algorithms.NoParsingAlgorithm |
The request bytes parsing algorithm used to read bytes from ByteBuffer. | |
buffersize |
4096 |
ByteBuffer size created by Grizzly. | |
factoryTimeout |
30 |
Time taken before a read/write operation fails on a socket. | |
maxReadWorkerThread |
0 |
Number of threads used to read the request bytes from the socket. |