NearCache that only resets AFTER re-established connection #99
Unanswered
leolegenie
asked this question in
Q&A
Replies: 1 comment 1 reply
-
Considering that If you would like to submit a PR with the work you've done, we'll be happy to work with you on getting it cleaned up, polished and integrated. You can also take a look at how |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello
Currently the NearCache implementation, if it looses the connection to the backing cluster, does a call to "resetFrontMap()" and drops all data that it contains and all subsequent calls on it then trigger remote calls that hang until the network timeout is reached.
For our usecase, what we would prefer as behavior is that if the NearCache looses the connection to the cluster it goes into a kind of "stale-mode" and keeps at least the data that it already has and returns that to the consumer, as well as returning null for records it does not have.
The goal here is to increase resillience and robustness for the consumer application in case of (temporary) network outages, which we unfortunately have from time to time.
I understand that the LISTEN_NONE strategy does this more or less, but then we have no data updates at all pushed to the near cache from the cluster. So what we would like to have is a LISTEN_ALL strategy but a bit more relaxed on consistency guarantees during network outages.
I tried to implement this behavior by extending NearCache and overriding the DeactivationListener and BackServiceListener and a couple of methods here and there and it seems to work, but I'm not super confident that I got it all correct. I also had to introduce a "connection state" variable to avoid the remote calls when we have no data to return on a get(...) when the connection is down. This in turn seems to impact the BackServiceListener as no MemberJoined event is fired anymore as no reconnect is triggered so I also had to add a poller Thread to re-trigger the connection in the background. So all in all it feels a bit convoluted/fragile. This is on Coherence 14 by the way.
Questions:
Thanks, regards, Leo
Beta Was this translation helpful? Give feedback.
All reactions