You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by "Roland Weber (JIRA)" <ji...@apache.org> on 2006/12/28 12:30:20 UTC

[jira] Created: (HTTPCORE-21) have connections count requests

have connections count requests
-------------------------------

                 Key: HTTPCORE-21
                 URL: http://issues.apache.org/jira/browse/HTTPCORE-21
             Project: HttpComponents Core
          Issue Type: Wish
          Components: HttpCore
    Affects Versions: 4.0-alpha3
            Reporter: Roland Weber
         Assigned To: Roland Weber
            Priority: Minor


It would be nice if connections would count the requests sent since they were opened. This would greatly simplify the implementation of reuse strategies like "reuse for at most 5 requests". While it is possible to count requests elsewhere, that is clumsy and error prone. For example the HttpContext is not a good place to keep the request count, since the connection may be released to and re-acquired from a connection manager, so the previously used context is lost.

patch follows

cheers,
  Roland


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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


[jira] Commented: (HTTPCORE-21) have connections count requests

Posted by "Oleg Kalnichevski (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HTTPCORE-21?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12494403 ] 

Oleg Kalnichevski commented on HTTPCORE-21:
-------------------------------------------

Andrea,

Looks quite good to me. I'll review the patch more carefully, probably make a few minor in the process and commit it in the coming days

Oleg 

> have connections count requests
> -------------------------------
>
>                 Key: HTTPCORE-21
>                 URL: https://issues.apache.org/jira/browse/HTTPCORE-21
>             Project: HttpComponents Core
>          Issue Type: Wish
>          Components: HttpCore
>    Affects Versions: 4.0-alpha3
>            Reporter: Roland Weber
>            Priority: Minor
>             Fix For: 4.0-alpha5
>
>         Attachments: 2k6-12-28-reqcnt-1.txt, metrics.patch, metrics_v2.patch
>
>
> It would be nice if connections would count the requests sent since they were opened. This would greatly simplify the implementation of reuse strategies like "reuse for at most 5 requests". While it is possible to count requests elsewhere, that is clumsy and error prone. For example the HttpContext is not a good place to keep the request count, since the connection may be released to and re-acquired from a connection manager, so the previously used context is lost.
> patch follows
> cheers,
>   Roland

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Assigned: (HTTPCORE-21) have connections count requests

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

Oleg Kalnichevski reassigned HTTPCORE-21:
-----------------------------------------

    Assignee: Oleg Kalnichevski

> have connections count requests
> -------------------------------
>
>                 Key: HTTPCORE-21
>                 URL: https://issues.apache.org/jira/browse/HTTPCORE-21
>             Project: HttpComponents Core
>          Issue Type: Wish
>          Components: HttpCore
>    Affects Versions: 4.0-alpha3
>            Reporter: Roland Weber
>            Assignee: Oleg Kalnichevski
>            Priority: Minor
>             Fix For: 4.0-alpha5
>
>         Attachments: 2k6-12-28-reqcnt-1.txt, metrics.patch, metrics_v2.patch
>
>
> It would be nice if connections would count the requests sent since they were opened. This would greatly simplify the implementation of reuse strategies like "reuse for at most 5 requests". While it is possible to count requests elsewhere, that is clumsy and error prone. For example the HttpContext is not a good place to keep the request count, since the connection may be released to and re-acquired from a connection manager, so the previously used context is lost.
> patch follows
> cheers,
>   Roland

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Commented: (HTTPCORE-21) have connections count requests

Posted by "Oleg Kalnichevski (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HTTPCORE-21?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12493934 ] 

Oleg Kalnichevski commented on HTTPCORE-21:
-------------------------------------------

Hi Andrea,

Great! Many thanks for taking up this issue. Just a few comments / ideas to consider

* I think byte counts (bytes sent / bytes received) should be moved to HttpDataTransmitter / HttpDataReceiver because there those counts would be easier to implement and be made more reliable. I would suggest introducing an optional interface for that end (or something similar) and making SocketHttpDataTransmitter / SocketHttpDataReceiver implement it

interface HttpTransportMetrics {

  long getBytesTransferred();

}

* For performance reasons I would suggest using longs for keeping the four main counts in order to avoid the costs of object casing and map access. This will make the HttpConnectionMetricsImpl code somewhat uglier but will help reduce performance overhead of connection metrics.

