views:

31

answers:

1

I think this is just a matter of fine tuning some different elements, but I'd like to know your take. I've got a Flex app, using the Flex 4 data services, communicating with Zend AMF services. One of the services returns all the results in a database using SELECT * FROM table there are ~1200 rows (140KB package size).

My problem is the response time, it's rage inducing. Total duration is always between 7-8 seconds. All but about 150ms of that is latency. I broke up the PHP to figure out exactly where the latency was and turns out return $rows is eating up ~6.8sec latency. I can deal with 1-2sec, but when I start waiting around for 8sec I feel kinda dumb. I cross checked the query response speed directly from the database, and just like I was expecting the total query time is 45-60ms.

PHP, this is basically just the generated Flex data service code, although in production it isn't the same:

public function getAllProject_entries() {

        $stmt = mysqli_prepare($this->connection, "SELECT u.*
                                                   FROM $this->tablename u");       
        $this->throwExceptionOnError();

        mysqli_stmt_execute($stmt);
        $this->throwExceptionOnError();

        $rows = array();

        mysqli_stmt_bind_result($stmt, $row->id, $row->field1, $row->field2, $row->field3, $row->field4, $row->field5, $row->field6, $row->field7, $row->field8, $row->field9, $row->field10, $row->field11, $row->field12, $row->field13, $row->field14, $row->field15, $row->field16, $row->field17, $row->field18, $row->field19);

        while (mysqli_stmt_fetch($stmt)) {
          $rows[] = $row;
          $row = new stdClass();
          mysqli_stmt_bind_result($stmt, $row->id, $row->field1, $row->field2, $row->field3, $row->field4, $row->field5, $row->field6, $row->field7, $row->field8, $row->field9, $row->field10, $row->field11, $row->field12, $row->field13, $row->field14, $row->field15, $row->field16, $row->field17, $row->field18, $row->field19);
        }

        mysqli_stmt_free_result($stmt);
        mysqli_close($this->connection);

        return $rows;
    }

Do you need to see the Flex code? I'm not exactly sure what to show...

Is there something I'm entirely missing?

A: 

As I understood your AMF back-end returning slowly responses to your RIA front-end, so might be you will try to use AMFPHP instead? as more lightweight solution.

Eugene
Well that would just be way too obvious. I may give it a shot, I'll definitely collect some metrics to see what the framework overhead is.
Noah Smith