Writing scalable server applications in the Java™ programming language has always been difficult. Before the advent of the Java New I/O API (NIO), thread management issues made it impossible for a server to scale to thousands of users. The Grizzly NIO framework has been designed to help developers to take advantage of the Java™ NIO API. Grizzly’s goal is to help developers to build scalable and robust servers using NIO as well as offering extended framework components: Web Framework (HTTP/S), WebSocket, Comet, and more!
Core Framework
Memory Management
I/O Strategies
Transports and Connections
FilterChain and Filters
Core Configuration
Port Unification
Monitoring
Best Practices
Quick Start
Samples
HTTP Components
Core HTTP Framework
HTTP Server Framework
HTTP Server Framework Extras
Comet
JAXWS
WebSockets
AJP
MAIN
core framework
Memory management : Grizzly 2.0 introduces a subsystem that improves memory management at runtime. The subsystem consists of three main components:
Buffers
ThreadLocal memory pools (ThreadLocal memory pools)
MemoryManager as a utility buffer and memory pool factory
I/O strategy: Usually we use the following two ways to handle specific NIO events: directly handle it in the received thread (Same-thread) or hand it over to the worker thread (Worker-thread).
Worker-thread IOStrategy
Same-thread IOStrategy
Dynamic IOStrategy
Leader-follower IOStrategy
Transport and Connection: Transport and Connection are the core network APIs of Grizzly 2.3.
Transport defines network transmission methods such as TCP and UDP, including related resources (thread pools, memory managers, etc.) and the default configuration of nested connections.
Connection in Grizzly 2.3 represents a single TCP or UDP network connection (much like socket).
Transport and Connection are one-to-many relationships.
Filter chains and filters : A filter chain, as the name suggests, is a chain of multiple filters. Each filter represents a processing unit to be executed to inspect and/or modify the state of a transaction represented by the FilterChainContext.
Core configuration: The main point of the core framework configuration is the Transport instance and its associated thread pool.
Unified port: Sometimes due to some management restrictions, we can only use one port to publish multiple services, and redirect to the corresponding service according to the request. "Port Unification" in Grizzly is the solution to this problem.
Monitoring: Grizzly provides the function of monitoring key components inside the framework, and allows monitoring components to be extended by custom.
HTTP components
Core HTTP framework: Grizzly 2.3 HTTP framework provides the function of encoding and decoding HTTP request and response data for server and client. In addition to the codecs themselves, the framework includes basic HTTP primitives and utility classes that simplify protocol-related work.
HTTP server framework
Simple server API makes Grizzly easy to embed in applications.
An abstraction similar to the Servlet specification : HttpHandler (Servlet), Request (HttpServletRequest), Response (HttpServletResponse).
Provides the ability to handle long-running HTTP transactions through a responsive suspend/resume mechanism.
Supports non-blocking IO streams.
Use file caching for static content.
HTTP Server Framework Extension
Comet
JAXWS: Since version 2.1.2 Grizzly supports JAX-WS web services through the HTTP server framework.
WebSockets: Grizzly implements the requirements of RFC 6455, while also supporting older versions of this protocol. This is useful for clients that do not implement the final draft specification.
AJP: Grizzly supports AJP 1.3 since version 2.1.
SPDY: Grizzly supports SPDY/3 since version 2.3. The goal of SPDY is to reduce page load times.