Oleg 

> have connections count requests
> -------------------------------
>
>                 Key: HTTPCORE-21
>                 URL: https://issues.apache.org/jira/browse/HTTPCORE-21
>             Project: HttpComponents Core
>          Issue Type: Wish
>          Components: HttpCore
>    Affects Versions: 4.0-alpha3
>            Reporter: Roland Weber
>            Priority: Minor
>             Fix For: 4.0-alpha5
>
>         Attachments: 2k6-12-28-reqcnt-1.txt, metrics.patch
>
>
> It would be nice if connections would count the requests sent since they were opened. This would greatly simplify the implementation of reuse strategies like "reuse for at most 5 requests". While it is possible to count requests elsewhere, that is clumsy and error prone. For example the HttpContext is not a good place to keep the request count, since the connection may be released to and re-acquired from a connection manager, so the previously used context is lost.
> patch follows
> cheers,
>   Roland

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Commented: (HTTPCORE-21) have connections count requests

Posted by "Oleg Kalnichevski (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/HTTPCORE-21?page=comments#action_12461258 ] 
            
Oleg Kalnichevski commented on HTTPCORE-21:
-------------------------------------------

Roland,

I think other metrics may be useful, not just the request count

Can we have a more generic method instead? How about this?

static final String REQUEST_COUNT = "http.request-count";
static final String TRANSFERRED_BYTE_COUNT = "http.out-byte-count";
static final String RECEIVED_BYTE_COUNT = "http.in-byte-count";

long getCount(String);

Oleg


> have connections count requests
> -------------------------------
>
>                 Key: HTTPCORE-21
>                 URL: http://issues.apache.org/jira/browse/HTTPCORE-21
>             Project: HttpComponents Core
>          Issue Type: Wish
>          Components: HttpCore
>    Affects Versions: 4.0-alpha3
>            Reporter: Roland Weber
>         Assigned To: Roland Weber
>            Priority: Minor
>         Attachments: 2k6-12-28-reqcnt-1.txt
>
>
> It would be nice if connections would count the requests sent since they were opened. This would greatly simplify the implementation of reuse strategies like "reuse for at most 5 requests". While it is possible to count requests elsewhere, that is clumsy and error prone. For example the HttpContext is not a good place to keep the request count, since the connection may be released to and re-acquired from a connection manager, so the previously used context is lost.
> patch follows
> cheers,
>   Roland

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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


[jira] Updated: (HTTPCORE-21) have connections count requests

Posted by "Andrea Selva (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HTTPCORE-21?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Andrea Selva updated HTTPCORE-21:
---------------------------------

    Attachment: metricstests.patch

Hi Oleg,
while i was workingto fixes you suggested, before reaching the problem you reported with the nio part, i've improved some test units, so here his the contribution

> have connections count requests
> -------------------------------
>
>                 Key: HTTPCORE-21
>                 URL: https://issues.apache.org/jira/browse/HTTPCORE-21
>             Project: HttpComponents Core
>          Issue Type: Wish
>          Components: HttpCore
>    Affects Versions: 4.0-alpha3
>            Reporter: Roland Weber
>            Assignee: Oleg Kalnichevski
>            Priority: Minor
>             Fix For: 4.0-beta1
>
>         Attachments: 2k6-12-28-reqcnt-1.txt, metrics.patch, metrics_v2.patch, metricstests.patch
>
>
> It would be nice if connections would count the requests sent since they were opened. This would greatly simplify the implementation of reuse strategies like "reuse for at most 5 requests". While it is possible to count requests elsewhere, that is clumsy and error prone. For example the HttpContext is not a good place to keep the request count, since the connection may be released to and re-acquired from a connection manager, so the previously used context is lost.
> patch follows
> cheers,
>   Roland

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Updated: (HTTPCORE-21) have connections count requests

Posted by "Andrea Selva (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HTTPCORE-21?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Andrea Selva updated HTTPCORE-21:
---------------------------------

    Attachment: metrics.patch

Hi, i think this code could be a starting development point for metrics. I haven't written any test code, because the test case should be very complex.
The idea is to update the metrics object explicitly in the right places in AbstractHttpClientConnection.


