Archived

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

Multiple Connection to the same Glacier

Hi,
for testing reasons, I need to create multiple connection to the same glacier (with different credentials) from the same application. That to simulate more clients from a single app, I want to do that with only one comunicator or scalability reasons, Is it possible?
Thanks

Comments

  • I don't see why not. You can create several sessions with different credentials from a single client. No need to use several communicators, as far as I can see.

    Cheers,

    Michi.
  • benoit
    benoit Rennes, France
    Note that you'll need to use distinct router proxies for each Glacier2 session (with each proxy using a unique connection). So you'll need to set the router proxy and connection ID on each proxy obtained from Glacier2. For example:
        Glacier2::RouterPrx router1 = Glacier2::RouterPrx::uncheckedCast(router->ice_connectionId("router1"));
        Glacier2::RouterPrx router2 = Glacier2::RouterPrx::uncheckedCast(router->ice_connectionId("router2"));
    
        base = router1->createSession("client1", "test1");
        Glacier2::SessionPrx session1 = base->ice_connectionId("router1")->ice_router(router1);
    
        base = router2->createSession("client2", "test2");
        Glacier2::SessionPrx session2 = base->ice_connectionId("router2")->ice_router(router2);
    

    This ensures that invocations on the session1 proxy are routed with router1 using the connection "router1" and that invocations on the session2 proxy are routed with router2 using the connection "router2".

    Cheers,
    Benoit.
  • matthew
    matthew NL, Canada
    I've attached part of a test which uses this technique that I used to test Glacier2 scalability in conjunction with IceStorm in the Ice 3.3 testing cycle. This subscriber can be used with demo/IceStorm/clock.

    The config.sub file from demo/IceStorm/clock must also be modified. Add, with suitable changes:

    Router=DemoGlacier2/router:tcp -p 10005 -h june
    Ice.ACM.Client=0
    Ice.RetryIntervals=-1

    In addition, Clock.Subscriber.Endpoints must be commented out or removed
  • I'd like to continue this thread with a follow-up question.

    If my application needs to create multiple, independent connections to the same Glacier2 router, is there any way to share the same object adapter for servants or am I required to create a "dedicated" object adapter for each router session?

    I note in Matthew's Subscriber.cpp attachment his use of the

    createObjectAdapterWithRouter() api, with one adapter being creating for each router connection/session.

    I'm curious is this is a fundamental restriction at this point in time.

    Thanks,

    Phil
  • matthew
    matthew NL, Canada
    Yes, that is a restriction.