Re: How to handle Range header in Http Core

2011-03-05 Thread Oleg Kalnichevski
On Fri, 2011-03-04 at 15:42 +0800, LongkerDandy wrote:
> Hi
> 
> I'm developing a UPnP/DLNA media server, and using Http Core for file
> transfer.
> Client may ask for part of the file, using IF Range and Range Http headers.
> Is there a easy way to deal with that?

LongkerDandy

HttpCore does not support byte ranges / partial entities out of the box.

> Or I have to write my own FileEntity?
> 

Most likely you will need to write a custom protocol interceptor in
order to add range headers and a custom FileEntity capable of writing
out it content partially given a particular byte range.

Hope this helps

Oleg 

> Thanks
> LongkerDandy



-
To unsubscribe, e-mail: httpclient-users-unsubscr...@hc.apache.org
For additional commands, e-mail: httpclient-users-h...@hc.apache.org



ApacheHttp and Tomcat 7 tests...

2011-03-05 Thread Tony Anecito
Hi Oleg,

Summary The following test results show me that using the localhost as the 
server name and the ApacheHttp client running on the server as done with the 
ApacheHttp tests by Apache components group gets close to or bettter than 
expected. Using localhost I am guessing bypasses using the network and running 
500,000 requests over 20 threads gets a low average.

I still need to have the servlet setup to send data but I am wondering if the 
Apache component tests used Tomcat at all and instand just read a file from 
Apache Web Server. I will look further into this also to make sure I get closer 
to what the tests did.

Since I think I am getting closer to how Tomcat responds for a bare servlet 
with 
no code in it and maybe no network component I am more comfortable in 
understanding what Tomcat can truely do from a performance perspective.


If I go back to my 6 core server and run the same test (client running on the 
server where Tomcat is as the I did previously on my old laptop I get:

httpClient execute time in nanoseconds: 209391137
httpClient execute time in nanoseconds: 1595734
httpClient execute time in nanoseconds: 1298489
httpClient execute time in nanoseconds: 1238355
httpClient execute time in nanoseconds: 1262800
httpClient execute time in nanoseconds: 1196312
httpClient execute time in nanoseconds: 1253512
httpClient execute time in nanoseconds: 1457866
httpClient execute time in nanoseconds: 1215867
httpClient execute time in nanoseconds: 1254000
 
Concurrency level: 1
Time taken for tests: 0.234 seconds
Complete requests: 10
Failed requests: 0
Content transferred: 0 bytes
Requests per second: 42.735043 [#/sec] (mean)
Time per request: 23.4 [ms] (mean)

If I run next with the server name set to localhost instead of a internet url 
as 
done on the Apache tests I get (This should cause the network to be bypassed 
perhaps even the TCP/IP Stack? note the much lower response times):

httpClient execute time in nanoseconds: 100221746
httpClient execute time in nanoseconds: 890756
httpClient execute time in nanoseconds: 688845
httpClient execute time in nanoseconds: 688844
httpClient execute time in nanoseconds: 689823
httpClient execute time in nanoseconds: 614044
httpClient execute time in nanoseconds: 585200
httpClient execute time in nanoseconds: 604266
httpClient execute time in nanoseconds: 657066
httpClient execute time in nanoseconds: 408223
 
Concurrency level: 1
Time taken for tests: 0.109 seconds
Complete requests: 10
Failed requests: 0
Content transferred: 0 bytes
Requests per second: 91.74312 [#/sec] (mean)
Time per request: 10.9 [ms] (mean)


If I now run a 500,000 request thread over 20 sockets (localhost and running 
the 
client app on the Tomcat serverI get:

Concurrency level: 20
Time taken for tests: 14.549 seconds
Complete requests: 50
Failed requests: 0
Content transferred: 0 bytes
Requests per second: 34366.625 [#/sec] (mean)
Time per request: 0.029098 [ms] (mean)



- Original Message 
From: Tony Anecito 
To: HttpClient User Discussion 
Sent: Thu, March 3, 2011 10:49:53 PM
Subject: Re: Slowness of 4.1

Hi Oleg,

Here is some numbers when running TestHttpClient4. I am running from Eclipse 
using jdk 1. 6.0.22 and a Aspire 5670 which has Intel Core Duo T2300 (1.66 GHz, 
667 MHz FSB, 2MB L2 cache) and 2GB of DDR2 memory. Note how for a single thread 
running 10 requests the response time starts out very slow at 150msec then gets 
to 1.43msec at the end.

httpClient execute time in nanoseconds: 150181377
httpClient execute time in nanoseconds: 2180445
httpClient execute time in nanoseconds: 1540419
httpClient execute time in nanoseconds: 1757207
httpClient execute time in nanoseconds: 1759721
httpClient execute time in nanoseconds: 1492368
httpClient execute time in nanoseconds: 1493765
httpClient execute time in nanoseconds: 1474489
httpClient execute time in nanoseconds: 1456610
httpClient execute time in nanoseconds: 1437613
Document URI:  xxx
Document Length: 0 bytes
Concurrency level: 1
Time taken for tests: 0.187 seconds
Complete requests: 10
Failed requests: 0
Content transferred: 0 bytes
Requests per second: 53.475933 [#/sec] (mean)
Time per request: 18.7 [ms] (mean)


When I increase the number of threads to 50 and requests to 50 I get a max 
req of 2.2K per second and around 400microseconds.
The CPU utilization is between 50-60% on the laptop and around 5-7% on my 6 
core 

server with Tomcat 7. Tommow I will setup the test to run from a faster client 
and see the results.



- Original Message 
From: Tony Anecito 
To: HttpClient User Discussion 
Sent: Thu, March 3, 2011 1:06:41 PM
Subject: Re: Slowness of 4.1

Thanks Oleg for your explanation about comparitive vs real life. Most of the 
testing I do is for "real life" since the end goal is user experience thus my 
comments. I can understand what Apache goals are better now and adjust my 
expectations accordingly.

I did find what I needed as far as