Jump to content

Slow running php program

Recommended Posts

Hi Guys

We have had a holiday program written in php in the past by an experienced developer but we are experiencing problems now.   So I am curious to try and resolve the best approach

Here goes

1:  We query multiple APIs to return holiday results to our users

2:  This can take up to 20 seconds to return results but sometimes its much quicker depending on the volume of API returned results

3:  Other users seem to be locked out of even visiting our website if an API call is running

So initially without posting any code, I have a couple of questions which are

A:  Is there a way to maybe poll a process or allow partial results to the users browser while things run in the background ( similar to what other holiday providers seem to be doing )

B:  Is there a way to speed this up or maybe some sort of better technology to utilise


Many thanks professionals

Link to post
Share on other sites

Have you done any research on how long it takes for each API to return a result?  That's the first thing I would do - determine where the drag is. 

If you find that one or more of your api's is the cause then you need to pursue with them why it takes so long.

Link to post
Share on other sites

What he means is that if the the perceived slowness is caused by the provider's server, over which you have no control, there is nothing you can do in your code to change that. Well, I take that back. There is one thing you can do. Download the provider's database into your own in background and use your own database to do the queries.

  • Like 1
Link to post
Share on other sites

If you have 5 API calls each taking 4 seconds then the total is 20 seconds if you call them in series.

One thing you might want to experiment with is kicking off an AJAX request for each API call, to see if they execute in parallel, and then consolidating the returned results.

Link to post
Share on other sites

ok thanks Barand


I will look into this, as you are probably already aware they are in an ini file which sets them to active or none active for each holiday provider, and if i keep adding them it keeps getting slower


I will look into this ajax call to see if i can run in parallel


many thanks

Link to post
Share on other sites
This thread is more than a year old.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.