cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: performance question

From: rick vaillancourt <rick_vaillancourt_at_hotmail.com>
Date: Wed, 30 Jan 2002 10:48:01 -0500

http. I didn't set any special "curl_easy_setopt"'s.

    ~~~
This is my need for libcurl.

A multi threaded C++ service makes a call to a known URL (this doesn't
change), the URL string has a couple of replacement parameters for a lookup
(so this changes per execution).

I plan on having a cache of preinit'd CURL*'s to choose from, where I mutex
around grabbing and dropping the handle (passing back one that is not in
use). I then would re-set the curl options before every execution like the
documentation suggests(I may have to add some header info for security and
run https - but I am not yet doing that):

> > curl_easy_setopt(curl, CURLOPT_URL, buffy );
> > curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, writeMemoryCallback);
> > curl_easy_setopt(curl, CURLOPT_FILE, (void *)&chunk);

Does anyone have any advice on squeezing the most performance out of this?
Additional options to set?

Is there any advantage to setting curl_easy_setopt
for CURLOPT_PROXY (would this conflict with the url that has it as part of
the string already?)or set CURLOPT_MAXCONNECTS=1(less to look at per CURL*?)
in this scenario?

url string looks something like this, where the %s gets replaced with search
criteria:

111.111.111.111/cgi-forte/fortecgi?pagename=&serviceName=%s&XMLData=<?xml%%20version=\"1.0\"%%20encoding=\"ISO-8859-1\"?><BLAH%%20ID=\"2\"%%20><PARM>%s</PARM></BLAH>";;

Thanks in advance.

-Rick

>From: "T. Bharath" <TBharath_at_responsenetworks.com>
>To: rick vaillancourt <rick_vaillancourt_at_hotmail.com>,
>curl-library_at_lists.sourceforge.net
>Subject: Re: performance question
>Date: Wed, 30 Jan 2002 00:11:10 -0500
>
>Is this for http or https urls
>
>Regards
>Bharath
>
>rick vaillancourt wrote:
>
> > Hi all-
> >
> > I did a very simple performance test of calling the curl lib serially
>300
> > times in a row with the same URL to measure the difference in reusing
>the
> > same connection v. calling curl_easy_init & curl_easy_cleanup(curl)
>after
> > every execution.
> >
> > To my surprise it seemed to be consistently faster when reinitialized
>every
> > time; on average .17+ secs per call reinitializing every time v. .25+
>secs
> > per call reusing connection.
> >
> > Seems contrary to the doco, anyone experience this?
> >
> > Thanks.
> >
> > -Rick
> >
> > /////////////// code snippet
> >
> > [...]
> > if(reconnectEveryTime){
> > curl = curl_easy_init();
> > }
> > if(curl) {
> > curl_easy_setopt(curl, CURLOPT_URL, buffy );
> > curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, writeMemoryCallback);
> > curl_easy_setopt(curl, CURLOPT_FILE, (void *)&chunk);
> > res = curl_easy_perform(curl);
> >
> > if(reconnectEveryTime){
> > curl_easy_cleanup(curl);
> > }
> > }
> > [...]
> >
> > _________________________________________________________________
> > Join the world’s largest e-mail service with MSN Hotmail.
> > http://www.hotmail.com
>
>

_________________________________________________________________
Chat with friends online, try MSN Messenger: http://messenger.msn.com
Received on 2002-01-30