|
|
|
|||||
|
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? |
|
||||||
|
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 |
|
|||||
|
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. |
|
|||||
|
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 |
|
||||||
|
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();
}
Quote:
|
|
|||||
|
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? |
|
||||||
|
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. |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
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 |