Archived

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

A question about Connection Reuse in Ice

Ice manual says:
the Ice run time will open a new connection only if it cannot reuse an existing connection to any of the endpoints.

This is Ice's only choice! Maybe Ice should add an additional config property to allow every proxy use a new connection!

Comments

  • matthew
    matthew NL, Canada
    rc_hz wrote:
    Ice manual says:


    This is Ice's only choice! Maybe Ice should add an additional config property to allow every proxy use a new connection!

    Why would you want to do this? This would be expensive on the client-side. On the server side it could be quite fatal assuming a number of clients who each want to open up a large number of connections.

    Regards, Matthew
  • matthew wrote:
    Why would you want to do this? This would be expensive on the client-side. On the server side it could be quite fatal assuming a number of clients who each want to open up a large number of connections.

    Regards, Matthew

    I think that "per connection per proxy on the client side " maybe have better performance when much data should be transfered between client and server.
    Other advantages may exist also...
  • Another question:)

    1.First we get a proxy:

    Ice::CommunicatorPtr ic = Ice::initialize(argc, argv);
    Ice::ObjectPrx base = ic->stringToProxy(
    "SimplePrinter:default -p 10000");
    PrinterPrx printer = PrinterPrx::checkedCast(base);



    2.Then we start two or more threads which call this proxy's operations without lock control
    thread1()
    {
    for (int i=0; i<100; i++)
    printer->printString();
    }


    thread2()
    {
    for (int i=0; i<100; i++)
    printer->printString();
    }

    Is there any problem? Is the above code thread-safe ?
  • marc
    marc Florida
    Yes, the above is thread safe. All operations on a proxy (or on any other Ice objects for that matter) are thread safe.

    Using more than one TCP connection won't give you a higher transfer speed. The speed is limited by the overall physical connection speed, like 100 mbit/sec on fast Ethernet, 1.5 mbit/sec on a T1 line, etc. It doesn't matter how many logical connections (i.e., TCP connections) you open.
  • Thank you, I understand :p