3 Replies Latest reply on Jun 11, 2013 10:34 AM by jfb00

    Multithread

    jfb00 Level 3

      Hi all,

      I saw this article today without a date, maybe from 2012.

      http://www.bytearray.org/?p=4423

      Does anyone using this feature?

      Does anybody has a simple example using multithread?

      I have a form that makes a 10 different calls to the database using remote object and it is taking a lot of time to load because the amount of data to process.

      I would like to make multiple calls at the same time.

      Any help will be appreciate.

      Thanks

        • 1. Re: Multithread
          jfb00 Level 3

          I found an interesting link:

          http://cookbooks.adobe.com/post_Performance_tip__Use_multiple_duplicated_remote_ob-10663.h tml

          I was reading and remote object has a property "concurrency" that for default is set to multiple calls at the same time, am i correct? or this mean something different?

           

          My original code is:

          <fx:Declarations>

                  <s:RemoteObject id="SM_RO" destination="ColdFusion" source="myApp.cfcs.myCFC" showBusyCursor="true" >

                      <s:method name="getProcessA" result="getProcessA_Handler(event)" fault="error_Handler(event)"/>

                      <s:method name="getProcessB" result="getProcessB_Handler(event)" fault="error_Handler(event)"/>

                      <s:method name="getProcessC" result="getProcessC_Handler(event)" fault="error_Handler(event)"/>

                  </s:RemoteObject>

          </fx:Declarations>

          When I do the calls as:

          SM_RO.getProcessA(); result = 21 seconds

          SM_RO.getProcessB(); result = 23 seconds

          SM_RO.getProcessC(); result = 24 seconds

          In the handlers I am doing just a trace on the time. They show in the same sequence even if i switch to call the processB first.

           

          According to the link, my new code should run faster:

          <fx:Declarations>

                  <s:RemoteObject id="SM_RO_A" destination="ColdFusion" source="myApp.cfcs.myCFC" showBusyCursor="true" >

                      <s:method name="getProcessA" result="getProcessA_Handler(event)" fault="error_Handler(event)"/>

                  </s:RemoteObject>

                  <s:RemoteObject id="SM_RO_B" destination="ColdFusion" source="myApp.cfcs.myCFC" showBusyCursor="true" >

                      <s:method name="getProcessB" result="getProcessB_Handler(event)" fault="error_Handler(event)"/>

                  </s:RemoteObject>

                  <s:RemoteObject id="SM_RO_C" destination="ColdFusion" source="myApp.cfcs.myCFC" showBusyCursor="true" >

                      <s:method name="getProcessC" result="getProcessC_Handler(event)" fault="error_Handler(event)"/>

                  </s:RemoteObject>

              </fx:Declarations>

          The results:

          SM_RO_A.getProcessA(); result = 24 seconds

          SM_RO_B.getProcessB(); result = 24 seconds

          SM_RO_C.getProcessC(); result = 24 seconds

           

          I run the app at least 5 times and I am getting the same result.

          Does anybody experience with this?

          What am i doing wrong? Do I need to declare and run the code as action script to get better results?

          Thanks

          • 2. Re: Multithread
            jfb00 Level 3

            More results:

            Replacing s:RemoteObject with mx:RemoteObject the call drops 5 seconds.

            In the remoteobjects I specifed concurrency="multiple", but still the same time.

            If i add couple more calls or methods, the return is by 3 but the time is not reduce, time is added to this extra calls.

            It is another way to make multi thread calls of the remote objects?

            • 3. Re: Multithread
              jfb00 Level 3

              I found this from Alex site:

              http://blogs.adobe.com/aharui/2008/01/threads_in_actionscript_3.html

              It is a way to use this class to make separate calls of the remote object at the same time?

              Best,