users@grizzly.java.net

Re: How can my application benefit from non-blocking http server like Grizzly?

From: Ken--_at_newsgroupstats.hk <dragonken_at_gmail.com>
Date: Tue, 23 Sep 2008 11:05:12 -0700 (PDT)

Thanks for your quick response.

I thought comet is something like ajax. I will firstly try your gmail
example.

Regards,
Ken



Jeanfrancois Arcand-2 wrote:
>
> Salut,
>
> Ken--_at_newsgroupstats.hk wrote:
>> In real situation, a thread for serving web request may be blocked (or
>> time-waiting?) by something like waiting db enquiry result or waiting
>> remote
>> process to response (like rmi?). In non-blocking http server like
>> Grizzly,
>> will the blocked thread be availabled for other web request(s)?
>
> By default, the thread will be blocked. But we have a Grizzly extension
> called Grizzly Asynchronous Request Processing[1] that exactly allow you
> to do what want, e.g. free threads from blocking on resources. I've gave
> an example in [2], and our Comet[4] support is based on top of Grizzly
> ARP. I suspect Comet is what you need to look at (Read [4] first IMO)
>
>
>>
>> The stress test result (pages / second) for the following JSP in
>> Glassfish
>> V2 is the same as Tomcat
>> <!--test_sleep.jsp-->
>> <%Thread.sleep(100L);%>
>> <!--end test_sleep.jsp-->
>>
>> How about this one?
>> <!--test_block.jsp-->
>> <%
>> ArrayBlockingQueue<Result> arrayBlockingQueue = new
>> ArrayBlockingQueue(1);
>>
>> //ask for result, the result will be stored in the queue by another
>> thread
>> RemoteProcess.askForResult(arrayBlockingQueue);
>>
>> Result result = null;
>> try {
>> // waiting result for 10 seconds, the thread for running this request
>> will
>> be blocked up to 10 seconds
>> result = arrayBlockingQueue.poll(10, TimeUnit.SECOND);
>> } catch (Exception e) {
>> }
>> if (result == null) System.out.println("Time out...");
>> %>
>> <!--end test_block.jsp-->
>>
>> How to write my web application so that I can fully make use your thread
>> pool?
>
> Yes that's clear. Take a look at the AsyncFilter interface[3] or you
> might want to uses Comet directly[4] (based on you example above, I
> Strongly recommend you take a look at Comet). Just take a quick look and
> let me know if that help or if you need more information.
>
>
> Hope you understand my question.
>
> Pretty clear.
>
> Thanks!
>
> --Jeanfrancois
>
> [1]http://weblogs.java.net/blog/jfarcand/archive/2006/02/grizzly_part_ii.html
> [2]http://weblogs.java.net/blog/jfarcand/archive/2008/07/extending_the_g.html
> [3]https://grizzly.dev.java.net/nonav/apidocs/com/sun/grizzly/arp/AsyncFilter.html
> [4]
> http://weblogs.java.net/blog/jfarcand/archive/2006/07/the_grizzly_com.html
>
>
>>
>> Regards,
>> Ken
>>
>>
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_grizzly.dev.java.net
> For additional commands, e-mail: users-help_at_grizzly.dev.java.net
>
>
>

-- 
View this message in context: http://www.nabble.com/How-can-my-application-benefit-from-non-blocking-http-server-like-Grizzly--tp19631411p19633558.html
Sent from the Grizzly - Users mailing list archive at Nabble.com.