You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ignite.apache.org by vkulichenko <va...@gmail.com> on 2016/10/24 21:10:10 UTC

Re: Ignite client thread amount control

Hi Jeff,

Please properly subscribe to the mailing list so that the community can
receive email notifications for your messages. To subscribe, send empty
email to user-subscribe@ignite.apache.org and follow simple instructions in
the reply.


Jeff Jiao wrote
> Every time when I start a Ignite client (using default settings), it
> generates about 60 threads.
> 
> My use case is:
> My service has an Ignite cache component which allows users to query from
> it.
> I write a IgniteQueryPool, this pool will initialize 5~10 ignite clients, 
> If user use my IgniteQueryPool, it will cause their client side thread
> amount become very large(add 300-600)
> Is there a way to control Ignite client thread amount?

Ignite instance is thread-safe and can be reused by all threads within a
single JVM. So there is no need to create a pool of clients in your
application. Just start one client and use it everywhere.

-Val



--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Ignite-client-thread-amount-control-tp8434p8446.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Re: Ignite client thread amount control

Posted by Vladislav Pyatkov <vl...@gmail.com>.
Not, it is not. One instance of Ignite client can to support several
parallel queries.
You can use client like this:

*Ignition.setClientMode(true);*
*Ignite ignite = Ignitin.strt(cfg)*
*threads[i] = new Thread() {*
*    @Override public void run() {*
* try (QueryCursor cursor = ignite.cache(name).query(new
SqlFieldsQuery(sql))) {*
* for (Object obj : cursor) {*
* // Ops.*
* }*
* }*
*    }*
*};*

*for (Thread thread : threads)*
* thread.join();*

On Tue, Oct 25, 2016 at 6:12 AM, Jeff Jiao <je...@gmail.com> wrote:

> Hi vkulichenko,
>
> Thanks for the reply! I already subscribed.
>
> What if I have multiple users query at the same time? One user hold the
> Ignite client and the others just wait?
>
>
>
> --
> View this message in context: http://apache-ignite-users.
> 70518.x6.nabble.com/Ignite-client-thread-amount-control-tp8434p8455.html
> Sent from the Apache Ignite Users mailing list archive at Nabble.com.
>



-- 
Vladislav Pyatkov

Re: Ignite client thread amount control

Posted by Jeff Jiao <je...@gmail.com>.
Hi vkulichenko,

Thanks for the reply! I already subscribed.

What if I have multiple users query at the same time? One user hold the
Ignite client and the others just wait?



--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Ignite-client-thread-amount-control-tp8434p8455.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.