Understanding the "connect retries per host" and ""connect retries" properties.

b1102
b1102 Member Posts: 3
edited April 2023 in General Discussions #1

Let's imagine the situation that I have:

number of solace hosts: 3

connect retries: 2

connect retries per host: 4

What would be the final number of retries, if it would be 24, like 2 x 4 per host? Or how it would work?

Tagged:

Comments

  • amackenzie
    amackenzie Member, Employee Posts: 260 Solace Employee
    edited April 2023 #2
  • b1102
    b1102 Member Posts: 3

    Thank you, definitely example is very good and explains everything. Haven't reached it during the first attempt by reading the doc.

  • Aaron
    Aaron Member, Administrator, Moderator, Employee Posts: 508 admin
    edited April 2023 #4

    number of solace hosts: 3

    connect retries: 2

    connect retries per host: 4

    If you have brokers A, B, and C. I think it should do:

    AAAABBBBCCCCAAAABBBBCCCC done.

    Right?

    p.s. why do you have 3 hosts??

  • b1102
    b1102 Member Posts: 3

    At least I got the different from a doc.

    AAAA BBBB CCCC  - the first try

    AAAA BBBB CCCC - the first retry

    AAAA BBBB CCCC - the second retry

    In total I expect: AAAABBBBCCCCAAAABBBBCCCCAAAABBBBCCCC

    P.S. I don't have 3 hosts, it was just an example to understand how it works

  • amackenzie
    amackenzie Member, Employee Posts: 260 Solace Employee

    @b1102 the above looks correct. I think it differs from @Aaron 's example because Aaron left out the initial connect tries.

  • Aaron
    Aaron Member, Administrator, Moderator, Employee Posts: 508 admin
    edited May 2023 #7

    That's what I get for not testing it myself and going from memory! 😓 Either way, none of us are correct. I just tested with JCSMP 10.19. With the above settings, you get:

    AAAAA BBBBB CCCCC AAAAA BBBBB CCCCC

    Retries per host = 1 attempt + number of retries. So 4 means 5 attempts in a row.

    Then Connect Retries = total number of loops.

    So my results don't line up with the docs, @amackenzie..!

    JCSMP Channel Properties setting:

    channelProps.setConnectRetriesPerHost(4);
    channelProps.setConnectRetries(2);
    

    Configured 3 hosts, with an invalid VPN name for testing purposes:

    11:54:09.170 INFO - DemoPublisher initializing...
    11:54:09.586 INFO - Client-1: Connecting to host 'orig=localhost, host=localhost' (host 1 of 3, smfclient 1, attempt 1 of 6, this_host_attempt: 1 of 5)
    11:54:12.673 INFO - Client-1: Connecting to host 'orig=localhost, host=localhost' (host 1 of 3, smfclient 1, attempt 1 of 6, this_host_attempt: 2 of 5)
    11:54:15.684 INFO - Client-1: Connecting to host 'orig=localhost, host=localhost' (host 1 of 3, smfclient 1, attempt 1 of 6, this_host_attempt: 3 of 5)
    11:54:18.708 INFO - Client-1: Connecting to host 'orig=localhost, host=localhost' (host 1 of 3, smfclient 1, attempt 1 of 6, this_host_attempt: 4 of 5)
    11:54:21.715 INFO - Client-1: Connecting to host 'orig=localhost, host=localhost' (host 1 of 3, smfclient 1, attempt 1 of 6, this_host_attempt: 5 of 5)
    11:54:21.723 INFO - Client-1: Connecting to host 'orig=public.messaging.solace.cloud, host=public.messaging.solace.cloud' (host 2 of 3, smfclient 1, attempt 2 of 6, this_host_attempt: 1 of 5)
    11:54:24.751 INFO - Client-1: Connecting to host 'orig=public.messaging.solace.cloud, host=public.messaging.solace.cloud' (host 2 of 3, smfclient 1, attempt 2 of 6, this_host_attempt: 2 of 5)
    11:54:27.784 INFO - Client-1: Connecting to host 'orig=public.messaging.solace.cloud, host=public.messaging.solace.cloud' (host 2 of 3, smfclient 1, attempt 2 of 6, this_host_attempt: 3 of 5)
    11:54:30.810 INFO - Client-1: Connecting to host 'orig=public.messaging.solace.cloud, host=public.messaging.solace.cloud' (host 2 of 3, smfclient 1, attempt 2 of 6, this_host_attempt: 4 of 5)
    11:54:33.846 INFO - Client-1: Connecting to host 'orig=public.messaging.solace.cloud, host=public.messaging.solace.cloud' (host 2 of 3, smfclient 1, attempt 2 of 6, this_host_attempt: 5 of 5)
    11:54:33.878 INFO - Client-1: Connecting to host 'orig=aaron.messaging.solace.cloud, host=aaron.messaging.solace.cloud' (host 3 of 3, smfclient 1, attempt 3 of 6, this_host_attempt: 1 of 5)
    11:54:37.347 INFO - Client-1: Connecting to host 'orig=aaron.messaging.solace.cloud, host=aaron.messaging.solace.cloud' (host 3 of 3, smfclient 1, attempt 3 of 6, this_host_attempt: 2 of 5)
    11:54:40.796 INFO - Client-1: Connecting to host 'orig=aaron.messaging.solace.cloud, host=aaron.messaging.solace.cloud' (host 3 of 3, smfclient 1, attempt 3 of 6, this_host_attempt: 3 of 5)
    11:54:44.263 INFO - Client-1: Connecting to host 'orig=aaron.messaging.solace.cloud, host=aaron.messaging.solace.cloud' (host 3 of 3, smfclient 1, attempt 3 of 6, this_host_attempt: 4 of 5)
    11:54:47.716 INFO - Client-1: Connecting to host 'orig=aaron.messaging.solace.cloud, host=aaron.messaging.solace.cloud' (host 3 of 3, smfclient 1, attempt 3 of 6, this_host_attempt: 5 of 5)
    11:54:51.169 INFO - Client-1: Connecting to host 'orig=localhost, host=localhost' (host 1 of 3, smfclient 1, attempt 4 of 6, this_host_attempt: 1 of 5)
    11:54:54.183 INFO - Client-1: Connecting to host 'orig=localhost, host=localhost' (host 1 of 3, smfclient 1, attempt 4 of 6, this_host_attempt: 2 of 5)
    11:54:57.204 INFO - Client-1: Connecting to host 'orig=localhost, host=localhost' (host 1 of 3, smfclient 1, attempt 4 of 6, this_host_attempt: 3 of 5)
    11:55:00.227 INFO - Client-1: Connecting to host 'orig=localhost, host=localhost' (host 1 of 3, smfclient 1, attempt 4 of 6, this_host_attempt: 4 of 5)
    11:55:03.243 INFO - Client-1: Connecting to host 'orig=localhost, host=localhost' (host 1 of 3, smfclient 1, attempt 4 of 6, this_host_attempt: 5 of 5)
    11:55:03.255 INFO - Client-1: Connecting to host 'orig=public.messaging.solace.cloud, host=public.messaging.solace.cloud' (host 2 of 3, smfclient 1, attempt 5 of 6, this_host_attempt: 1 of 5)
    11:55:06.329 INFO - Client-1: Connecting to host 'orig=public.messaging.solace.cloud, host=public.messaging.solace.cloud' (host 2 of 3, smfclient 1, attempt 5 of 6, this_host_attempt: 2 of 5)
    11:55:09.364 INFO - Client-1: Connecting to host 'orig=public.messaging.solace.cloud, host=public.messaging.solace.cloud' (host 2 of 3, smfclient 1, attempt 5 of 6, this_host_attempt: 3 of 5)
    11:55:12.399 INFO - Client-1: Connecting to host 'orig=public.messaging.solace.cloud, host=public.messaging.solace.cloud' (host 2 of 3, smfclient 1, attempt 5 of 6, this_host_attempt: 4 of 5)
    11:55:15.423 INFO - Client-1: Connecting to host 'orig=public.messaging.solace.cloud, host=public.messaging.solace.cloud' (host 2 of 3, smfclient 1, attempt 5 of 6, this_host_attempt: 5 of 5)
    11:55:15.441 INFO - Client-1: Connecting to host 'orig=aaron.messaging.solace.cloud, host=aaron.messaging.solace.cloud' (host 3 of 3, smfclient 1, attempt 6 of 6, this_host_attempt: 1 of 5)
    11:55:18.894 INFO - Client-1: Connecting to host 'orig=aaron.messaging.solace.cloud, host=aaron.messaging.solace.cloud' (host 3 of 3, smfclient 1, attempt 6 of 6, this_host_attempt: 2 of 5)
    11:55:22.354 INFO - Client-1: Connecting to host 'orig=aaron.messaging.solace.cloud, host=aaron.messaging.solace.cloud' (host 3 of 3, smfclient 1, attempt 6 of 6, this_host_attempt: 3 of 5)
    11:55:25.802 INFO - Client-1: Connecting to host 'orig=aaron.messaging.solace.cloud, host=aaron.messaging.solace.cloud' (host 3 of 3, smfclient 1, attempt 6 of 6, this_host_attempt: 4 of 5)
    11:55:29.264 INFO - Client-1: Connecting to host 'orig=aaron.messaging.solace.cloud, host=aaron.messaging.solace.cloud' (host 3 of 3, smfclient 1, attempt 6 of 6, this_host_attempt: 5 of 5)
    11:55:32.730 INFO - Client-1: Channel Closed (smfclient 1)  at com.solacesystems.jcsmp.protocol.impl.TcpChannel.executePostOnce(TcpChannel.java:235)
        at com.solacesystems.jcsmp.protocol.impl.ChannelOpStrategyClient.performOpen(ChannelOpStrategyClient.java:101)
        at com.solacesystems.jcsmp.protocol.impl.TcpClientChannel.performOpenSingle(TcpClientChannel.java:428)
        at com.solacesystems.jcsmp.protocol.impl.TcpClientChannel.access$800(TcpClientChannel.java:124)
        at com.solacesystems.jcsmp.protocol.impl.TcpClientChannel$ClientChannelConnect.call(TcpClientChannel.java:2610)
        at com.solacesystems.jcsmp.protocol.impl.TcpClientChannel.open(TcpClientChannel.java:404)
        at com.solacesystems.jcsmp.impl.JCSMPBasicSession.sniffRouter(JCSMPBasicSession.java:423)
        at com.solacesystems.jcsmp.impl.JCSMPBasicSession.connect(JCSMPBasicSession.java:1310)
        at dev.solace.pqdemo.PQPublisher.main(PQPublisher.java:155)
    


    Note, it appears that channelProps.setConnectRetries(0); and channelProps.setConnectRetries(1); behave the same way in JCSMP... that is: one time through the host list.

  • Aaron
    Aaron Member, Administrator, Moderator, Employee Posts: 508 admin

    Maybe it's different for C, .NET, JS..?