2 Replies Latest reply on Jul 22, 2010 8:12 AM by chinata79

    How to force the flex client requests use different http request

    chinata79

      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);
                      invokeService.addResponder(responder);   
                  }

      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 !