You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ignite.apache.org by Shane Duan <sd...@gmail.com> on 2019/06/21 01:03:58 UTC

Connection pool for Java thin client?

Hi Igniters,

I have a multithread application in which I plan to use the Ignite Java
thin client. Is it safe to share the client between threads? Or should each
thread create its own client connection? Is there a connection pool kind of
implementation for the Java thin client , like the one for JDBC? In the
context, multiple threads will try put/get cached values concurrently.

Thanks!

Shane

Re: Connection pool for Java thin client?

Posted by Shane Duan <sd...@gmail.com>.
Thanks, @Alex @Igor .

On Fri, Jun 21, 2019 at 2:30 AM Igor Sapego <is...@apache.org> wrote:

> Alex, this is great! I'll take a look.
>
> Best Regards,
> Igor
>
>
> On Fri, Jun 21, 2019 at 10:35 AM Alex Plehanov <pl...@gmail.com>
> wrote:
>
> > Hello Shane,
> >
> > It's safe to share one java thin client between threads.
> > The client in current implementation uses an exclusive lock on the
> > connection while sending request and processing response. But in a high
> > loaded application, using one client will give smaller throughput than
> > using a connection pool (there are no benefits of using multiple
> threads).
> >
> > There is no out of the box implementation of thin client connection pool
> in
> > Ignite, you should implement it yourself if you need it.
> >
> > Also, I've prepared PR [1] to support async request sending from the thin
> > client side. Thin client connection still thread safe, but process
> requests
> > and responses independently, so a request can be sent while other threads
> > still waiting for a response from server side. It will be great if
> someone
> > reviews this fix.
> >
> > [1] https://issues.apache.org/jira/browse/IGNITE-11685
> >
> >
> > пт, 21 июн. 2019 г. в 04:04, Shane Duan <sd...@gmail.com>:
> >
> > > Hi Igniters,
> > >
> > > I have a multithread application in which I plan to use the Ignite Java
> > > thin client. Is it safe to share the client between threads? Or should
> > each
> > > thread create its own client connection? Is there a connection pool
> kind
> > of
> > > implementation for the Java thin client , like the one for JDBC? In the
> > > context, multiple threads will try put/get cached values concurrently.
> > >
> > > Thanks!
> > >
> > > Shane
> > >
> >
>

Re: Connection pool for Java thin client?

Posted by Igor Sapego <is...@apache.org>.
Alex, this is great! I'll take a look.

Best Regards,
Igor


On Fri, Jun 21, 2019 at 10:35 AM Alex Plehanov <pl...@gmail.com>
wrote:

> Hello Shane,
>
> It's safe to share one java thin client between threads.
> The client in current implementation uses an exclusive lock on the
> connection while sending request and processing response. But in a high
> loaded application, using one client will give smaller throughput than
> using a connection pool (there are no benefits of using multiple threads).
>
> There is no out of the box implementation of thin client connection pool in
> Ignite, you should implement it yourself if you need it.
>
> Also, I've prepared PR [1] to support async request sending from the thin
> client side. Thin client connection still thread safe, but process requests
> and responses independently, so a request can be sent while other threads
> still waiting for a response from server side. It will be great if someone
> reviews this fix.
>
> [1] https://issues.apache.org/jira/browse/IGNITE-11685
>
>
> пт, 21 июн. 2019 г. в 04:04, Shane Duan <sd...@gmail.com>:
>
> > Hi Igniters,
> >
> > I have a multithread application in which I plan to use the Ignite Java
> > thin client. Is it safe to share the client between threads? Or should
> each
> > thread create its own client connection? Is there a connection pool kind
> of
> > implementation for the Java thin client , like the one for JDBC? In the
> > context, multiple threads will try put/get cached values concurrently.
> >
> > Thanks!
> >
> > Shane
> >
>

Re: Connection pool for Java thin client?

Posted by Alex Plehanov <pl...@gmail.com>.
Hello Shane,

It's safe to share one java thin client between threads.
The client in current implementation uses an exclusive lock on the
connection while sending request and processing response. But in a high
loaded application, using one client will give smaller throughput than
using a connection pool (there are no benefits of using multiple threads).

There is no out of the box implementation of thin client connection pool in
Ignite, you should implement it yourself if you need it.

Also, I've prepared PR [1] to support async request sending from the thin
client side. Thin client connection still thread safe, but process requests
and responses independently, so a request can be sent while other threads
still waiting for a response from server side. It will be great if someone
reviews this fix.

[1] https://issues.apache.org/jira/browse/IGNITE-11685


пт, 21 июн. 2019 г. в 04:04, Shane Duan <sd...@gmail.com>:

> Hi Igniters,
>
> I have a multithread application in which I plan to use the Ignite Java
> thin client. Is it safe to share the client between threads? Or should each
> thread create its own client connection? Is there a connection pool kind of
> implementation for the Java thin client , like the one for JDBC? In the
> context, multiple threads will try put/get cached values concurrently.
>
> Thanks!
>
> Shane
>