oracle765 Posted February 9, 2019 Share Posted February 9, 2019 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 Quote Link to comment Share on other sites More sharing options...
gw1500se Posted February 9, 2019 Share Posted February 9, 2019 A. Yes B. No way to know without seeing some code. Quote Link to comment Share on other sites More sharing options...
ginerjm Posted February 9, 2019 Share Posted February 9, 2019 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. Quote Link to comment Share on other sites More sharing options...
oracle765 Posted February 9, 2019 Author Share Posted February 9, 2019 hi yes ginergem All travel agents provide the same url structure from the same api provider and take around the same time to return Quote Link to comment Share on other sites More sharing options...
ginerjm Posted February 9, 2019 Share Posted February 9, 2019 And if that is the sum total of your perceived slowness what do you expect to do about it with your own code? Quote Link to comment Share on other sites More sharing options...
oracle765 Posted February 9, 2019 Author Share Posted February 9, 2019 hi ginerjm I dont know what you mean by that many thanks Quote Link to comment Share on other sites More sharing options...
ginerjm Posted February 10, 2019 Share Posted February 10, 2019 Which part don't you understand? "sum total"? "slowness"? "your own code"? Quote Link to comment Share on other sites More sharing options...
gw1500se Posted February 10, 2019 Share Posted February 10, 2019 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. 1 Quote Link to comment Share on other sites More sharing options...
ginerjm Posted February 10, 2019 Share Posted February 10, 2019 Which is what I meant by my own conclusion. Quote Link to comment Share on other sites More sharing options...
Barand Posted February 10, 2019 Share Posted February 10, 2019 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. Quote Link to comment Share on other sites More sharing options...
oracle765 Posted February 11, 2019 Author Share Posted February 11, 2019 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 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.