You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@mina.apache.org by Mike van Goor <mi...@probie.nl> on 2012/01/10 21:31:06 UTC

usage of ioprocessor

Hi list,

Trying to figure something out here and I know it's my first post so 
please bare with me.

Excuse me if my question sounds noobish, but I have been unable to find 
anything relating to my question, so here goes.

I am currently writing a program that spontaniously creates multiple 
sockets for outgoing as well as incoming connections. In the 
implementation for NioProcessor I see the option to set a specific 
ioProcessor. I would like my program to just use 1 ioProcessor at all times.
In this scenario do I have to create my own ioProcessor and feed that to 
the creation of a NioSocket or does mina do this for me?

Any explanations on this subject would be very much appreciated.
Any examples to make it more clear would be welcome too.

Thanks in advance!

Kind regards,
Mike

Re: usage of ioprocessor

Posted by Emmanuel Lecharny <el...@gmail.com>.
On 1/11/12 11:10 AM, Mike van Goor wrote:
> On 11-1-2012 10:42, Emmanuel Lecharny wrote:
>> On 1/11/12 10:11 AM, Mike van Goor wrote:
>>> On 11-1-2012 0:03, Emmanuel Lecharny wrote:
>>>> On 1/10/12 9:31 PM, Mike van Goor wrote:
>>>>> Hi list,
>>>>>
>>>>> Trying to figure something out here and I know it's my first post so
>>>>> please bare with me.
>>>>>
>>>>> Excuse me if my question sounds noobish, but I have been unable to
>>>>> find anything relating to my question, so here goes.
>>>>>
>>>>> I am currently writing a program that spontaniously creates multiple
>>>>> sockets for outgoing as well as incoming connections. In the
>>>>> implementation for NioProcessor I see the option to set a specific
>>>>> ioProcessor. I would like my program to just use 1 ioProcessor at all
>>>>> times.
>>>> Why would you do that ?
>>>>
>>>>> In this scenario do I have to create my own ioProcessor and feed that
>>>>> to the creation of a NioSocket or does mina do this for me?
>>>> You can specify the number of IoProcessor to use, and set it to 1 if
>>>> needed. But again, why would you do that ?
>>>>
>>> Hi Emmanuel,
>>>
>>> Firstly thanks for responding.
>>> I am looking for a way to only use 1 selector in my setup.
>>> The reason is that I would like as less threads as possible.
>> Ok. When you create your Connector/Acceptor, you just have to pass as a
>> parameter the number of IoProcessor you ant to use. Juts pass 1 :
>>
>> SocketAcceptor acceptor = new NioSocketAcceptor( 1 );
>>
>> Just curious : any reason to limit the number of threads to the 
>> minimum ?
>> Also which version of MINA/JVM/OS are you using ?
>>
>
> I am writing a home automation server in java and want it to run on 
> single core 500Mhz system with very low processing power.
Ok. But keep in mind that a thread is not costing a lot of CPU, plus 
using one more thread in this case can improve the throughput, as it's 
likely that some threads will be sleeping waiting for events, while 
other may work.

Anyway, it's up to you :)
>
> mina-core-2.0.4.jar
> java version "1.6.0_21"
> Debian linux atm.
Thanks !


-- 
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com


Re: usage of ioprocessor

Posted by Mike van Goor <mi...@probie.nl>.
On 11-1-2012 10:42, Emmanuel Lecharny wrote:
> On 1/11/12 10:11 AM, Mike van Goor wrote:
>> On 11-1-2012 0:03, Emmanuel Lecharny wrote:
>>> On 1/10/12 9:31 PM, Mike van Goor wrote:
>>>> Hi list,
>>>>
>>>> Trying to figure something out here and I know it's my first post so
>>>> please bare with me.
>>>>
>>>> Excuse me if my question sounds noobish, but I have been unable to
>>>> find anything relating to my question, so here goes.
>>>>
>>>> I am currently writing a program that spontaniously creates multiple
>>>> sockets for outgoing as well as incoming connections. In the
>>>> implementation for NioProcessor I see the option to set a specific
>>>> ioProcessor. I would like my program to just use 1 ioProcessor at all
>>>> times.
>>> Why would you do that ?
>>>
>>>> In this scenario do I have to create my own ioProcessor and feed that
>>>> to the creation of a NioSocket or does mina do this for me?
>>> You can specify the number of IoProcessor to use, and set it to 1 if
>>> needed. But again, why would you do that ?
>>>
>> Hi Emmanuel,
>>
>> Firstly thanks for responding.
>> I am looking for a way to only use 1 selector in my setup.
>> The reason is that I would like as less threads as possible.
> Ok. When you create your Connector/Acceptor, you just have to pass as a
> parameter the number of IoProcessor you ant to use. Juts pass 1 :
>
> SocketAcceptor acceptor = new NioSocketAcceptor( 1 );
>
> Just curious : any reason to limit the number of threads to the minimum ?
> Also which version of MINA/JVM/OS are you using ?
>

