Strange results when I test ICE

Yunqiao YinYunqiao Yin Member Yin YunqiaoOrganization: BaosteelProject: real time process control system ✭✭
ICE VERSION: ICE-2.0.0
PLATEFORM: WINDOWS XP SP2
VC VERSION: VC 7.0

The slice defination:
module Performance
{
interface SendTest
{
//simple types send test
void sendInt(int value);
};
};
The Server for SendTest just do nothing(use slice2cpp --impl and compile it),and the Client code like this:
//The stats callback class
int inbytes = 0;
int outbytes = 0;
class MyStats : public virtual Ice::Stats {
public:
virtual void bytesSent(const string &prot, Ice::Int num)
{
inbytes += num;
}
virtual void bytesReceived(const string &prot, Ice::Int num)
{
outbytes += num;
}
};
//codes in run(...) function....
Ice::ObjectPrx base = communicator->stringToProxy(proxy);
SendTestPrx twoway = SendTestPrx::checkedCast(base->ice_twoway());
if(!twoway)
{
cerr << argv[0] << ": invalid proxy" << endl;
return EXIT_FAILURE;
}
SendTestPrx oneway = SendTestPrx::uncheckedCast(twoway->ice_oneway());
SendTestPrx batchOneway = SendTestPrx::uncheckedCast(twoway->ice_batchOneway());
SendTestPrx datagram = SendTestPrx::uncheckedCast(twoway->ice_datagram());
SendTestPrx batchDatagram = SendTestPrx::uncheckedCast(twoway->ice_batchDatagram());

IceUtil::Time t = IceUtil::Time::now();
try
{

for(int i = 1;i < 100000;i++)
{
oneway->sendInt(i);
//batchOneway->sendInt(i);
//datagram->sendInt(i);
//batchDatagram->sendInt(i);
}
//communicator->flushBatchRequests(); called in batch mode
}
catch(const Ice::Exception& ex)
{
cerr << ex << endl;
}

cout << "Total time elapse: " << (IceUtil::Time::now() - t).toMilliSeconds() << " milli seconds" << endl;
cout << "Total send : " << inbytes << " Bytes" << endl;
cout << "Total receive: " << outbytes << " Bytes" << endl;
Codes in main(...) function:
int
main(int argc, char* argv[])
{
int status;
Ice::CommunicatorPtr communicator;
Ice::StatsPtr stats = new MyStats;
try
{
Ice::PropertiesPtr properties = Ice::createProperties();
properties->load("performance.cfg");
communicator = Ice::initializeWithProperties(argc, argv, properties);
communicator->setStats(stats);
status = run(argc, argv, communicator);
}
catch(const Ice::Exception& ex)
{
cerr << ex << endl;
status = EXIT_FAILURE;
}

Questions:
1)The most strange thing is when I test in datagram oneway mode,the total sent bytes is just 83 bytes(in other mode the number is 4900020) ,I don't know why? :confused:
2)In TCP batch oneway mode,the call count can not beyond 33825 before flush all requests.If beyonds it,the Ice::CloseConnectionException Raised. So why? :confused: :confused: :confused:

see attatchment for all test codes and test result.
Thanks

Comments

  • marcmarc FloridaAdministrators, ZeroC Staff Marc LaukienOrganization: ZeroC, Inc.Project: The Internet Communications Engine ZeroC Staff
    How did you measure the number of bytes being sent with datagrams? Did you count the number of bytes received by the server? If so, it's quite possible that the clients sends data too fast for the network and server too receive. UDP has no flow control, so packages that cannot be sent as quickly as requested by the application are silently thrown away.

    Regarding the number of batch oneways, that's a known bug. If the total number of bytes in the batch exceeds the configured maximum for the message size (property Ice.MessageSizeMax, default is 1 MB), then the connection is closed. In the next version of Ice you will get a MemoryLimitException.
  • Yunqiao YinYunqiao Yin Member Yin YunqiaoOrganization: BaosteelProject: real time process control system ✭✭
    marc wrote:
    How did you measure the number of bytes being sent with datagrams? Did you count the number of bytes received by the server? If so, it's quite possible that the clients sends data too fast for the network and server too receive. UDP has no flow control, so packages that cannot be sent as quickly as requested by the application are silently thrown away.
    Thank you,marc!
    I measure the communication with Ice::Stats interface.So do you mean I cann't get exact statistics with the Ice::Stats interface for datagram requests? I cann't understand your answer very well ,sorry:(
  • marcmarc FloridaAdministrators, ZeroC Staff Marc LaukienOrganization: ZeroC, Inc.Project: The Internet Communications Engine ZeroC Staff
    Ice::Stats should give you the correct results. Before I dig deeper into this, can you please add mutex protection to your Stats implementation, and try again?
  • Yunqiao YinYunqiao Yin Member Yin YunqiaoOrganization: BaosteelProject: real time process control system ✭✭
    I add mutex lock like this:
    virtual void bytesSent(const string &prot, Ice::Int num)
    {
    IceUtil::RecMutex::Lock sync(*this);
    inbytes += num;
    }
    virtual void bytesReceived(const string &prot, Ice::Int num)
    {
    IceUtil::RecMutex::Lock sync(*this);
    outbytes += num;
    }
    and get send/receive statistics from both server and client,the results indicate that the statistics of server is true,but the client seems to lost the statistic infomation except the ICE control information.

    see the detail test ressult in attatch file.
    Best regards.
  • mesmes CaliforniaAdministrators, ZeroC Staff Mark SpruiellOrganization: ZeroC, Inc.Project: Ice Developer ZeroC Staff
    Hi,

    Sorry for the late response. We've identified the problem and it will be fixed in the next release.

    If you want to apply the fix, edit the file src/Ice/UdpTransceiver.cpp and add the code indicated below at line 295:
        _logger(instance->logger()),
        _stats(instance->stats()), // ADD THIS LINE
        _incoming(false),
    
    Then you'll need to recompile the Ice library.

    Thanks for the bug report!

    Take care,
    - Mark
Sign In or Register to comment.