PHP: like Trivago, Hotelscombined get data faster

Hello everyone, I’m developing a site similar to Trivago and Hotelscombined. I can get data from all apis like expedia, skoosh, lateroom, getaroom, venere, hotel pronto. I am stuck at the point where I need to maintain website performance. I want to know how to make a site faster like http://www.trivago.com , http://hotelscombined.com .

How to work with pagination and compare prices with all apis together. If I run a cron job and save the data in the database, it would be easier for me to show prices for all apis and compare them, and it will be faster. But it’s a bad idea for me to start cron, especially when we talk about api hotels, because the content changes every time for hotels. The problem with cron is that there are a thousand cities, how much data you need to get in the database and how many times, because hotels are booked in the next 1 hour . If we run cron, and suppose that the hotel has been booked, which has been selected and stored in the database, in this case, how do I do this. If cron is the answer to the question, then how should we display from 10 to 20 apis data containing a description of hotels, images, etc. In the database, and manage them, because in the world there are more than 1 million hotels or may amount to more than 10 million. There are also cases such as:

i) Search for a hotel in New York for 2 adults and 1 children from August 1, to check the time until August 8.

ii) Look for a hotel in London for 1 adult, 2 children from August 2, to check the time until August 5. And there may be many cases in the search. So, how many times and how many cases should we run cron?

The Expedia specification ( http://developer.ean.com/spec/ ) states that there is a limit on the number of requests: - List of rooms: 5000: 1 - Requests for room availability: 500: 1

It will be very useful for me if I can learn how to speed up the site.

Thanks in advance

+7
api php cron
source share
2 answers

I think you answered your question. Cron jobs and caching to a local database sound like a good idea to me. Just set cron to a similar interval, which varies on different hotel sites. If performance is critical, it may have a cache database on its own server.

+4
source share

Amook, try using curl_multi. This is a great way to handle multiple HTTP requests in parallel in PHP. curl_multi is especially useful when working with large data sets (for example, extracting thousands of RSS feeds at a time) http://www.onlineaspect.com/2009/01/26/how-to-use-curl_multi-without-blocking/

+1
source share

All Articles