Jump to content
oracle765

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

Share this post


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.

Share this post


Link to post
Share on other sites

hi yes ginergem

 

All travel agents provide the same url structure from the same api provider and take around the same time to return

 

 

Share this post


Link to post
Share on other sites

And if that is the sum total of your perceived slowness what do you expect to do about it with your own code?

Share this post


Link to post
Share on other sites

Which part don't you understand?  "sum total"?  "slowness"?  "your own code"?

Share this post


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

Share this post


Link to post
Share on other sites

Which is what I meant by my own conclusion.

Share this post


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.

Share this post


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

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×

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.