cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: PHP/cURL: intensive calls send exception without caching connection resource

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Sun, 29 Dec 2013 21:45:11 +0100 (CET)

On Sun, 29 Dec 2013, Stéphane HULARD wrote:

> The last week, I’ve faced a problem which has not really been encountered by
> the community (stack overflow, github issues or different resources).

Let me first just mention that our bug tracker is on Sourceforge, stack
overflow and github issues would not be places with any official affiliation
with the curl project. Just be aware when reading advice or answers you find
out there in the wild.

> In our application we made an insane number of HTTP requests to manipulate
> data (about 500 to 10000 requests/seconds). Before the last week, we use a
> server which is not really powerful so our requests are not too fast but now
> our application is deployed on a powerful server and we faced connection
> problems.

So if the "500 to 1000 requests/seconds" speed is the slow one, how fast is
the fast speed? Are you talking only HTTP or HTTPS as well? Are you
communicating with one, a few or millions of servers?

> I see the error (our elastic search server is 127.0.0.1:9200): Failed to
> connect to 127.0.0.1: Cannot assign requested address

How many simultaneous transfers do you have? How many file descriptors do
you allow for each process?

> After some research, I’ve found that we see this error when we have saturate
> connection possibilities of our server.

What does "saturate" mean more specifically? I assume "our server" is actually
your term for the client that uses libcurl?

> I’ve found too that to prevent this error we should reuse our cURL resource
> and then it disappear…

When using libcurl, you should always re-use handles as much as possible for
many reasons. Performance is one.

-- 
  / daniel.haxx.se

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2013-12-29