You are viewing a plain text version of this content. The canonical link for it is here.
Posted to httpclient-users@hc.apache.org by "M.Zdila / EpiSoftware Ltd" <m....@episoftware.com> on 2006/09/18 15:16:22 UTC
bandwidth throttling
Hello
I need to throttle HTTP connections to limit bandwidth. Now I can throttle all
connections using some protocol by using
org.apache.jmeter.protocol.http.util.SlowHttpClientSocketFactory and
Protocol.register(). But this is not sufficient to me. What I need is to be
able to set different limit before each HttpMethod execution. Moreover I use
MultiThreadedHttpConnectionManager to get HttpConnections. I know that one
HttpConnection is reusable for multiple requests. If I could get actual
InputStream and OutputStream for each HttpMethod execution I could modify the
limit parameter. Or something like that :-)
Please give me a hing how could I achieve this.
Thanks in advance
Regards
--
Martin Zdila
Analyst/Developer
EpiSoftware Slovakia Ltd.
Letna 27, 043 14 Kosice
cellular: +421 908 363 848
phone: +421 55 6770 420
fax: +421 55 6770 420
mailto:m.zdila@episoftware.com
http://www.episoftware.com
---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-user-help@jakarta.apache.org
Re: bandwidth throttling
Posted by "M.Zdila / EpiSoftware Ltd" <m....@episoftware.com>.
Hi Roland
Thanks for your answer. It has helped me!
I am not using server-relative paths so I'll use ThreadLocal variable :-).
Regards
On Monday 18 September 2006 16:37, Roland Weber wrote:
> Hello Martin,
>
> > I need to throttle HTTP connections to limit bandwidth. Now I can
> > throttle all connections using some protocol by using
> > org.apache.jmeter.protocol.http.util.SlowHttpClientSocketFactory and
> > Protocol.register(). But this is not sufficient to me. What I need is to
> > be able to set different limit before each HttpMethod execution.
>
> If you are using server-relative paths, you can pass the HostConfiguration
> to be used explicitly to HttpClient:
> http://jakarta.apache.org/commons/httpclient/apidocs/org/apache/commons/htt
>pclient/HttpClient.html#executeMethod(org.apache.commons.httpclient.HostConf
>iguration,%20org.apache.commons.httpclient.HttpMethod) In that case, the
> Protocol instance will be taken from the HostConfiguration argument, and
> you can pass in any protocol (and protocol socket factory) you want to be
> used for this method specifically.
>
> Otherwise, there's always the ugly trick of using a ThreadLocal variable
> that is set before calling the execute method and read by the protocol
> socket factory to decide how much to throttle, if at all.
>
> hope that helps,
> Roland
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: httpclient-user-help@jakarta.apache.org
--
Martin Zdila
Analyst/Developer
EpiSoftware Slovakia Ltd.
Letna 27, 043 14 Kosice
cellular: +421 908 363 848
phone: +421 55 6770 420
fax: +421 55 6770 420
mailto:m.zdila@episoftware.com
http://www.episoftware.com
---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-user-help@jakarta.apache.org
Re: bandwidth throttling
Posted by Roland Weber <ht...@dubioso.net>.
Hello Martin,
> I need to throttle HTTP connections to limit bandwidth. Now I can throttle all
> connections using some protocol by using
> org.apache.jmeter.protocol.http.util.SlowHttpClientSocketFactory and
> Protocol.register(). But this is not sufficient to me. What I need is to be
> able to set different limit before each HttpMethod execution.
If you are using server-relative paths, you can pass the HostConfiguration
to be used explicitly to HttpClient:
http://jakarta.apache.org/commons/httpclient/apidocs/org/apache/commons/httpclient/HttpClient.html#executeMethod(org.apache.commons.httpclient.HostConfiguration,%20org.apache.commons.httpclient.HttpMethod)
In that case, the Protocol instance will be taken from the HostConfiguration
argument, and you can pass in any protocol (and protocol socket factory) you
want to be used for this method specifically.
Otherwise, there's always the ugly trick of using a ThreadLocal variable
that is set before calling the execute method and read by the protocol
socket factory to decide how much to throttle, if at all.
hope that helps,
Roland
---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-user-help@jakarta.apache.org