You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by Martin Chan <ma...@milliontech.com> on 2003/06/02 09:01:43 UTC

MultipartPostMethod takes long time to execute

Hi,

I use MultipartPostMethod to do upload, but I found that it takes 3-4
seconds to execute even for a very small file (<1KB).
int status = httpClient.executeMethod(filePost);

Does anyone have the same problem? How to improve the speed?


I also found that the HttpClient fragment the post method to many
packets, each with a few adte byte in content. Can we change it?

Thanks,

Martin Chan


Re: MultipartPostMethod takes long time to execute

Posted by Martin Chan <ma...@milliontech.com>.
Thanks Ortwin, I added "filePost.setUseExpectHeader(false);" and it works.

Ortwin Glück wrote:

> Martin Chan wrote:
>
>> Hi,
>>
>> I use MultipartPostMethod to do upload, but I found that it takes 3-4
>> seconds to execute even for a very small file (<1KB).
>> int status = httpClient.executeMethod(filePost);
>>
>> Does anyone have the same problem? How to improve the speed?
>>
>>
>> I also found that the HttpClient fragment the post method to many
>> packets, each with a few adte byte in content. Can we change it?
>>
>> Thanks,
>>
>> Martin Chan
>
>
> This can have two reasons:
>
> - When TCP_NODELAY is set and the data is delivered to slow, the data 
> may fragment more than with TCP_NODELAY disabled.
>
> - There can be a wait time involved due to 100-Continue handshake. Try 
> and disable 100-Continue handshake.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: 
> commons-httpclient-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: 
> commons-httpclient-dev-help@jakarta.apache.org




Re: MultipartPostMethod takes long time to execute

Posted by Ortwin Glück <or...@nose.ch>.
Martin Chan wrote:
> Hi,
> 
> I use MultipartPostMethod to do upload, but I found that it takes 3-4
> seconds to execute even for a very small file (<1KB).
> int status = httpClient.executeMethod(filePost);
> 
> Does anyone have the same problem? How to improve the speed?
> 
> 
> I also found that the HttpClient fragment the post method to many
> packets, each with a few adte byte in content. Can we change it?
> 
> Thanks,
> 
> Martin Chan

This can have two reasons:

- When TCP_NODELAY is set and the data is delivered to slow, the data 
may fragment more than with TCP_NODELAY disabled.

- There can be a wait time involved due to 100-Continue handshake. Try 
and disable 100-Continue handshake.