سؤال

I have a photobook making site and i'm trying to improve loading and saving performance.

The photobook making tool is displayed in a web browser, is done in Flash, and the remote calls for database operations are done through AmfPhp.

The algorithm for saving a photobook basically says:

foreach(page in photobook){
    foreach(component in page){
        //Make a remote call that saves the component in the Database
    }
}

This means that if a photobook has 30 pages, with 10 components(photos) per page, the tool will create approximately 300 simultaneous connections without counting the uploads connections.

Firefox for example, seems to all ready create a queue to process the requests.

Does this affects the performance at all?

Will it help to create a queue that controls the number of simultaneous remote calls?

Is it worth it?

Thank you for any help you can give me.

هل كانت مفيدة؟

المحلول

Every request to remote server will result in time increase for your script execution.

3 queries to database are faster then 3 remote requests.

So yes your performance will be heavily impacted with 300 remote requests.

Best solution is to either paginate, or serialize all of data in XML. Though careful with XML, if too big it will cause performance issue as well.

I think pagination is the best option.

نصائح أخرى

300 simultaneous requests

Yes. Too much.

Only load what you need.
Why are you loading every single picture immediately? Load the first page, and maybe pre-load the second, but you're going further than that you're using up a lot of bandwidth if the person doesn't look any further than the first page.

Further to that, let's assume your photobook allows the user to see a high-resolution version retrieved via javascript. When the use clicks this their request gets added to the bottom of the queue and is not processed until the last of the 300 other requests complete.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top