Confd_load and confd_ha_status running blocking one another!

Hi All!

We have an issue and would like to have your opinion on how to change the same…

When we are loading config via confd_load and in the mean time one of the process tries to get confd_ha_status it blocks their and our application heart beat skips. Since this process is blocked in ha_status. Please let us know how to avoid such blocking call ?.

rgds
Balaji

Well… short answer is, confd_ha_status() doesn’t block.

Does the process that do the polling interact with ConfD in any other way (e.g. through a CDB subscription)?

See the example below where I load a pretty large config file while continuously polling ConfD for ha_status from the shell as fast as I can (~400 times per second) without any delays.

Note that my process does nothing but polling for ha_status.

$ time confd_load -l -m < routes.xml

real	0m49.825s
user	0m0.000s
sys	0m0.056s
$ n=0; while true; do ./ctrl ha_status; ((n++)); echo $n; done
master 0 slaves
1
master 0 slaves
2
master 0 slaves
3
master 0 slaves
4
master 0 slaves
5
master 0 slaves
6
master 0 slaves
7
master 0 slaves
8
master 0 slaves
9
master 0 slaves
10

...

master 0 slaves
18142
master 0 slaves
18143
master 0 slaves
18144
master 0 slaves
18145
master 0 slaves
18146
^C

Yep the same process responsible for validation and handling config and operation data’s. It also has a thread which does validation subcription…

rgds
Balaji

Running the ha-polling either as a separate process or a separate thread (using it’s own socket) should fix your problems, I think.

Thanks we will work on the same…

Apparently moving to a different socket we are purusing but not for current release. Hence we want to know is their any way we can set timeout for this query alone, since our code will retry if failure. I see some timeout function present, but want to know if anyone of them can be used for this ha_status ?.

rgds
Balaji

Unfortunately no. There is no timeout that affects confd_ha_status().

Thanks for the response, btw we wrote a sample code to spin a thread and do the same creating a new socket and still see its more then 5 secs…

confdHaFd = socket(AF_INET, SOCK_STREAM, 0))

confd_ha_connect(confdHaFd, (struct sockaddr*)&confdsockaddr,
sizeof (struct sockaddr_in),
CONFD_SEC_TOKEN) < 0)

confd_ha_status(confdHaFd, &status)

is their any way to debug why this takes more than 5 secs ?. I am planning to add 1 log after each to see if connect taking more time or status.

rgds
Balaji