Futurescale, Inc. PureMVC Home

The PureMVC Framework Code at the Speed of Thought


Over 10 years of community discussion and knowledge are maintained here as a read-only archive.

New discussions should be taken up in issues on the appropriate projects at https://github.com/PureMVC

Pages: [1]
Print
Author Topic: Handling server load effeciently  (Read 6472 times)
vineet89
Newbie
*
Posts: 2


View Profile Email
« on: February 11, 2011, 12:37:21 »

Hi I am building a Flex application using Pure MVC pattern and Zend framework for calling php code on the server. I need to sync some data with my server which is using MySQL as the database. And there are 5 such tables I need to sync. So I call these php functions at regular intervals from Flex and use long polling on php side. The client side code for my subjects lies in 5 different proxies. Here are my questions:

Should I send 5 separate requests from each proxy to call the php code which is lying in separate classes. Or should I build a separate proxy to send 1 request from 1 php file and then distribute this data among different proxies on the client side. Which one will be more effecient? Mathematics shows using separate proxies and php classes allow more number of users to be accomodated on the server.

\
Logged
puremvc
Global Moderator
Hero Member
*****
Posts: 2871



View Profile WWW Email
« Reply #1 on: February 12, 2011, 09:44:02 »

While you could make one call for a composite object and then distribute the pieces amongst different proxies on the client, in most cases, it probably makes more sense to make the five separate calls.

When would you want to make one call instead of 5? Perhaps the data changes rapidly on the server and you want a 'snapshot' of the state. If you make one call you could pull it off. If you make 5 calls, the data may have changed between calls, so the integrity of your snapshot is always at risk.

Unless there is some requirement/constraint such as the above, you're probably better off with the 5 proxies / services. It's going to be more maintainable and you'll see a better chance of code reuse.

-=Cliff>
Logged
vineet89
Newbie
*
Posts: 2


View Profile Email
« Reply #2 on: February 12, 2011, 10:06:03 »

Hey Cliff
Thanks for the answer. Making 5 separate calls makes more sense for me.
Logged
Pages: [1]
Print