Archived

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

how does the Glacier2-callback work?

A serviceA, a serviceB with Glacier2
When serviceA starting, will call ServiceB.setCallback(ServiceCallbackPrx cbProxy), so ServiceB can call cbProxy to send result to ServiceA.

It seems to be working well.

Now, for load balancing, move the ServiceA into GridA, and deploy 4 instances of ServiceA.
What will happen?
1. ServiceB.setCallback(ServiceCallbackPrx cbProxy) will be called 4 times? and each cbProxy is the same one?
2. when ServiceB calling cbProxy to send result to ServiceA, witch cbProxy will be used? (or with ServiceA instance will be called?)

Comments

  • bernard
    bernard Jupiter, FL

    Hi Joey,

    You forgot to describe where Glacier2 fits into your deployment. Do your services communicate through Glacier2?

    It's also possible your question is only about IceGrid replication with no Glacier2 involvement.

    Now, for load balancing, move the ServiceA into GridA, and deploy 4 instances of ServiceA.
    What will happen?

    1. ServiceB.setCallback(ServiceCallbackPrx cbProxy) will be called 4 times? and each cbProxy is the same one?

    Yes, since each of your 4 instances calls setCallback. The cbProxy is manufactured by your application. Here it could indeed be the same well-known or indirect replicated proxy.

    1. when ServiceB calling cbProxy to send result to ServiceA, witch cbProxy will be used? (or with ServiceA instance will be called?)

    IceGrid allows you to control how a replicated proxy is resolved, see https://doc.zeroc.com/display/Ice37/Load+Balancing.

    By default, it would be one of your 4 ServiceA's service callbacks chosen at random.

    Cheers,
    Bernard

  • Sorry, my English is just so so.

    Yes, ServiceA and ServiceB are in different IDCs, so, Both ServiceA and ServiceB have Glacier2 and Grid. They difference is ServiceA has multi-instance, ServiceB has only one instance.
    When ServiceA instances booting one by one, each of them will call ServiceB.setCallback(ServiceACallbackPrx, ID),
    in my opinion,the last one will overwrite the previous setting, so, ServiceB holds only one ServiceACallbackPrx object, IS IT RIGHT?

    if it is right, then, when ServiceB calling ServiceA by ServiceACallbackPrx object, even if the callback proxy object is the specific one, the GirdA's load balancing will work?

    Thanks

  • bernard
    bernard Jupiter, FL

    Hi Joey,

    Yes, this is correct: since you have a single ServiceB instance, the ServiceA callback is replaced by each call to ServiceB.setCallback (assuming the setCallback implementation replaces the callback).

    Later, when ServiceB calls on the callback proxy, each call will reach only one ServiceA. By default, it will be the same ServiceA over and over. However, if the callback proxy is a replicated proxy, you can use a different load balancing strategy, for example direct each call to a different instance. See:

    https://doc.zeroc.com/display/Ice37/Proxy-Based+Load+Balancing
    https://doc.zeroc.com/display/Ice37/Locator+Semantics+for+Clients#LocatorSemanticsforClients-LoadBalancingwithaLocator

    Note that Glacier2 isn't involved at all in any of this.

    Best regards,
    Bernard