Archived

This forum has been archived. Please start a new discussion on GitHub.

Endpoint Selection After Timeout

This is a question about the behavior of the ice runtime. I have a proxy with default configuration and two endpoints. All of the functions to the interface for which this proxy represents are idempotent.
prx_str = "testProxy "
          ":tcp -h host1 -p 10001 -t 3000"
          ":tcp -h host2 -p 10001 -t 3000";
proxy = communicator()->stringToProxy(prx_str);

After reading the manual on connection establishment I understand that it will randomly organize valid endpoints into a list. It then will sequentially try to connect to each endpoint in the list until it establishes a connection with one or can't establish one at all. I see this when I enable logging such as --Ice.Trace.Network=2 and --Ice.Trace.Retry=2.

So assuming all goes fine, it establishes a connection with the first endpoint and I use my proxy. Next say my proxy's endpoint becomes overloaded such that a particular rpc hits the timeout. It closes the connection and since the rpc is idempotent it retries connection establishment.

Now here is what I didn't expect. Sometimes it tries to connect to the same endpoint and sometimes it tries the other endpoint. I would have expected it to always try the other endpoint first. After re-reading connection establishment, it seems that the connection establishment process doesn't know anything about an endpoint having recently timed out. Unfortunately in my case this is bad because if it happens to choose the same endpoint it is likely to timeout again because the server for that endpoint is still overloaded.

So I have two questions. Did I understand that right? If so, is there a way to force endpoints that just timed out to be put at the end of the list of endpoints to try?

Comments

  • matthew
    matthew NL, Canada
    After reading the manual on connection establishment I understand that it will randomly organize valid endpoints into a list. It then will sequentially try to connect to each endpoint in the list until it establishes a connection with one or can't establish one at all.

    This is incorrect... I describe all this in detail in my article "Connection Management in Ice" in http://www.zeroc.com/newsletter/issue24.pdf.
    ... is there a way to force endpoints that just timed out to be put at the end of the list of endpoints to try?

    At present, this is not possible. However, if you use endpoint randomization, or you have multiple IPs associated with the endpoint (through DNS) then the chances of reusing the same endpoint immediately become less :)
  • matthew wrote: »
    This is incorrect....
    Ok yes there are more technical details. I assume you are refering to PreferSecure ordering and connection reusability. Yet in my case I have no ssl endpoints and I was going under the assumption that I don't have an existing connection. Sorry about the unstated assumptions. If meant something else then I'm afraid I don't know what you mean.

    Anyway thank you. It's good to know what I can't do so that I don't spend too much time tring to do it.