Hi, all my friends, I am new to flex, now face a problem.
In my server side, we have a method importMethod, which take up to 4s to finish. And on the flex client, we can select multiple objects to acquire, so I loops them:
for(var i:int=0; i < objToDo.length; i++)
var responder:IResponder = new MyResponder(operationSuccess, handleFault,DataEvent.ACQUIRE_DATA,region);
var invokeService:AsyncToken = (dataAcquisitionService as AbstractService).importMethod(manualAcquisitionDTO);
Because the call is Async, I assume all these calls can be executed by different threads on the server （because different http request）, so I can get better performance because they will be executed on server by multi-threads concurrently.
But the result shows most of the calls are executed in sequence, the reason is the flex client auto combine most (if not all) request into one http request and sent to server, so the server side only one thread is servicing these requests. Then if I choose 4 objects on the client side, it takes 4*4 = 16s to finish.
I can understand that flex client do this to reduce the network traffic, but I also think this should be configurable by developer, but I can't find a place to do it. The way I can do is to setup multiple AMF endpoint and channel, assign them when client side submit the request, but that is very stupid, I hope there is a way to configure this.
BTW: I use flex 4 and blazeDS 4
Thanks a lot ！
There could be a few problems here. The first being that Flex is limited to the number or remote calls it can have open at any time , this is done by the browser. Any more than that limit and calls get run over and faulted depending on your remote object concurrency settings. The second point is whether or not your service is stateless , if it has state , you will probably have to handle the server-side threading yourself.
But there are some good news. You can create multiple remote objects and use those instead of just one. Here is a link
If this post was helpful please mark it as such.
Thanks, I try to follow the way as the link you post, and find out if I create a new channel each time, the http request won't be combined, so it solve my problem.
BTW: a general reminder is: create a new remoteObject but share the channel won't help in this case