You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by "Alin Vasile (Created) (JIRA)" <ji...@apache.org> on 2011/10/13 15:50:12 UTC

[jira] [Created] (HTTPCLIENT-1137) The values for the Via header are created by httpclient-cache for each cached and backend request

The values for the Via header are created by httpclient-cache for each cached and backend request
-------------------------------------------------------------------------------------------------

                 Key: HTTPCLIENT-1137
                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1137
             Project: HttpComponents HttpClient
          Issue Type: Improvement
          Components: Cache
    Affects Versions: 4.1.2
            Reporter: Alin Vasile
            Priority: Trivial


The Via header that gets generated and inserted by the caching layer is adobe repeatable in the HTTP conversation, even if the constructed string is constant for each protocol version that is involved.

The proposed patch constructs a map of generated values held in memory with the associated ProtocolVersion as a key and uses read/write locks to access the data. This  solution minimizes the time to generate such a value from several milliseconds to 40-50 microseconds.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


Re: [jira] [Created] (HTTPCLIENT-1137) The values for the Via header are created by httpclient-cache for each cached and backend request

Posted by Vasile Alin <al...@gmail.com>.
Sorry, I meant "is done repeatedly". My spell-checker mixed up the
text and I didn't reviewed it properly.


On 13 October 2011 16:55, sebb <se...@gmail.com> wrote:
> On 13 October 2011 14:50, Alin Vasile (Created) (JIRA) <ji...@apache.org> wrote:
>> The values for the Via header are created by httpclient-cache for each cached and backend request
>> -------------------------------------------------------------------------------------------------
>>
>>                 Key: HTTPCLIENT-1137
>>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1137
>>             Project: HttpComponents HttpClient
>>          Issue Type: Improvement
>>          Components: Cache
>>    Affects Versions: 4.1.2
>>            Reporter: Alin Vasile
>>            Priority: Trivial
>>
>>
>> The Via header that gets generated and inserted by the caching layer is adobe repeatable in the HTTP conversation, even if the constructed string is constant for each protocol version that is involved.
>>
>
> What does "adobe repeatable" mean?
>
> Perhaps edit the the issue to clarify - thanks.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
> For additional commands, e-mail: dev-help@hc.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


Re: [jira] [Created] (HTTPCLIENT-1137) The values for the Via header are created by httpclient-cache for each cached and backend request

Posted by sebb <se...@gmail.com>.
On 13 October 2011 14:50, Alin Vasile (Created) (JIRA) <ji...@apache.org> wrote:
> The values for the Via header are created by httpclient-cache for each cached and backend request
> -------------------------------------------------------------------------------------------------
>
>                 Key: HTTPCLIENT-1137
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1137
>             Project: HttpComponents HttpClient
>          Issue Type: Improvement
>          Components: Cache
>    Affects Versions: 4.1.2
>            Reporter: Alin Vasile
>            Priority: Trivial
>
>
> The Via header that gets generated and inserted by the caching layer is adobe repeatable in the HTTP conversation, even if the constructed string is constant for each protocol version that is involved.
>

What does "adobe repeatable" mean?

Perhaps edit the the issue to clarify - thanks.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[jira] [Updated] (HTTPCLIENT-1137) The values for the Via header are created by httpclient-cache for each cached and backend request

Posted by "Alin Vasile (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HTTPCLIENT-1137?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Alin Vasile updated HTTPCLIENT-1137:
------------------------------------

    Description: 
The Via header that gets generated and inserted by the caching layer is done repeatedly in the HTTP conversation, even if the constructed string is constant for each protocol version that is involved.

The proposed patch constructs a map of generated values held in memory with the associated ProtocolVersion as a key and uses read/write locks to access the data. This  solution minimizes the time to generate such a value from several milliseconds to 40-50 microseconds.

  was:
The Via header that gets generated and inserted by the caching layer is adobe repeatable in the HTTP conversation, even if the constructed string is constant for each protocol version that is involved.

