简体   繁体   English

当我们集成多个酒店API时如何提高应用程序(酒店预订系统)的速度

[英]How to increase the speed of the application (Hotel booking system) when we integreate multiple Hotel APIs

I am working on Hotel booking system. 我正在研究酒店预订系统。 I have to integrate 5 Hotel APIs to get the Hotels. 我必须集成5个酒店API才能获得酒店。 I have seen few application which are having multiple APIs. 我看到很少有具有多个API的应用程序。 These applications has the process as 这些应用程序的流程如下

1 Running the hotel availability requests(one by one) 1运行酒店可用性请求(一个接一个)

  1. Parsing the xml response and inset the details into database 解析xml响应并将详细信息插入数据库

  2. Showing the twenty to thirty hotels per page(We can see other hotels with the help of pagination) 每页显示20至30家酒店(通过分页可以查看其他酒店)

But these projects are very very slow. 但是这些项目非常缓慢。 These applications are taking 1.30-3 minutes to display the hotels 这些应用程序需要1.30-3分钟来显示酒店

I have two rough ideas. 我有两个粗略的想法。

1) I will run one API(Which is very faster among my API) and show the result first, and then i will run other APIs. 1)我将运行一个API(在我的API中速度更快)并首先显示结果,然后再运行其他API。 In this case i should update the pagination (But i dont know properly how to implement this). 在这种情况下,我应该更新分页(但是我不正确地知道如何实现这一点)。

2) I may increase the speed with multi treading (cURL is supporting multi treading). 2)我可能会通过多重踩踏来提高速度(cURL支持多重踩踏)。

Please suggest ideas to increase the speed of my application. 请提出建议以提高我的申请速度。

Technologies i am using: PHP, Mysql, cURL/SOAP, Simple XML Parsing(In steed of DOM Parsing) 我正在使用的技术:PHP,Mysql,cURL / SOAP,简单XML解析(在DOM解析的指导下)

Is your webserver requesting xml data from the hotel APIs & parsing the response on every browser request? 您的网络服务器是否正在从酒店API请求xml数据并解析每个浏览器请求的响应? If so then this sounds very inefficient - I would have made a background process set to repeat every 5 minutes or so to fetch, parse & store the data in the database, then your webserver can simply present this data from the database instead of from the external services. 如果是这样的话,这听起来效率很低-我将后台进程设置为每5分钟左右重复一次,以获取,解析和存储数据库中的数据,那么您的网络服务器可以简单地从数据库而不是从数据库中呈现此数据。外部服务。

Install XDebug on your test environment, and use the profiler to see where the bottlenecks are. 在测试环境上安装XDebug ,然后使用探查器查看瓶颈所在。 There is a nice add-on called KCachegrind that show exactly where your CPU cycles are wasted. 有一个名为KCachegrind的不错的加载项, 可以准确显示浪费的CPU周期。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM