users@grizzly.java.net

HTTP server with server-side push

From: Evgeny Shepelyuk <eshepelyuk_at_gmail.com>
Date: Wed, 05 Aug 2009 18:42:59 +0300

Hello,

I have questions regarding implementation of my project.
Recently i decided to use Grizzly as a base for my HTTP server.
But after quite long looking into docs I can't understand how i can
resolve my problem.

Let me describe my project requrements.


The idea is to buld application that serves media to relative big number
clients (more >500).
The specific features of clients' request are HTTP long-living nature.
So once connected client permanently fetches content from server.
Because simultaneous number of clients is high the blocking
thread-per-request model is not appropriate.

Our current approach consist of following steps and based on SRP.
It's working OK but can't hold many connections.

1. client connects to endpoint, it has access to client's output stream
2. endpoint has blocking queue inside it and registers that queue in media
manager
to be notified about media events that should be streamed to underlying
client.
3. HTTP connection should not break and be permanent -> client should
never disconnect after it got connected to server.
4. inside endpoint in a loop look i'm performing blocking get from
blocking queue to receive event from media manager
that should be written to client's stream.

So i've downloaded Grizzly 2.0.0-M3 and trying to write my NIO project.
I was able to build simple HTTP server using GrizzlyWebServer class, and
creating simple GrizzlyAdapter to server dummu content.
But i'm unable to figure out how to build asynchronous HTTP write.

Should i somehow use package com.sun.grizzly.asyncqueue ?
Or maybe comet extension but comet is not available for 2.0.0-M3
Or my task can be impleneted by leveraging AsyncFilter but i can't
understand from tutorials how to implement pereodical asynchronous write
to client
without blocking thread.

Can anyone give me advice on solving my problem.


-- 
Regards,
Evgeny Shepelyuk