The proposed patch constructs a map of generated values held in memory with the associated ProtocolVersion as a key and uses read/write locks to access the data. This  solution minimizes the time to generate such a value from several milliseconds to 40-50 microseconds.

    
> The values for the Via header are created by httpclient-cache for each cached and backend request
> -------------------------------------------------------------------------------------------------
>
>                 Key: HTTPCLIENT-1137
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1137
>             Project: HttpComponents HttpClient
>          Issue Type: Improvement
>          Components: Cache
>    Affects Versions: 4.1.2
>            Reporter: Alin Vasile
>            Priority: Trivial
>         Attachments: cached_via_header_vals.patch
>
>
> The Via header that gets generated and inserted by the caching layer is done repeatedly in the HTTP conversation, even if the constructed string is constant for each protocol version that is involved.
> The proposed patch constructs a map of generated values held in memory with the associated ProtocolVersion as a key and uses read/write locks to access the data. This  solution minimizes the time to generate such a value from several milliseconds to 40-50 microseconds.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[jira] [Resolved] (HTTPCLIENT-1137) The values for the Via header are created by httpclient-cache for each cached and backend request

Posted by "Jon Moore (Resolved) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HTTPCLIENT-1137?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jon Moore resolved HTTPCLIENT-1137.
-----------------------------------

    Resolution: Fixed
      Assignee: Jon Moore
    
> The values for the Via header are created by httpclient-cache for each cached and backend request
> -------------------------------------------------------------------------------------------------
>
>                 Key: HTTPCLIENT-1137
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1137
>             Project: HttpComponents HttpClient
>          Issue Type: Improvement
>          Components: Cache
>    Affects Versions: 4.1.2
>            Reporter: Alin Vasile
>            Assignee: Jon Moore
>            Priority: Trivial
>             Fix For: 4.2 Alpha2
>
>         Attachments: cached_via_header_vals.patch, via_header_hashmap.patch
>
>
> The Via header that gets generated and inserted by the caching layer is done repeatedly in the HTTP conversation, even if the constructed string is constant for each protocol version that is involved.
> The proposed patch constructs a map of generated values held in memory with the associated ProtocolVersion as a key and uses read/write locks to access the data. This  solution minimizes the time to generate such a value from several milliseconds to 40-50 microseconds.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[jira] [Commented] (HTTPCLIENT-1137) The values for the Via header are created by httpclient-cache for each cached and backend request

Posted by "Jon Moore (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HTTPCLIENT-1137?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13144255#comment-13144255 ] 

Jon Moore commented on HTTPCLIENT-1137:
---------------------------------------

Ok, patch checked in. Thanks much, Alin!


                
> The values for the Via header are created by httpclient-cache for each cached and backend request
> -------------------------------------------------------------------------------------------------
>
>                 Key: HTTPCLIENT-1137
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1137
>             Project: HttpComponents HttpClient
>          Issue Type: Improvement
>          Components: Cache
>    Affects Versions: 4.1.2
>            Reporter: Alin Vasile
>            Priority: Trivial
>             Fix For: 4.2 Alpha2
>
>         Attachments: cached_via_header_vals.patch, via_header_hashmap.patch
>
>
> The Via header that gets generated and inserted by the caching layer is done repeatedly in the HTTP conversation, even if the constructed string is constant for each protocol version that is involved.
> The proposed patch constructs a map of generated values held in memory with the associated ProtocolVersion as a key and uses read/write locks to access the data. This  solution minimizes the time to generate such a value from several milliseconds to 40-50 microseconds.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[jira] [Updated] (HTTPCLIENT-1137) The values for the Via header are created by httpclient-cache for each cached and backend request

Posted by "Alin Vasile (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HTTPCLIENT-1137?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Alin Vasile updated HTTPCLIENT-1137:
------------------------------------

    Attachment: cached_via_header_vals.patch
    