> have connections count requests
> -------------------------------
>
>                 Key: HTTPCORE-21
>                 URL: https://issues.apache.org/jira/browse/HTTPCORE-21
>             Project: HttpComponents Core
>          Issue Type: Wish
>          Components: HttpCore
>    Affects Versions: 4.0-alpha3
>            Reporter: Roland Weber
>            Priority: Minor
>             Fix For: 4.0-alpha5
>
>         Attachments: 2k6-12-28-reqcnt-1.txt, metrics.patch
>
>
> It would be nice if connections would count the requests sent since they were opened. This would greatly simplify the implementation of reuse strategies like "reuse for at most 5 requests". While it is possible to count requests elsewhere, that is clumsy and error prone. For example the HttpContext is not a good place to keep the request count, since the connection may be released to and re-acquired from a connection manager, so the previously used context is lost.
> patch follows
> cheers,
>   Roland

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Commented: (HTTPCORE-21) have connections count requests

Posted by "Oleg Kalnichevski (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HTTPCORE-21?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12506957 ] 

Oleg Kalnichevski commented on HTTPCORE-21:
-------------------------------------------

Hi Andrea,

Patch checked in. Many thanks

Oleg

> have connections count requests
> -------------------------------
>
>                 Key: HTTPCORE-21
>                 URL: https://issues.apache.org/jira/browse/HTTPCORE-21
>             Project: HttpComponents Core
>          Issue Type: Wish
>          Components: HttpCore
>    Affects Versions: 4.0-alpha3
>            Reporter: Roland Weber
>            Assignee: Oleg Kalnichevski
>            Priority: Minor
>             Fix For: 4.0-beta1
>
>         Attachments: 2k6-12-28-reqcnt-1.txt, metrics.patch, metrics_v2.patch, metricstests.patch
>
>
> It would be nice if connections would count the requests sent since they were opened. This would greatly simplify the implementation of reuse strategies like "reuse for at most 5 requests". While it is possible to count requests elsewhere, that is clumsy and error prone. For example the HttpContext is not a good place to keep the request count, since the connection may be released to and re-acquired from a connection manager, so the previously used context is lost.
> patch follows
> cheers,
>   Roland

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Updated: (HTTPCORE-21) have connections count requests

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

Oleg Kalnichevski updated HTTPCORE-21:
--------------------------------------

    Fix Version/s:     (was: 4.0-alpha5)
                   4.0-beta1

Folks,
I have put together request / response metrics for both blocking and non-blocking connection. Andrea kindly contributed byte sent / received metrics for blocking data receiver and transmitter. 

Now the bad news. Implementing transport metrics for non-blocking connections turned out to be a major pain in the rectum. One can add the counts to all individual message parsers and content codecs, which will get VERY messy in no time. I am very reluctant to go that route. There is a much cleaner approach to solve the problem: decorate the I/O channel associated with the I/O session. The trouble here is that this would most definitely kill all performance gains of using FileChannel's #transferFrom() and #transferTo(). I suspect very strongly these methods would actually expect an instance of SocetChannel to be able to do their magic. I do not see an acceptable way of solving the problem at the moment. My current preference is to not support transport counts on non-blocking connections at all (at least until a better solution presents itself). 

Oleg

> have connections count requests
> -------------------------------
>
>                 Key: HTTPCORE-21
>                 URL: https://issues.apache.org/jira/browse/HTTPCORE-21
>             Project: HttpComponents Core
>          Issue Type: Wish
>          Components: HttpCore
>    Affects Versions: 4.0-alpha3
>            Reporter: Roland Weber
>            Assignee: Oleg Kalnichevski
>            Priority: Minor
>             Fix For: 4.0-beta1
>
>         Attachments: 2k6-12-28-reqcnt-1.txt, metrics.patch, metrics_v2.patch
>
>
> It would be nice if connections would count the requests sent since they were opened. This would greatly simplify the implementation of reuse strategies like "reuse for at most 5 requests". While it is possible to count requests elsewhere, that is clumsy and error prone. For example the HttpContext is not a good place to keep the request count, since the connection may be released to and re-acquired from a connection manager, so the previously used context is lost.
> patch follows
> cheers,
>   Roland

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Commented: (HTTPCORE-21) have connections count requests

Posted by "Roland Weber (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HTTPCORE-21?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12464474 ] 

Roland Weber commented on HTTPCORE-21:
--------------------------------------

