duanrui3480 2015-07-10 16:53
浏览 39

PHP奇怪的事情发生了卷曲

I have a project that needs to fetch data from an XML API, I'm using php's cUrl to get the data from the API. Now the data download is as follows

  • 1 request to fetch data, 123kb file
  • 1 request to get data specific info 600 bytes file
  • 1..10 request to get images (max 170kb files)

In that order and nested from bottom to top, the data obtained is a school, an activity calendar and an image gallery

So you see, there are 12 curl request top

I have debugged my application logic, and the delay once the data is on memory to perform the operations is 3 secs.

The timing obtained by curl_getinfo is as follows

{  
   "url":"the url",
   "content_type":"text\/xml; charset=iso-8859-1",
   "http_code":200,
   "header_size":222,
   "request_size":600,
   "filetime":-1,
   "ssl_verify_result":0,
   "redirect_count":0,
   "total_time":0.942642,
   "namelookup_time":8.4e-5,
   "connect_time":0.179581,
   "pretransfer_time":0.17966,
   "size_upload":326,
   "size_download":12720,
   "speed_download":13493,
   "speed_upload":345,
   "download_content_length":-1,
   "upload_content_length":326,
   "starttransfer_time":0.576183,
   "redirect_time":0,
   "redirect_url":"",
   "primary_ip":"81.93.213.42",
   "certinfo":[  

   ],
   "primary_port":80,
   "local_ip":"192.169.233.75",
   "local_port":43479
}

This data is encoded as json, because it will be putted on a log server.

So my question is why if curl takes 1s to get the response from the API and my logic is executed between 2 and 3 seconds the response has a time of 1 min, where are the next 50s???

One thing to notice is that my website runs on godaddy, a VPS under https and the api runs on HTTP, does this has anything to do?

Thanks in advance

  • 写回答

1条回答 默认 最新

  • doujieluo5875 2015-07-10 20:18
    关注

    Resolved, the server was delaying the download of the data for the curl requests, so I spoke to the hosting provider and removed the delay for downloads. So the curl requests were delayed by the server, not the code or the curl handle itself. Thanks to all comments.

    评论

报告相同问题?

悬赏问题

  • ¥15 微信小程序协议怎么写
  • ¥15 c语言怎么用printf(“\b \b”)与getch()实现黑框里写入与删除?
  • ¥20 怎么用dlib库的算法识别小麦病虫害
  • ¥15 华为ensp模拟器中S5700交换机在配置过程中老是反复重启
  • ¥15 java写代码遇到问题,求帮助
  • ¥15 uniapp uview http 如何实现统一的请求异常信息提示?
  • ¥15 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看