[squid-dev] [PREVIEW] Free AccessLogEntry::url when needed

Nathan Hoad nathan at getoffmalawn.com
Mon Mar 21 04:59:56 UTC 2016


Hello,

Attached is a patch with the suggested changes by Amos.

Amos, thank you for taking the time to look at this.

Thank you,

Nathan.

On 19 March 2016 at 19:34, Amos Jeffries <squid3 at treenet.co.nz> wrote:
> On 15/03/2016 12:33 p.m., Nathan Hoad wrote:
>> Hello,
>>
>> Attached is a first attempt at converting the AccessLogEntry::url
>> member to an SBuf. It's definitely resulted in more data copies - just
>> about all sources are still char *.
>>
>> I'm not sure how I can actually avoid those, aside from converting
>> them to SBuf as well, which would mean modifying HTCP and ICP logging,
>> and ClientSideRequest::log_uri. I can take a crack at
>> ClientSideRequest::log_uri if people are interested, but I'm not in a
>> position to test any changes made to HTCP and ICP logging.
>
>
> in format/Format.cc:
>
> * avoid c_str() like below. Which still copies, but avoids also
> reallocating the ALE url field:
>
>  if (!al->url.isEmpty()) {
>   const SBuf &s = al->url;
>   sb.append(s.rawContent(), s.length());
>   out = sb.termedBuf();
>  }
>
>
> in src/log/FormatHttpdCombined.cc:
>
> * in printf()-like statements we have the SQUIDSBUFPH and
> SQUIDSBUFPRINT(x) macros which output an SBuf efficiently as can be done.
>  - same for all the other printf-like calls.
>
>
> in src/log/access_log.cc:
>
> * Its worth adding a global "SBuf Dash" to the Format namespace and
> using Format::Dash instead of dash_str to set the new SBuf member.
>
>
> in src/log/FormatSquidReferer.cc
>
> * use a "const SBuf s = ..." local variable which has the if-logic
> applied to it separately to assign the Format::Dash then the local is
> passed to the printf() call.
>
> Amos
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: AccessLogEntry-url-to-SBuf-v2.patch
Type: text/x-patch
Size: 6535 bytes
Desc: not available
URL: <http://lists.squid-cache.org/pipermail/squid-dev/attachments/20160321/dcbe06d9/attachment.bin>


More information about the squid-dev mailing list