Alex Treyger wrote:
In my environment, it takes time and IO for a command
to be processed.
This is why I would like to use multiple threads to
run different commands from the same source
simultaneously. For this reason, I need commands to be
pulled from a Source one in a time.
To achieve this, I would like to register multiple
instances of a Pipeline (all using the same Source
object) with one AbstractThreadManager.
First thing:
You don't work with an **AbstractThreadManager**, you
work with a concrete implementation.
Second thing:
What is your Thread per CPU ratio?
The TPCThreadManager will collect all the Commands and
execute them one at a time using the threads from a pool.
If you have 8 threads per CPU, that means you will have
eight commands being processed (per CPU) at once. That
is by design.
I have two problems in a AbstractThreadManager as it
is now:
1. PipelineRunner.run()
pulls all commands in one call:
handler.handleEvents( sources[ i ].dequeueAll() );
Take a look at how CommandManager works with them.
I would prefer to be able to use a Runner that pulls
only one command in a time. This would allow another
threads to pull and process another command from the
same source at the same time. Of course, it makes
sense only in a case when it takes time to process
command, and only if such commands wait for IO.
You do not have to start with AbstractThreadManager.
Someone else made the Abstract class from my concrete
one.
2. register() uses PipelineRunner (which pulls all
commands from Source in one call), and there is no
easy way to use another Runner instead; a different
Runner is needed for the reason #1.
Sure. Use another base class. I do get your point
though. We need to be able to use both approaches.
Runner interface, that I introduced, has two
additional methods:
Object getType();
so that all pipelines that use the same Source, can be
deregistered in one call by type.
Honestly, I don't like that. We don't operate by type,
but by pipeline.
boolean isAvailable();
Using this call in AbstractThreadManager may prevent
running the same runner on multiple threads (i.e.
using more then one thread for the same Runner in case
when it runs for a long-long time):
<snip/>
You don't need to run the same runner on multiple threads.
You need to run the Commands in multiple threads. That is
*already done*.
--
"They that give up essential liberty to obtain a little temporary safety
deserve neither liberty nor safety."
- Benjamin Franklin
--
To unsubscribe, e-mail: <mailto:avalon-dev-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail: <mailto:avalon-dev-help@;jakarta.apache.org>