Pablius
Pablius

Reputation: 420

CURL performance issues when source has a long processing time

I'm using CURL to get some information from a remote server, it takes in average 15 to 20 seconds for the remote server to generate the response, and then it's about 5MB to 10MB.

The problem is that CURL takes forever to retrieve the response.

Is there any way to improve CURL performance?

Right now the solution that I've found is to have the server return a new URL to a static generated file, and then download that file. I'd like to be able to do it in only one request.

Upvotes: 0

Views: 1209

Answers (2)

Ryan Doherty
Ryan Doherty

Reputation: 38740

You have a few options:

  1. Download the file via CURL via a cron job and store it locally. That way it doesn't matter how long it takes.
  2. If the server can return a new URL to the statically generated content, use it. Probably via a Location: header, which will tell your script where to fetch it from.
  3. Speed up the remote server somehow

Upvotes: 2

Aleksey Korzun
Aleksey Korzun

Reputation: 680

What? You are saying that server takes 15-20 seconds to generate response and Curl is taking a lot time?

I don't want to blow your mind, but if you get that server to reply faster Curl will retrieve response faster.

Upvotes: 0

Related Questions