-1

I have a php file that previously used to write xml data with tags. Now I'm trying to make it a little remoteobject based. So instead of writing xml I'm trying to return a class object that consists some big multidimensional array. The problem is it is causing a high latency. I'm not sure if it's my php file that is causing latency problem.

My php code :

    class output{
    public $grid;
    public $week;
    public $name;
    var $_explicitType = "org.test.output";
    }

    class manager1{


    function init($params,$arrayOut)
    {   


        $action = $params[0];
        switch ($action)
        {
            case "reload":  return $this->Reload($arrayOut);break; 

            default:return $this->form($arrayOut); 
        }


    }

    private function Reload($arrayOut)
    {

        $this->getSlice();
        $arrayOut->grid = $this->gridValue();
        $arrayOut->week = 'no data';    
        return $arrayOut;       

    }

    private function form($arrayOut)
    {



        $arrayOut->grid = $this->gridValue();
        $arrayOut->week= $this->getAllWeek($this->ThisYear);
        return $arrayOut;


    }
}

AS-3 code calling php function:

    private function init():void{

        var _amf:RemoteObject = new RemoteObject();
     var params:Array = new Array(); //parameters array
     params.push("default");
     var arrayOut:output = new output();//strongly typed class
     _amf.destination = "dummyDestination";
     _amf.endpoint = "http://insight2.ultralysis.com/Amfhp/Amfphp/"; //amfphp home directory
     _amf.source = "manager1"; //the php class which will be called
     _amf.addEventListener(ResultEvent.Result, handleResult);
     _amf.init(params,arrayOut);
}

    private function handleResult(event:ResultEvent):void
        {
    datagrid.dataProvider = event.result.grid;
        }

And there is also a class named output in my application:

 package org.test{
                public class output
                  {
                     public var grid:Array;
                     public var week:Array;
                  }
 }

I'm using this to pass value to flex remoteobject using amfphp.

halfer
  • 19,824
  • 17
  • 99
  • 186
  • 1
    In my experience php never does very good with large arrays of data. In order to find the bottle neck. I'd suggest putting microtime() variables before and after function calls so you can find where the letency is coming from. Also I'm not sure you gave us enough information to give you a good answer. Can you show us how these classes are being used? – Ian Overton Nov 01 '12 at 12:53
  • thanks for the reply lan Overton. Well i'm using it like a stronglytyped class in flex. the user code goes here: – Anas Bin Numan Nov 02 '12 at 11:30
  • Have you tried to disable unused plugins from Amfphp? – Marco Aurélio Deleu Mar 04 '13 at 18:25

1 Answers1

1

Actually, it's fairly easy to figure out. You can use the Network Monitor that is part of Flash Builder. It shows the Request Time and the Response Time, so you can get a pretty good idea if the issue is with the PHP side or the Flex side. You can also see the size of the response.

Be aware that Remote Objects mixed with Multidimentional arrays can be larger than you think, but again the Network Monitor will help you figure out that.

Arturo Alvarado
  • 498
  • 1
  • 5
  • 10
  • Well i've managed to calculate request and response time. And it show's that request time is about 10ms. Response time is about 2-3 seconds. But the response start time is 6 to 7 seconds after the request end time. – Anas Bin Numan Nov 04 '12 at 16:34