Hi Oleg,

looks good. And people still have the option of defining a custom extension interface and downcasting the object in order to use getters.
Another item on my list. I can't promise I'll implement all counters on the first go.

cheers,
  Roland


> have connections count requests
> -------------------------------
>
>                 Key: HTTPCORE-21
>                 URL: https://issues.apache.org/jira/browse/HTTPCORE-21
>             Project: HttpComponents Core
>          Issue Type: Wish
>          Components: HttpCore
>    Affects Versions: 4.0-alpha3
>            Reporter: Roland Weber
>         Assigned To: Roland Weber
>            Priority: Minor
>         Attachments: 2k6-12-28-reqcnt-1.txt
>
>
> It would be nice if connections would count the requests sent since they were opened. This would greatly simplify the implementation of reuse strategies like "reuse for at most 5 requests". While it is possible to count requests elsewhere, that is clumsy and error prone. For example the HttpContext is not a good place to keep the request count, since the connection may be released to and re-acquired from a connection manager, so the previously used context is lost.
> patch follows
> cheers,
>   Roland

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

        

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


[jira] Commented: (HTTPCORE-21) have connections count requests

Posted by "Oleg Kalnichevski (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HTTPCORE-21?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12507904 ] 

Oleg Kalnichevski commented on HTTPCORE-21:
-------------------------------------------

Just some more thoughts on the problem of collecting transport metrics for NIO connections. 

A decorator around ByteChannel would have been the cleanest solution to the problem by far. But this would effectively eliminate all performance gains from using FileChannel's #transferFrom() and #transferTo() methods. The only alternative to decorating the channel is to track every single I/O operation on the session's channel and update transport metrics accordingly. This requires some fairly ugly code in DefaultNHttpClientConnection, DefaultNHttpServerConnection, LengthDelimited and Identity codecs, but I do not see any other alternative to that.

Oleg

> have connections count requests
> -------------------------------
>
>                 Key: HTTPCORE-21
>                 URL: https://issues.apache.org/jira/browse/HTTPCORE-21
>             Project: HttpComponents Core
>          Issue Type: Wish
>          Components: HttpCore
>    Affects Versions: 4.0-alpha3
>            Reporter: Roland Weber
>            Assignee: Oleg Kalnichevski
>            Priority: Minor
>             Fix For: 4.0-beta1
>
>         Attachments: 2k6-12-28-reqcnt-1.txt, metrics.patch, metrics_v2.patch, metricstests.patch
>
>
> It would be nice if connections would count the requests sent since they were opened. This would greatly simplify the implementation of reuse strategies like "reuse for at most 5 requests". While it is possible to count requests elsewhere, that is clumsy and error prone. For example the HttpContext is not a good place to keep the request count, since the connection may be released to and re-acquired from a connection manager, so the previously used context is lost.
> patch follows
> cheers,
>   Roland

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Commented: (HTTPCORE-21) have connections count requests

Posted by "Oleg Kalnichevski (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HTTPCORE-21?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12505589 ] 

Oleg Kalnichevski commented on HTTPCORE-21:
-------------------------------------------

Implemented HttpConnectionMetrics for blocking HTTP connections

Oleg

> have connections count requests
> -------------------------------
>
>                 Key: HTTPCORE-21
>                 URL: https://issues.apache.org/jira/browse/HTTPCORE-21
>             Project: HttpComponents Core
>          Issue Type: Wish
>          Components: HttpCore
>    Affects Versions: 4.0-alpha3
>            Reporter: Roland Weber
>            Assignee: Oleg Kalnichevski
>            Priority: Minor
>             Fix For: 4.0-alpha5
>
>         Attachments: 2k6-12-28-reqcnt-1.txt, metrics.patch, metrics_v2.patch
>
>
> It would be nice if connections would count the requests sent since they were opened. This would greatly simplify the implementation of reuse strategies like "reuse for at most 5 requests". While it is possible to count requests elsewhere, that is clumsy and error prone. For example the HttpContext is not a good place to keep the request count, since the connection may be released to and re-acquired from a connection manager, so the previously used context is lost.
> patch follows
> cheers,
>   Roland

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Resolved: (HTTPCORE-21) have connections count requests

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

Oleg Kalnichevski resolved HTTPCORE-21.
---------------------------------------

    Resolution: Fixed

