title: PHP: How does Trivago, Hotelscombined get data faster
body: <p>Hello everyone greetings, I am developing website which is similar to Trivago and Hotelscombined. I am able to get the data from all apis like expedia, skoosh, lateroom, getaroom, venere, hotel pronto. I am stuck at the point where I have to maintain the performance of the website. I want to know how to make the website faster just like <a href="http://www.trivago.com" rel="noreferrer">http://www.trivago.com</a> , <a href="http://hotelscombined.com" rel="noreferrer">http://hotelscombined.com</a>.</p>
  
  <p>How to work with pagination and compare the prices with all apis together.
  If I have a cron job running and saving the data in the database then it would be easier for me to show the prices of all the apis and compare them and it will be faster. But it is the bad idea for me to run the cron job, specially when we are talking about hotels api because the content changes every time for hotels.
  <strong>Problem with the cron is that, there are thousand of cities, how much data should be fetched in the database and how many times because hotels are booked in next 1 hour approx</strong> . If we run the cron job, and suppose hotel was booked which was fetched and saved in the database, in that case how should i manage this. If cron is the answer to the question then how should we fetch 10 to 20 apis data containing hotels description, images etc in the database and manage them because there are over 1 million hotels in the world or may be more than 10 million. Also there are Cases such as: </p>
  
  <p>i) Search for hotel in New York for 2 adults, 1 children from 1st August check in time till 8th August check out time.</p>
  
  <p>ii) Search for hotel in London for 1 adults, 2 children from 2nd August check in time till 5th August check out time.
  And there can be many cases in search. So how many times and for how many cases we should run the cron?</p>
  
  <p>Within the specification of Expedia (<a href="http://developer.ean.com/spec/" rel="noreferrer">http://developer.ean.com/spec/</a>) it is stated that there is a limitations of the number of requests:
   - Hotel List Requests: 5000:1 
   - Room Availability Requests: 500:1</p>
  
  <p>It will be very much helpful for me if I am able to know how to speed up the website.</p>
  
  <p>Thanks in advance</p>