cxRmi Performance Test Code

The following code allows for some simple benchmarking of the cxRmi middleware layer.

There are seven tests which have been defined. In each case a loop repeats the message invocation many times.

Interface used for the tests

The following interface was used for these tests


$model Fixed
{
    int32 i;
    int32 j;
    float64 d;
};

$interface rmi I
{
    void v();

    void b1(int8 i0);
    void b2(int8 i0,int8 i1);
    void b4(int8 i0,int8 i1,int8 i2, int8 i3);
    void b8(int8 i0,int8 i1,int8 i2, int8 i3,int8 i4,int8 i5,int8 i6, int8 i7);

    void s1(int16 i0);
    void s2(int16 i0,int16 i1);
    void s4(int16 i0,int16 i1,int16 i2, int16 i3);
    void s8(int16 i0,int16 i1,int16 i2, int16 i3,int16 i4,int16 i5,int16 i6, int16 i7);

    void i1(int32 i0);
    void i2(int32 i0,int32 i1);
    void i4(int32 i0,int32 i1,int32 i2, int32 i3);
    void i8(int32 i0,int32 i1,int32 i2, int32 i3,int32 i4,int32 i5,int32 i6, int32 i7);

    void l1(int64 i0);
    void l2(int64 i0,int64 i1);
    void l4(int64 i0,int64 i1,int64 i2, int64 i3);
    void l8(int64 i0,int64 i1,int64 i2, int64 i3,int64 i4,int64 i5,int64 i6, int64 i7);

    void f1(float32 i0);
    void f2(float32 i0,float32 i1);
    void f4(float32 i0,float32 i1,float32 i2, float32 i3);
    void f8(float32 i0,float32 i1,float32 i2, float32 i3,float32 i4,float32 i5,float32 i6, float32 i7);

    void d1(float64 i0);
    void d2(float64 i0,float64 i1);
    void d4(float64 i0,float64 i1,float64 i2, float64 i3);
    void d8(float64 i0,float64 i1,float64 i2, float64 i3,float64 i4,float64 i5,float64 i6, float64 i7);

    // b = a+1
    void inc([in] int32 a, [out] int32& b);

    void sendByteSeq([in] const string8& buffer, [out] int32& r);
    void sendFixedSeq([in] const xvector<Fixed>& buffer, [out] int32& r);
};

TEST 1

The time to buffer many small one-way messages on the sender. Note that each message only takes up 5 bytes.


for (int i=0 ; i < 100000 ; ++i)
{
    stub->v();
}

TEST 2

The time to batch many small one-way messages and wait for them all to be invoked on the receiver


for (int i=0 ; i < 100000 ; ++i)
{
    stub->v();
}

// Send a synchronous message to ensure
// async messages have been received
int32 x;
stub->inc(1,c);
MarkAndWait(rmiCaller);

TEST 3

The time to batch many small two-way messages (i.e. messages are buffered on the sender but may not have been sent)


std::vector<int32> c(1000000);
for (int i=0 ; i < 1000000 ; ++i)
{
    stub->inc(i,c[i]);
}

TEST 4

The time to batch many small two-way messages then wait for all responses to be received


std::vector<int32> c(1000000);
for (int i=0 ; i < 1000000 ; ++i)
{
    stub->inc(i,c[i]);
}
MarkAndWait(rmiCaller);

TEST 5

The time to synchronously call many small two-way messages


int32 c;
for (int i=0 ; i < 10000 ; ++i)
{
    stub->inc(i,c);
    MarkAndWait(rmiCaller);
}

TEST 6

The time to synchronously call a two-way message which sends 500000 bytes


string8 str(500000);
int32 r;
for (int i=0 ; i < 100 ; ++i)
{
    stub->sendByteSeq(str,r);
    MarkAndWait(rmiCaller);
}

TEST 7

The time to synchronously call a two-way message which sends a vector of 50000 elements where each element is a struct containing two ints and a double


xvector buffer(50000);
int32 r;
for (int i=0 ; i < 100 ; ++i)
{
    stub->sendFixedSeq(buffer,r);
    MarkAndWait(rmiCaller);
}