Added transport metrics to NIO connections.

Oleg

> have connections count requests
> -------------------------------
>
>                 Key: HTTPCORE-21
>                 URL: https://issues.apache.org/jira/browse/HTTPCORE-21
>             Project: HttpComponents Core
>          Issue Type: Wish
>          Components: HttpCore
>    Affects Versions: 4.0-alpha3
>            Reporter: Roland Weber
>            Assignee: Oleg Kalnichevski
>            Priority: Minor
>             Fix For: 4.0-beta1
>
>         Attachments: 2k6-12-28-reqcnt-1.txt, metrics.patch, metrics_v2.patch, metricstests.patch
>
>
> It would be nice if connections would count the requests sent since they were opened. This would greatly simplify the implementation of reuse strategies like "reuse for at most 5 requests". While it is possible to count requests elsewhere, that is clumsy and error prone. For example the HttpContext is not a good place to keep the request count, since the connection may be released to and re-acquired from a connection manager, so the previously used context is lost.
> patch follows
> cheers,
>   Roland

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Updated: (HTTPCORE-21) have connections count requests

Posted by "Roland Weber (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HTTPCORE-21?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Roland Weber updated HTTPCORE-21:
---------------------------------

    Fix Version/s:     (was: 4.0-alpha4)
                   4.0-alpha5

> have connections count requests
> -------------------------------
>
>                 Key: HTTPCORE-21
>                 URL: https://issues.apache.org/jira/browse/HTTPCORE-21
>             Project: HttpComponents Core
>          Issue Type: Wish
>          Components: HttpCore
>    Affects Versions: 4.0-alpha3
>            Reporter: Roland Weber
>         Assigned To: Roland Weber
>            Priority: Minor
>             Fix For: 4.0-alpha5
>
>         Attachments: 2k6-12-28-reqcnt-1.txt
>
>
> It would be nice if connections would count the requests sent since they were opened. This would greatly simplify the implementation of reuse strategies like "reuse for at most 5 requests". While it is possible to count requests elsewhere, that is clumsy and error prone. For example the HttpContext is not a good place to keep the request count, since the connection may be released to and re-acquired from a connection manager, so the previously used context is lost.
> patch follows
> cheers,
>   Roland

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Updated: (HTTPCORE-21) have connections count requests

Posted by "Andrea Selva (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HTTPCORE-21?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Andrea Selva updated HTTPCORE-21:
---------------------------------

    Attachment: metrics_v2.patch

This second patch is a substitution for the previous, and has the long counters and the getTransferredBytes into AbstractHttpDataReceiver and AbstractHttpDataTransmitter. I hope this could be a solution.
Thank's for the suggests
 Andrea Selva

> have connections count requests
> -------------------------------
>
>                 Key: HTTPCORE-21
>                 URL: https://issues.apache.org/jira/browse/HTTPCORE-21
>             Project: HttpComponents Core
>          Issue Type: Wish
>          Components: HttpCore
>    Affects Versions: 4.0-alpha3
>            Reporter: Roland Weber
>            Priority: Minor
>             Fix For: 4.0-alpha5
>
>         Attachments: 2k6-12-28-reqcnt-1.txt, metrics.patch, metrics_v2.patch
>
>
> It would be nice if connections would count the requests sent since they were opened. This would greatly simplify the implementation of reuse strategies like "reuse for at most 5 requests". While it is possible to count requests elsewhere, that is clumsy and error prone. For example the HttpContext is not a good place to keep the request count, since the connection may be released to and re-acquired from a connection manager, so the previously used context is lost.
> patch follows
> cheers,
>   Roland

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Updated: (HTTPCORE-21) have connections count requests

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

Oleg Kalnichevski updated HTTPCORE-21:
--------------------------------------

    Fix Version/s: 4.0-alpha4

