Home Help Center

Ice performance degrades gradually?

SundanceSundance Member John LoOrganization: University of PretoriaProject: Interchangeable Middlewares
Hello ZeroC Staff,

I am trying out your ICE product by stressing it a bit and I encountered something quite odd. I notice ICE performance degrades with mutilple calls over time on the same object.

To produce this problem, I followed your examples and created my own to illustrate things easier.

For the slice definitions, I wrote a simple operations that set and get an int counter as shown below:

module simple {
exception SimpleException {
string reason;
};
interface Operations {
int getCounter();
void setCounter(int c);
};
};

Then I created a Server class that host the servant object:

public class Server {

public static void main(String args []) {
Ice.Communicator ic = null;
try {
ic = Ice.Util.initialize(args);
Ice.ObjectAdapter adapter = ic.createObjectAdapterWithEndpoints(
"SimpleOperations", "default -p 9500");
Ice.Object servant = new OperationsI();
adapter.add(servant, ic.stringToIdentity("SimpleCounter"));
adapter.activate();
System.out.println("Server Started...");
ic.waitForShutdown();
} catch(Exception e) {e.printStackTrace();}
if (ic != null) {
try {
ic.destroy();
} catch (Exception e) {
e.printStackTrace();
}
}
}
}

A client class that calls the remote object 10000 times and times the duration of the calls:

public class Client {
public static void main(String[] args) {
int status = 0;
Ice.Communicator ic = null;
try {
ic = Ice.Util.initialize(args);
Ice.ObjectPrx baseOp = ic.stringToProxy("SimpleCounter:default -h localhost -p 9500");
OperationsPrx op = OperationsPrxHelper
.checkedCast(baseOp);
System.out.println("Processing...");
int c = 0;
long startTimer = System.currentTimeMillis();
for (int i = 0; i < 10000; i++) {
op.setCounter(i);
c = op.getCounter();
System.out.println("Counter: "+c);
}
long stopTimer = System.currentTimeMillis() - startTimer;
System.out.println("Time taken to get counter: "+stopTimer+"ms.");

} catch (Ice.LocalException e) {
e.printStackTrace();
status = 1;
}
if (ic != null) {
try {
ic.shutdown();
ic.destroy();
System.out.println("Thread Destroyed...");
} catch (Exception e) {
e.printStackTrace();
}
}
}
}


When I perform multiple separate runs of the client, the performance degrades after each run.
So on my machine it starts from 13 secs (first run), to 17 (second run), then 28 seconds (third run) and goes slower after each run etc.
Note that I am running both the Server and Client code on the same machine, without using any additional configurations or properties, so I
think its running using 1 thread per client and server according to your documentation. I am running the latest ICE Java implementation on Windows XP.

I think its quite common that the same stateless object can be shared and accessed by many clients at the same time.
I reckon this performance degradation should not happen, but where am I doing things incorrectly?

I appreciate any comments you can give me.

Thank-You

Comments

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

    I have review your code and don't see anything wrong that could cause the degradation in performance, can you show us the implementation of OperationsI?.

    I have tested your demo in Windows 7/ Java 1.6.0_26 and Linux/Java 1.6.0_29 and don't see any degradation in performance, i will test in XP when i have time, what Java version are you using?

    Here my times for 20 runs in Linux, i get similar results in Windows 7
    for i in {1..20}; do java Client; done | grep Time
    Time taken to get counter: 2483ms.
    Time taken to get counter: 1885ms.
    Time taken to get counter: 1733ms.
    Time taken to get counter: 1787ms.
    Time taken to get counter: 1830ms.
    Time taken to get counter: 1746ms.
    Time taken to get counter: 1643ms.
    Time taken to get counter: 1889ms.
    Time taken to get counter: 1810ms.
    Time taken to get counter: 1942ms.
    Time taken to get counter: 1733ms.
    Time taken to get counter: 1691ms.
    Time taken to get counter: 1671ms.
    Time taken to get counter: 1807ms.
    Time taken to get counter: 1810ms.
    Time taken to get counter: 1828ms.
    Time taken to get counter: 1792ms.
    Time taken to get counter: 1811ms.
    Time taken to get counter: 1837ms.
    Time taken to get counter: 1834ms.
    
Sign In or Register to comment.