Go Back   ZeroC Forums > Help Center

Reply
 
LinkBack Thread Tools Rate Thread Display Modes
  #1 (permalink)  
Old 03-05-2008
zaoliu zaoliu is offline
Registered User
 
Name: Zao Liu
Organization: HI5
Project: Performance test
 
Join Date: Mar 2008
Posts: 14
Questions regarding to AMI

I am trying to using AMI to asynchronous sending messages to the server and get replied back. First, I test sending one message and wait until getting replied back then I test sending batch of messages and waiting until batch messages back to send another group of messages. I expect the second test should have better performance than first test since the client don't need to wait for each message back, but the result make me surprised. The performance for them is quite the same so I get some print out in sending and callback method. I find most calls for the second one is quite like the first one, being synchronized.
Any comments and suggestions?
Reply With Quote
  #2 (permalink)  
Old 03-05-2008
mes's Avatar
mes mes is online now
ZeroC Staff
 
Name: Mark Spruiell
Organization: ZeroC, Inc.
Project: Ice Developer
 
Join Date: Feb 2003
Location: California
Posts: 971
Hi,

If your server is single-threaded then it can only process one request at a time, which would cause the behavior you are seeing. Read the FAQs below and let us know if you are still having trouble:

Why do I not get concurrent invocations in a server?

Why do I not get concurrent replies to asynchronous invocations?

Take care,
Mark
Reply With Quote
  #3 (permalink)  
Old 03-05-2008
zaoliu zaoliu is offline
Registered User
 
Name: Zao Liu
Organization: HI5
Project: Performance test
 
Join Date: Mar 2008
Posts: 14
Thanks, Mes.

Thanks, but I do add the thread pool for the server. By the way, I am not sure the Ice.ThreadPool.Client.Size is set on the server sice or client side. My client is single threaded.
Having a loop like below:
for (int i = 0; i < 10; i++) {
System.out.println("Message sending....");
message.sendMessage_async(reply, wrapper);
count++;
}

And in the server sendmessage method I set:
Thread.sleep(5000) to make the callback delayed.

I expect to see the client sending multiple messages to get one replied back since the object is blocked, but it seems the client is blocked to get reply back.
Reply With Quote
  #4 (permalink)  
Old 03-05-2008
mes's Avatar
mes mes is online now
ZeroC Staff
 
Name: Mark Spruiell
Organization: ZeroC, Inc.
Project: Ice Developer
 
Join Date: Feb 2003
Location: California
Posts: 971
Hi,

It's difficult to say what the problem might be without more information. If you can post an archive containing the source code of a complete example (including configuration files), we can take a look at it. Please also specify the versions of your operating system, Ice, and compiler.

Take care,
Mark
Reply With Quote
  #5 (permalink)  
Old 03-05-2008
zaoliu zaoliu is offline
Registered User
 
Name: Zao Liu
Organization: HI5
Project: Performance test
 
Join Date: Mar 2008
Posts: 14
Thanks, Mike. It will help me a lot. Is any place in the forum that I can attach my testing code? if not, could you send me your contact info to my email address: zaoliu@gmail.com? So I can sent you my testing code.

Thanks,
Zao
Reply With Quote
  #6 (permalink)  
Old 03-05-2008
mes's Avatar
mes mes is online now
ZeroC Staff
 
Name: Mark Spruiell
Organization: ZeroC, Inc.
Project: Ice Developer
 
Join Date: Feb 2003
Location: California
Posts: 971
You can attach a .ZIP file to messages here on the forum.

Mark
Reply With Quote
  #7 (permalink)  
Old 03-05-2008
zaoliu zaoliu is offline
Registered User
 
Name: Zao Liu
Organization: HI5
Project: Performance test
 
Join Date: Mar 2008
Posts: 14
I have attached the code to the message.
Attached Files
File Type: zip ice.zip (34.3 KB, 6 views)
Reply With Quote
  #8 (permalink)  
Old 03-05-2008
zaoliu zaoliu is offline
Registered User
 
Name: Zao Liu
Organization: HI5
Project: Performance test
 
Join Date: Mar 2008
Posts: 14
ICE Version: 3.2.1
Compiler: java 1.5
OS: Linux 2.6.16.46-0.12-smp
Reply With Quote
  #9 (permalink)  
Old 03-05-2008
matthew's Avatar
matthew matthew is offline
ZeroC Staff
 
Name: Matthew Newhook
Organization: ZeroC, Inc.
Project: Internet Communications Engine
 
Join Date: Feb 2003
Location: NL, Canada
Posts: 1,052
The problem is that you are reusing the same AMI response object over & over like so:

Code:
api.AMI_message_sendMessage reply = new impl.AMI_message_sendMessageI(...);
//...
for (int i = 0; i < numbatched; i++) {
  message.sendMessage_async(reply, wrapper);
  addCount();
}
You must not do that as mentioned in the Ice manual (33.3.4):

Quote:
A callback object must not be used for multiple simultaneous invocations. An
application that needs to aggregate information from multiple replies can
create a separate object to which the callback objects delegate.
If you alter your code so that you use a unique callback object per request then things will work as you expect.
Reply With Quote
  #10 (permalink)  
Old 03-06-2008
zaoliu zaoliu is offline
Registered User
 
Name: Zao Liu
Organization: HI5
Project: Performance test
 
Join Date: Mar 2008
Posts: 14
Hi matthew,

Thanks for your feedback. I thought my code is like sequential invocation not simultaneous invocation.

Is this mean every message_async call should create a new callback object?
Reply With Quote
  #11 (permalink)  
Old 03-06-2008
benoit's Avatar
benoit benoit is offline
ZeroC Staff
 
Name: Benoit Foucher
Organization: ZeroC, Inc.
Project: Ice
 
Join Date: Feb 2003
Location: Rennes, France
Posts: 1,534
Hi,

Yes, otherwise the AMI requests are serialized (the AMI request waits for the response of the previous request before being able to reuse the callback object).

Cheers,
Benoit.
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
AMI or not AMI depending on slice args? stepancheg Help Center 2 02-26-2008 04:00 PM
abut ami rellik78 Help Center 3 11-17-2006 01:27 AM
AMI Error billwillman Comments 4 09-28-2006 10:15 PM
hard to use AMI,help me,please nyingchi Help Center 5 09-18-2006 08:02 AM
Help : AMI mykael Help Center 7 06-22-2006 01:23 PM


All times are GMT -4. The time now is 12:51 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0
(c) 2008 ZeroC, Inc.