> have connections count requests
> -------------------------------
>
>                 Key: HTTPCORE-21
>                 URL: https://issues.apache.org/jira/browse/HTTPCORE-21
>             Project: HttpComponents Core
>          Issue Type: Wish
>          Components: HttpCore
>    Affects Versions: 4.0-alpha3
>            Reporter: Roland Weber
>         Assigned To: Roland Weber
>            Priority: Minor
>             Fix For: 4.0-alpha4
>
>         Attachments: 2k6-12-28-reqcnt-1.txt
>
>
> It would be nice if connections would count the requests sent since they were opened. This would greatly simplify the implementation of reuse strategies like "reuse for at most 5 requests". While it is possible to count requests elsewhere, that is clumsy and error prone. For example the HttpContext is not a good place to keep the request count, since the connection may be released to and re-acquired from a connection manager, so the previously used context is lost.
> patch follows
> cheers,
>   Roland

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Commented: (HTTPCORE-21) have connections count requests

Posted by "Roland Weber (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/HTTPCORE-21?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12461739 ] 

Roland Weber commented on HTTPCORE-21:
--------------------------------------

Hi Oleg,

makes sense. I'm not sure I like passing in a string as a selector. It sure is better than adding half a dozen counter methods over time. How do you feel about an int or char selector so we can switch() instead of running a sequence of if-then-elseif string comparisons? Or a new class/interface:

interface HttpConnectionMetrics {
  int getRequestCount();
  int getResponseCount();
  long getSentBytesCount();
  long getReceivedBytesCount();
}

interface Http[Client]Connection {
  ...
  HttpConnectionMetrics getMetrics();
}

For the time being, I shy the complexity of adding four counters instead of one. (Just due to personal time constraints.) I'll let this settle while I'm working on the connection stuff and will pick it up afterwards.

cheers,
  Roland


> have connections count requests
> -------------------------------
>
>                 Key: HTTPCORE-21
>                 URL: http://issues.apache.org/jira/browse/HTTPCORE-21
>             Project: HttpComponents Core
>          Issue Type: Wish
>          Components: HttpCore
>    Affects Versions: 4.0-alpha3
>            Reporter: Roland Weber
>         Assigned To: Roland Weber
>            Priority: Minor
>         Attachments: 2k6-12-28-reqcnt-1.txt
>
>
> It would be nice if connections would count the requests sent since they were opened. This would greatly simplify the implementation of reuse strategies like "reuse for at most 5 requests". While it is possible to count requests elsewhere, that is clumsy and error prone. For example the HttpContext is not a good place to keep the request count, since the connection may be released to and re-acquired from a connection manager, so the previously used context is lost.
> patch follows
> cheers,
>   Roland

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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


[jira] Updated: (HTTPCORE-21) have connections count requests

Posted by "Roland Weber (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/HTTPCORE-21?page=all ]

Roland Weber updated HTTPCORE-21:
---------------------------------

    Attachment: 2k6-12-28-reqcnt-1.txt

Here's a take on this one. getRequestCount() is defined on the HttpClientConnection, the counter is implemented in AbstractHttpClientConnection, and gets activated in SocketHttpClientConnection. This affects only the client side and traditional blocking IO connections. The counter is optional, implementations that do not count can simply return -1.
If getRequestCount() were lifted to HttpConnection, it would also affect server side and NIO connections. I'd rather get some feedback before working on such a big patch. Same goes for test cases.

cheers,
  Roland


> have connections count requests
> -------------------------------
>
>                 Key: HTTPCORE-21
>                 URL: http://issues.apache.org/jira/browse/HTTPCORE-21
>             Project: HttpComponents Core
>          Issue Type: Wish
>          Components: HttpCore
>    Affects Versions: 4.0-alpha3
>            Reporter: Roland Weber
>         Assigned To: Roland Weber
>            Priority: Minor
>         Attachments: 2k6-12-28-reqcnt-1.txt
>
>
> It would be nice if connections would count the requests sent since they were opened. This would greatly simplify the implementation of reuse strategies like "reuse for at most 5 requests". While it is possible to count requests elsewhere, that is clumsy and error prone. For example the HttpContext is not a good place to keep the request count, since the connection may be released to and re-acquired from a connection manager, so the previously used context is lost.
> patch follows
> cheers,
>   Roland

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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


[jira] Commented: (HTTPCORE-21) have connections count requests

Posted by "Oleg Kalnichevski (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HTTPCORE-21?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12464468 ] 

Oleg Kalnichevski commented on HTTPCORE-21:
-------------------------------------------

String as a selector may be a little more cumbersome than an int but the string parameter would allow us to maintain name spaces easily: "http.request-count", "mycompany.very-special-stuff",  etc.

So, how about this?