> The values for the Via header are created by httpclient-cache for each cached and backend request
> -------------------------------------------------------------------------------------------------
>
>                 Key: HTTPCLIENT-1137
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1137
>             Project: HttpComponents HttpClient
>          Issue Type: Improvement
>          Components: Cache
>    Affects Versions: 4.1.2
>            Reporter: Alin Vasile
>            Priority: Trivial
>         Attachments: cached_via_header_vals.patch
>
>
> The Via header that gets generated and inserted by the caching layer is adobe repeatable in the HTTP conversation, even if the constructed string is constant for each protocol version that is involved.
> The proposed patch constructs a map of generated values held in memory with the associated ProtocolVersion as a key and uses read/write locks to access the data. This  solution minimizes the time to generate such a value from several milliseconds to 40-50 microseconds.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[jira] [Commented] (HTTPCLIENT-1137) The values for the Via header are created by httpclient-cache for each cached and backend request

Posted by "Alin Vasile (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HTTPCLIENT-1137?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13142500#comment-13142500 ] 

Alin Vasile commented on HTTPCLIENT-1137:
-----------------------------------------

Hi Jon,

   Thanks for reviewing my patch.

   I wanted to keep the request operations thread safe, but if you think race conditions are not a problem, I can use a simple map (my initial solution was a simple HashMap, as you suggest). Do you think a ConcurrentHashMap would be more appropriate, so we don't have stale string values? (I'm thinking that a different thread might see an incomplete Via value in this map if we use a simple HashMap).


Alin
                
> The values for the Via header are created by httpclient-cache for each cached and backend request
> -------------------------------------------------------------------------------------------------
>
>                 Key: HTTPCLIENT-1137
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1137
>             Project: HttpComponents HttpClient
>          Issue Type: Improvement
>          Components: Cache
>    Affects Versions: 4.1.2
>            Reporter: Alin Vasile
>            Priority: Trivial
>             Fix For: 4.2 Alpha2
>
>         Attachments: cached_via_header_vals.patch
>
>
> The Via header that gets generated and inserted by the caching layer is done repeatedly in the HTTP conversation, even if the constructed string is constant for each protocol version that is involved.
> The proposed patch constructs a map of generated values held in memory with the associated ProtocolVersion as a key and uses read/write locks to access the data. This  solution minimizes the time to generate such a value from several milliseconds to 40-50 microseconds.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[jira] [Updated] (HTTPCLIENT-1137) The values for the Via header are created by httpclient-cache for each cached and backend request

Posted by "Alin Vasile (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HTTPCLIENT-1137?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Alin Vasile updated HTTPCLIENT-1137:
------------------------------------

    Attachment: via_header_hashmap.patch

Patch modified according to Jon's comments to use a simple HashMap.
                
> The values for the Via header are created by httpclient-cache for each cached and backend request
> -------------------------------------------------------------------------------------------------
>
>                 Key: HTTPCLIENT-1137
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1137
>             Project: HttpComponents HttpClient
>          Issue Type: Improvement
>          Components: Cache
>    Affects Versions: 4.1.2
>            Reporter: Alin Vasile
>            Priority: Trivial
>             Fix For: 4.2 Alpha2
>
>         Attachments: cached_via_header_vals.patch, via_header_hashmap.patch
>
>
> The Via header that gets generated and inserted by the caching layer is done repeatedly in the HTTP conversation, even if the constructed string is constant for each protocol version that is involved.
> The proposed patch constructs a map of generated values held in memory with the associated ProtocolVersion as a key and uses read/write locks to access the data. This  solution minimizes the time to generate such a value from several milliseconds to 40-50 microseconds.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[jira] [Commented] (HTTPCLIENT-1137) The values for the Via header are created by httpclient-cache for each cached and backend request

Posted by "Jon Moore (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HTTPCLIENT-1137?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13143310#comment-13143310 ] 

