dev@grizzly.java.net

Re: still some help for grizzlywebserver

From: gustav trede <gustav.trede_at_gmail.com>
Date: Tue, 6 Jan 2009 17:52:51 +0100

salut,

ThreadPoolExecutor constructor had good docs.

example:

8 core threads. allways alive.
max 64 where the extra 56 has 60 sec idle life timer.
using blockingqueue with limit of 100, and lock fairness is configured to
non fair for optimal concurrency, but that removes FIFO .

ExecutorService threadPool = new ThreadPoolExecutor(
                8,
                64,
                60L,
                TimeUnit.SECONDS,
                new ArrayBlockingQueue<Runnable>(100,false));


2009/1/6 rama <rama.rama_at_tiscali.it>

>
> Il giorno 06/gen/09, alle ore 17:35, Jeanfrancois Arcand ha scritto:
>
> rama wrote:
>
>
> thank you for filling out an issue.
>
> I've fixed the problem with threads.
>
> I have check the fix, but, in this way if you specify the max thread (N)
> grizzly http will start with (N) threads.
>
> So actually isn't a maximum, is a set :)
>
> Also, this doesn't convince me too much, at least in my scenario.
>
> Normally when a user do a request to grizzly, it will take few ms to be
> calculated and dispatched.
>
> Sometimes, when a user require a transaction list, request will take a lot
> more (due to db query, data aggregation, xml parsing) and, obviusly, the
> thread
>
> that handle this request is busy.
>
> For that reason, sometimes, i need more threads to serve user request, and
> i am forced to start grizzly http with 50 threads.
>
> What i am meaning, if that i can specify min / max threads, normally i will
> user 5 threads (more than enough for normal operation) but when someone
>
> ask for a transaction list (or other slow request) if i run out of the min
> threads, new threads are spawned. After a while, if threads aren't used,
> they just will be killed.
>
>
> What you need here is a cached thread pool. Why not configuring one that
> ship with the JDK?
>
>
> could you please elaborate a bit more?
> i am not familiar with thread pool, so if possible, i need something to
> read :)
>
>
>


-- 
your servant
 gustav trede
coding is art - not only something that  bring food on the table,
everybody should be able to feel proud about their code,
that they have performed their best considering the given conditions.