interface HttpConnectionMetrics {
  int getRequestCount();
  int getResponseCount();
  long getSentBytesCount();
  long getReceivedBytesCount();

 // Custom metrics can be obtained here 
  Object getMetric(String);

} 

Oleg

> have connections count requests
> -------------------------------
>
>                 Key: HTTPCORE-21
>                 URL: https://issues.apache.org/jira/browse/HTTPCORE-21
>             Project: HttpComponents Core
>          Issue Type: Wish
>          Components: HttpCore
>    Affects Versions: 4.0-alpha3
>            Reporter: Roland Weber
>         Assigned To: Roland Weber
>            Priority: Minor
>         Attachments: 2k6-12-28-reqcnt-1.txt
>
>
> It would be nice if connections would count the requests sent since they were opened. This would greatly simplify the implementation of reuse strategies like "reuse for at most 5 requests". While it is possible to count requests elsewhere, that is clumsy and error prone. For example the HttpContext is not a good place to keep the request count, since the connection may be released to and re-acquired from a connection manager, so the previously used context is lost.
> patch follows
> cheers,
>   Roland

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

        

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


[jira] Assigned: (HTTPCORE-21) have connections count requests

Posted by "Roland Weber (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HTTPCORE-21?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Roland Weber reassigned HTTPCORE-21:
------------------------------------

    Assignee:     (was: Roland Weber)

> have connections count requests
> -------------------------------
>
>                 Key: HTTPCORE-21
>                 URL: https://issues.apache.org/jira/browse/HTTPCORE-21
>             Project: HttpComponents Core
>          Issue Type: Wish
>          Components: HttpCore
>    Affects Versions: 4.0-alpha3
>            Reporter: Roland Weber
>            Priority: Minor
>             Fix For: 4.0-alpha5
>
>         Attachments: 2k6-12-28-reqcnt-1.txt
>
>
> It would be nice if connections would count the requests sent since they were opened. This would greatly simplify the implementation of reuse strategies like "reuse for at most 5 requests". While it is possible to count requests elsewhere, that is clumsy and error prone. For example the HttpContext is not a good place to keep the request count, since the connection may be released to and re-acquired from a connection manager, so the previously used context is lost.
> patch follows
> cheers,
>   Roland

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Commented: (HTTPCORE-21) have connections count requests

Posted by "Oleg Kalnichevski (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HTTPCORE-21?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12494670 ] 

Oleg Kalnichevski commented on HTTPCORE-21:
-------------------------------------------

Hi Andrea

I reviewed the patch a little more carefully and submitted chunks of with some minor modifications. However I also found areas where more work was needed. 

(1) #receiveResponseEntity() method merely generates an HttpEntity instance, but it does not actually retrieve its content. Hence updating the ReceivedBytesCount in #receiveResponseEntity() does not do much.

The solution to this problem could to keep a reference to HttpTransportMetrics of the corresponding HTTP data receiver and transmitter inside HttpConnectionMetrics. This would also eliminate the need to copy the counts from HttpTransportMetrics to HttpConnectionMetrics and lots of ugly code along with it

(2) HttpConnectionMetrics belongs to the generic HttpConnection interface, not just HttpClientConnection. We also want to be able to keep metrics for server side connections

(3) Some test coverage would be great

Anyways, many thanks for this patch and for contributing to the project. It is very much appreciated

Oleg

> have connections count requests
> -------------------------------
>
>                 Key: HTTPCORE-21
>                 URL: https://issues.apache.org/jira/browse/HTTPCORE-21
>             Project: HttpComponents Core
>          Issue Type: Wish
>          Components: HttpCore
>    Affects Versions: 4.0-alpha3
>            Reporter: Roland Weber
>            Priority: Minor
>             Fix For: 4.0-alpha5
>
>         Attachments: 2k6-12-28-reqcnt-1.txt, metrics.patch, metrics_v2.patch
>
>
> It would be nice if connections would count the requests sent since they were opened. This would greatly simplify the implementation of reuse strategies like "reuse for at most 5 requests". While it is possible to count requests elsewhere, that is clumsy and error prone. For example the HttpContext is not a good place to keep the request count, since the connection may be released to and re-acquired from a connection manager, so the previously used context is lost.
> patch follows
> cheers,
>   Roland

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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