I have a flex application that uses PHP services with the Zend framework.
When I run it locally, the speed is great. My largest query returns data to my datagrid in 2-3 seconds.
When I do run it locally, it is pulling from the production database.
When I move the project to my dedicated server, the same query takes a painful 30 seconds.
When I run the SQL query directly in MYSQL, it is back to around 2 seconds. So the problem is not the query itself.
So, any ideas why the results would take so much longer in my production environment? I purposely purchased dedicated server hosting because I thought it might of been server load. That didn't help. The queries are not complex at all. The most they return is under 200 rows.
In summary: Why would my results set populate so much quicker on my development computer than on the production server?
Flash builder 4
Thank you for any assitance.
Your question seems to be outside of the scope of this forum. But as someone who uses Zend_AMF and PHP for a backend I'll take a whack. Have you analyzed your query, you may discover some inefficiencies there ? This could be a problem if you have many joins, not leading you "WHERE" statement off with the most selective property and so on and so on try basic db optimizations if you haven't already. Are you using an ORM of any kind ? These can add to the time it takes to get results back, especially if you have lazy loading enabled instead of bringing back associated objects with your query and not on the fly. The next step I would check would be for any type of serialization issues that might arise if you are doing so. Even though a database usually isn't considered "large" until it has 10's of millions of rows, joins as I have verified the hardway, when done incorrectly without any type of keys or indexing can be particularly painful.
You may try using AMF-PHP which is a transmits data in binary format and is generally very fast as compared to other ways.