Jon Moore commented on HTTPCLIENT-1137:
---------------------------------------

No, a regular HashMap is fine: Java Strings are immutable, and a put operation should just be a pointer swap.

                
> The values for the Via header are created by httpclient-cache for each cached and backend request
> -------------------------------------------------------------------------------------------------
>
>                 Key: HTTPCLIENT-1137
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1137
>             Project: HttpComponents HttpClient
>          Issue Type: Improvement
>          Components: Cache
>    Affects Versions: 4.1.2
>            Reporter: Alin Vasile
>            Priority: Trivial
>             Fix For: 4.2 Alpha2
>
>         Attachments: cached_via_header_vals.patch
>
>
> The Via header that gets generated and inserted by the caching layer is done repeatedly in the HTTP conversation, even if the constructed string is constant for each protocol version that is involved.
> The proposed patch constructs a map of generated values held in memory with the associated ProtocolVersion as a key and uses read/write locks to access the data. This  solution minimizes the time to generate such a value from several milliseconds to 40-50 microseconds.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[jira] [Updated] (HTTPCLIENT-1137) The values for the Via header are created by httpclient-cache for each cached and backend request

Posted by "Oleg Kalnichevski (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HTTPCLIENT-1137?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Oleg Kalnichevski updated HTTPCLIENT-1137:
------------------------------------------

    Fix Version/s: 4.2 Alpha2
    
> The values for the Via header are created by httpclient-cache for each cached and backend request
> -------------------------------------------------------------------------------------------------
>
>                 Key: HTTPCLIENT-1137
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1137
>             Project: HttpComponents HttpClient
>          Issue Type: Improvement
>          Components: Cache
>    Affects Versions: 4.1.2
>            Reporter: Alin Vasile
>            Priority: Trivial
>             Fix For: 4.2 Alpha2
>
>         Attachments: cached_via_header_vals.patch
>
>
> The Via header that gets generated and inserted by the caching layer is done repeatedly in the HTTP conversation, even if the constructed string is constant for each protocol version that is involved.
> The proposed patch constructs a map of generated values held in memory with the associated ProtocolVersion as a key and uses read/write locks to access the data. This  solution minimizes the time to generate such a value from several milliseconds to 40-50 microseconds.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[jira] [Commented] (HTTPCLIENT-1137) The values for the Via header are created by httpclient-cache for each cached and backend request

Posted by "Jon Moore (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HTTPCLIENT-1137?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13142358#comment-13142358 ] 

Jon Moore commented on HTTPCLIENT-1137:
---------------------------------------

Hi Vasile,

Sorry to just be getting around to this now. Can you explain the reason for breaking out a ViaHeaderCache as a separate class? Why not just a HashMap? Since this is a true function (given a ProtocolVersion I always generate the same Via header), there's no need to put locks around this, as once the cache is populated it won't be modified, and even if there is a race condition between two threads trying to populate the cache, they'll both arrive at the same answer.

Would you like to revise your patch just to use a plain-old HashMap for this?

Jon
                
> The values for the Via header are created by httpclient-cache for each cached and backend request
> -------------------------------------------------------------------------------------------------
>
>                 Key: HTTPCLIENT-1137
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1137
>             Project: HttpComponents HttpClient
>          Issue Type: Improvement
>          Components: Cache
>    Affects Versions: 4.1.2
>            Reporter: Alin Vasile
>            Priority: Trivial
>             Fix For: 4.2 Alpha2
>
>         Attachments: cached_via_header_vals.patch
>
>
> The Via header that gets generated and inserted by the caching layer is done repeatedly in the HTTP conversation, even if the constructed string is constant for each protocol version that is involved.
> The proposed patch constructs a map of generated values held in memory with the associated ProtocolVersion as a key and uses read/write locks to access the data. This  solution minimizes the time to generate such a value from several milliseconds to 40-50 microseconds.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org