connection pool in hazelcast

1,366 views
Skip to first unread message

M.Ahsen Taqi Kazmi

unread,
Aug 12, 2015, 8:21:15 AM8/12/15
to Hazelcast
hi
 i am new to hazelcast and i wanted to ask that what happen to the connection object that we got from the connection pool after the use?
does it go back to the pool or hazelcast destroys it and creates a new one?

Peter Veentjer

unread,
Aug 13, 2015, 4:33:14 AM8/13/15
to haze...@googlegroups.com
We don't expose connections to be pooled. So which connections are you talking about.

--
You received this message because you are subscribed to the Google Groups "Hazelcast" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hazelcast+...@googlegroups.com.
To post to this group, send email to haze...@googlegroups.com.
Visit this group at http://groups.google.com/group/hazelcast.
To view this discussion on the web visit https://groups.google.com/d/msgid/hazelcast/995839b4-b11e-4a8a-8c8a-fb5c4b082b25%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Peter Veentjer

unread,
Aug 13, 2015, 4:36:23 AM8/13/15
to haze...@googlegroups.com
The internal connection(s) are pooled. So we don't create a connection for every request, but we re-use it.

M.Ahsen Taqi Kazmi

unread,
Aug 13, 2015, 6:01:52 AM8/13/15
to Hazelcast

I am using a client to peer approach, i wanted to ask that when i connect from client, the connection object that i get from the pool should i explicitly have to release it or is there some other mechanism for moving the connection object back in to pool?
here is my connection pool size in the config

<connection-pool-size>10</connection-pool-size>

Jaromir Hamala

unread,
Aug 13, 2015, 6:22:44 AM8/13/15
to Hazelcast
Hello,

Do you use Hazelcast Resource Adapter deployed in Java EE container / Spring? As that's the only place I can think of where connection pool settings make sense.

Cheers,
Jaromir

M.Ahsen Taqi Kazmi

unread,
Aug 13, 2015, 6:24:59 AM8/13/15
to Hazelcast
i have just read that hcast used connection pool from 3.0 to 3.2  but i am using 3.5 so can you please tell me what is the connection policy for 3.5?


On Thursday, August 13, 2015 at 1:36:23 PM UTC+5, peter veentjer wrote:

Jaromir Hamala

unread,
Aug 13, 2015, 6:30:04 AM8/13/15
to Hazelcast
There is no physical connection pool in Hazelcast 3.5. Clients use just a single multiplexed connection per member -> There is no need to configure a connection pool. There are logical connection in the Hazelcast Resource Adapter (used for integration with Java EE containers), but I assume that is not your case.

Can you post here your full configuration? It will be easier to help then.

Cheers,
Jaromir

M.Ahsen Taqi Kazmi

unread,
Aug 13, 2015, 6:45:53 AM8/13/15
to Hazelcast
here is my complete config

<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ Copyright (c) 2008-2013, Hazelcast, Inc. All Rights Reserved.
  ~
  ~ Licensed under the Apache License, Version 2.0 (the "License");
  ~ you may not use this file except in compliance with the License.
  ~ You may obtain a copy of the License at
  ~
  ~ http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing, software
  ~ distributed under the License is distributed on an "AS IS" BASIS,
  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  ~ See the License for the specific language governing permissions and
  ~ limitations under the License.
  -->

<hazelcast-client xsi:schemaLocation="http://www.hazelcast.com/schema/config hazelcast-client-config-3.2.4.xsd"
           xmlns="http://www.hazelcast.com/schema/config"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <group>
        <name>abc</name>
        <password>xyz</password>
    </group>
    <management-center enabled="falsethere is ">http://localhost:8080/mancenter</management-center>
   
    <properties>
        <property name="hazelcast.client.connection.timeout">60000</property>
        <property name="hazelcast.client.retry.count">10</property>
    </properties>
   
    <network>
       <cluster-members>
            <address>xxxxx</address>
            <address>xxxxx</address>
            <address>xxxxx</address>
            <address>xxxxx</address>
        </cluster-members>
        <smart-routing>true</smart-routing>
        <redo-operation>true</redo-operation>
        <connection-timeout>60000</connection-timeout>
        <connection-attempt-limit>10</connection-attempt-limit>
        <connection-pool-size>10</connection-pool-size>
    </network>
        <executor-pool-size>40</executor-pool-size> <!-- added -->
  
<load-balancer type="random"/>

</hazelcast-client>

Jaromir Hamala

unread,
Aug 13, 2015, 7:09:51 AM8/13/15
to Hazelcast
Thanks! 
This is a configuration file from Hazelcast 3.2 times. 
I assume you want to use the latest version - 3.5.1. If that's the case then you can simply remove the `connection-pool-size` element as it has no meaning in Hazelcast 3.5.

I'd also recommend you to change the root element to:

<hazelcast-client xsi:schemaLocation="http://www.hazelcast.com/schema/client-config hazelcast-client-config-3.5.xsd"
xmlns="http://www.hazelcast.com/schema/client-config"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

This will give you configuration file validation appropriate for Hazelcast 3.5

Cheers,
Jaromir

M.Ahsen Taqi Kazmi

unread,
Aug 15, 2015, 3:24:25 AM8/15/15
to Hazelcast
Thanks for the guidance Jaromir

Jaromir Hamala

unread,
Aug 15, 2015, 5:55:31 AM8/15/15
to Hazelcast
You are very welcome! Is it working for you?

tya...@gmail.com

unread,
Dec 10, 2016, 12:48:43 AM12/10/16
to Hazelcast
Hi,

I'm hoping I can piggy-back on this topic here. We are using the Hazelcast Resource Adapter deployed in a Java EE container. My question is where a client can open a single connection and keep reusing that connection for its lifetime? Or do we need to open and close the connection after each action?

Thanks,
Tya

Peter Veentjer

unread,
Dec 12, 2016, 12:24:15 PM12/12/16
to haze...@googlegroups.com
The connection or connections (depending if smart or dumb client) are pooled in the clientside HazelcastInstance.

So as long as you keep the clientside HazelcastInstance around; you pool the connections.

To unsubscribe from this group and stop receiving emails from it, send an email to hazelcast+unsubscribe@googlegroups.com.

To post to this group, send email to haze...@googlegroups.com.

tya...@gmail.com

unread,
Dec 12, 2016, 12:48:13 PM12/12/16
to Hazelcast
To get a connection, we use the 'HazelcastCF' connection factory. Each time we do a getConnection and use the connection, we call a connection.close. Next time around we do a connectionFactory.getConnection again.. 

Does this retrieve the connections from a pool? Or do we not need to get and close connection but rather open a connection at the start and just reuse that connection while there's a client-side HazelcastInstance?
Reply all
Reply to author
Forward
0 new messages