I am writing a home automation server in java and want it to run on 
single core 500Mhz system with very low processing power.

mina-core-2.0.4.jar
java version "1.6.0_21"
Debian linux atm.

Regards,
Mike

Re: usage of ioprocessor

Posted by Emmanuel Lecharny <el...@gmail.com>.
On 1/11/12 10:11 AM, Mike van Goor wrote:
> On 11-1-2012 0:03, Emmanuel Lecharny wrote:
>> On 1/10/12 9:31 PM, Mike van Goor wrote:
>>> Hi list,
>>>
>>> Trying to figure something out here and I know it's my first post so
>>> please bare with me.
>>>
>>> Excuse me if my question sounds noobish, but I have been unable to
>>> find anything relating to my question, so here goes.
>>>
>>> I am currently writing a program that spontaniously creates multiple
>>> sockets for outgoing as well as incoming connections. In the
>>> implementation for NioProcessor I see the option to set a specific
>>> ioProcessor. I would like my program to just use 1 ioProcessor at all
>>> times.
>> Why would you do that ?
>>
>>> In this scenario do I have to create my own ioProcessor and feed that
>>> to the creation of a NioSocket or does mina do this for me?
>> You can specify the number of IoProcessor to use, and set it to 1 if
>> needed. But again, why would you do that ?
>>
> Hi Emmanuel,
>
> Firstly thanks for responding.
> I am looking for a way to only use 1 selector in my setup.
> The reason is that I would like as less threads as possible.
Ok. When you create your Connector/Acceptor, you just have to pass as a 
parameter the number of IoProcessor you ant to use. Juts pass 1 :

         SocketAcceptor acceptor = new NioSocketAcceptor( 1 );

Just curious : any reason to limit the number of threads to the minimum ?
Also which version of MINA/JVM/OS are you using ?

-- 
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com


Re: usage of ioprocessor

Posted by Mike van Goor <mi...@probie.nl>.
On 11-1-2012 0:03, Emmanuel Lecharny wrote:
> On 1/10/12 9:31 PM, Mike van Goor wrote:
>> Hi list,
>>
>> Trying to figure something out here and I know it's my first post so
>> please bare with me.
>>
>> Excuse me if my question sounds noobish, but I have been unable to
>> find anything relating to my question, so here goes.
>>
>> I am currently writing a program that spontaniously creates multiple
>> sockets for outgoing as well as incoming connections. In the
>> implementation for NioProcessor I see the option to set a specific
>> ioProcessor. I would like my program to just use 1 ioProcessor at all
>> times.
> Why would you do that ?
>
>> In this scenario do I have to create my own ioProcessor and feed that
>> to the creation of a NioSocket or does mina do this for me?
> You can specify the number of IoProcessor to use, and set it to 1 if
> needed. But again, why would you do that ?
>
Hi Emmanuel,

Firstly thanks for responding.
I am looking for a way to only use 1 selector in my setup.
The reason is that I would like as less threads as possible.

If there is a better way to achieve this then I am all ears.

Kind regards,
Mike

Re: usage of ioprocessor

Posted by Emmanuel Lecharny <el...@gmail.com>.
On 1/10/12 9:31 PM, Mike van Goor wrote:
> Hi list,
>
> Trying to figure something out here and I know it's my first post so 
> please bare with me.
>
> Excuse me if my question sounds noobish, but I have been unable to 
> find anything relating to my question, so here goes.
>
> I am currently writing a program that spontaniously creates multiple 
> sockets for outgoing as well as incoming connections. In the 
> implementation for NioProcessor I see the option to set a specific 
> ioProcessor. I would like my program to just use 1 ioProcessor at all 
> times.
Why would you do that ?

> In this scenario do I have to create my own ioProcessor and feed that 
> to the creation of a NioSocket or does mina do this for me?
You can specify the number of IoProcessor to use, and set it to 1 if 
needed. But again, why would you do that ?

-- 
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com