Home Help Center

Performance of asynch twoway vs oneway proxies

dmedagliadmedaglia Member Diego MedagliaOrganization: HP Inc.Project: Remote desktop application

Hi all,

We have a client that is overwhelming the server with oneway calls on certain conditions, and are trying to limit new invocations by changing to twoway asynch calls so we can get a confirmation the server has serviced old calls.
Our goal to is track the number of outstanding invocations on the proxy, and stall if there are too many. Once enough tasks are stored, we will task->waitForComplete(); before making the next invocation. IE: Once 30 calls have been made you must wait for the first once to have been completed before sending 31

This is how it was:

oneway->call();

Here's the changed version:

auto task = twoway->begin_call(); 
task.waitForSent();

Do these two tasks behave the same way in regards to performance and throughput?

Tagged:

Best Answer

  • xdmxdm La Coruña, SpainAdministrators, ZeroC Staff Jose Gutierrez de la ConchaOrganization: ZeroC, Inc.Project: Ice Developer ZeroC Staff
    Accepted Answer

    Hi Diego,

    The performance for these two calls should be very similar, one thing to keep in mind oneway->call(); will throw an exception if there is an error sending, begin_call, waitForSent or waitForComplete will not.

    If you want to handle exception after waitForSent you have to add an additional call to throwLocalException()

    auto t = twoway->begin_call();
    t->waitForSent();
    t->throwLocalException();
    

    Otherwise, if you want to handle exceptions after completion call the end method twoway->end_call(t) to wait for the completion and this will report any exceptions.

Answers

  • xdmxdm La Coruña, SpainAdministrators, ZeroC Staff Jose Gutierrez de la ConchaOrganization: ZeroC, Inc.Project: Ice Developer ZeroC Staff
    Accepted Answer

    Hi Diego,

    The performance for these two calls should be very similar, one thing to keep in mind oneway->call(); will throw an exception if there is an error sending, begin_call, waitForSent or waitForComplete will not.

    If you want to handle exception after waitForSent you have to add an additional call to throwLocalException()

    auto t = twoway->begin_call();
    t->waitForSent();
    t->throwLocalException();
    

    Otherwise, if you want to handle exceptions after completion call the end method twoway->end_call(t) to wait for the completion and this will report any exceptions.

Sign In or Register to comment.