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 "Boxer, Aaron" <Aa...@uhn.ca> on 2014/04/26 21:52:28 UTC

Timeout when sending on slow link

Hello List,

I am using the latest version of httpasynchclient to send six 13 MB files over a 10 MBPS link.
My timeout is set to 30 seconds, and I am getting timeout errors, in the following timeout handler:

    protected void timeoutCheck(final SelectionKey key, final long now) {
        final IOSessionImpl session = (IOSessionImpl) key.attachment();
        if (session != null) {
            final int timeout = session.getSocketTimeout();
            if (timeout > 0) {
                if (session.getLastAccessTime() + timeout < now) {
                    sessionTimedOut(session);
                }
            }
        }
    }

Setting my timeout to 2 minutes fixes these timeout errors:

        IOReactorConfig ioReactorConfig = IOReactorConfig.custom()
                .setIoThreadCount(Runtime.getRuntime().availableProcessors())
                .setConnectTimeout(120000)
                .setSoTimeout(120000)
                .setTcpNoDelay(true)
                .build();


Is this reasonable to get timeout errors with a 30 second timeout?
Is there anything else I can configure to prevent a timeout?


Over 10 MBPS, each file should take about 15 seconds to send. But, since all files are being sent asynchronously,
is it true that each file may take a lot longer to send, since there are other concurrent sockets active?

Thanks very much,
Aaron




This e-mail may contain confidential and/or privileged information for the sole use of the intended recipient. 
Any review or distribution by anyone other than the person for whom it was originally intended is strictly prohibited. 
If you have received this e-mail in error, please contact the sender and delete all copies. 
Opinions, conclusions or other information contained in this e-mail may not be that of the organization.

RE: Timeout when sending on slow link

Posted by "Boxer, Aaron" <Aa...@uhn.ca>.
Same way as for blocking HttpClient

http://hc.apache.org/httpcomponents-client-4.3.x/logging.html

Cool. Thanks.

This e-mail may contain confidential and/or privileged information for the sole use of the intended recipient. 
Any review or distribution by anyone other than the person for whom it was originally intended is strictly prohibited. 
If you have received this e-mail in error, please contact the sender and delete all copies. 
Opinions, conclusions or other information contained in this e-mail may not be that of the organization.

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


Re: Timeout when sending on slow link

Posted by Oleg Kalnichevski <ol...@apache.org>.
On Mon, 2014-04-28 at 15:00 +0000, Boxer, Aaron wrote:
> Thanks you, Oleg.  Would you mind telling me how to turn on 
> I/O event logging?
> 

Same way as for blocking HttpClient

http://hc.apache.org/httpcomponents-client-4.3.x/logging.html

Oleg

> 
> 
> 
> ________________________________________
> From: Oleg Kalnichevski [olegk@apache.org]
> Sent: Monday, April 28, 2014 9:28 AM
> To: HttpClient User Discussion
> Subject: Re: Timeout when sending on slow link
> 
> On Sat, 2014-04-26 at 19:52 +0000, Boxer, Aaron wrote:
> > Hello List,
> >
> > I am using the latest version of httpasynchclient to send six 13 MB files over a 10 MBPS link.
> > My timeout is set to 30 seconds, and I am getting timeout errors, in the following timeout handler:
> >
> >     protected void timeoutCheck(final SelectionKey key, final long now) {
> >         final IOSessionImpl session = (IOSessionImpl) key.attachment();
> >         if (session != null) {
> >             final int timeout = session.getSocketTimeout();
> >             if (timeout > 0) {
> >                 if (session.getLastAccessTime() + timeout < now) {
> >                     sessionTimedOut(session);
> >                 }
> >             }
> >         }
> >     }
> >
> > Setting my timeout to 2 minutes fixes these timeout errors:
> >
> >         IOReactorConfig ioReactorConfig = IOReactorConfig.custom()
> >                 .setIoThreadCount(Runtime.getRuntime().availableProcessors())
> >                 .setConnectTimeout(120000)
> >                 .setSoTimeout(120000)
> >                 .setTcpNoDelay(true)
> >                 .build();
> >
> >
> > Is this reasonable to get timeout errors with a 30 second timeout?
> > Is there anything else I can configure to prevent a timeout?
> >
> >
> > Over 10 MBPS, each file should take about 15 seconds to send. But, since all files are being sent asynchronously,
> > is it true that each file may take a lot longer to send, since there are other concurrent sockets active?
> >
> > Thanks very much,
> > Aaron
> 
> Hi Aaron
> 
> I think it is conceivable that a particular connection may get no i/o
> activity for a considerable period of time on a slow link with a high
> concurrency level. I do admit that 30 seconds sound a bit too extreme,
> so it can also be a defect in the I/O reactor layer.
> 
> You might want to run your application with I/O event logging on and
> analyze i/o activity of a particular connection.
> 
> Oleg
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> For additional commands, e-mail: httpclient-users-help@hc.apache.org
> 
> 
> This e-mail may contain confidential and/or privileged information for the sole use of the intended recipient. 
> Any review or distribution by anyone other than the person for whom it was originally intended is strictly prohibited. 
> If you have received this e-mail in error, please contact the sender and delete all copies. 
> Opinions, conclusions or other information contained in this e-mail may not be that of the organization.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> For additional commands, e-mail: httpclient-users-help@hc.apache.org
> 



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


RE: Timeout when sending on slow link

Posted by "Boxer, Aaron" <Aa...@uhn.ca>.
Thanks you, Oleg.  Would you mind telling me how to turn on 
I/O event logging?




________________________________________
From: Oleg Kalnichevski [olegk@apache.org]
Sent: Monday, April 28, 2014 9:28 AM
To: HttpClient User Discussion
Subject: Re: Timeout when sending on slow link

On Sat, 2014-04-26 at 19:52 +0000, Boxer, Aaron wrote:
> Hello List,
>
> I am using the latest version of httpasynchclient to send six 13 MB files over a 10 MBPS link.
> My timeout is set to 30 seconds, and I am getting timeout errors, in the following timeout handler:
>
>     protected void timeoutCheck(final SelectionKey key, final long now) {
>         final IOSessionImpl session = (IOSessionImpl) key.attachment();
>         if (session != null) {
>             final int timeout = session.getSocketTimeout();
>             if (timeout > 0) {
>                 if (session.getLastAccessTime() + timeout < now) {
>                     sessionTimedOut(session);
>                 }
>             }
>         }
>     }
>
> Setting my timeout to 2 minutes fixes these timeout errors:
>
>         IOReactorConfig ioReactorConfig = IOReactorConfig.custom()
>                 .setIoThreadCount(Runtime.getRuntime().availableProcessors())
>                 .setConnectTimeout(120000)
>                 .setSoTimeout(120000)
>                 .setTcpNoDelay(true)
>                 .build();
>
>
> Is this reasonable to get timeout errors with a 30 second timeout?
> Is there anything else I can configure to prevent a timeout?
>
>
> Over 10 MBPS, each file should take about 15 seconds to send. But, since all files are being sent asynchronously,
> is it true that each file may take a lot longer to send, since there are other concurrent sockets active?
>
> Thanks very much,
> Aaron

Hi Aaron

I think it is conceivable that a particular connection may get no i/o
activity for a considerable period of time on a slow link with a high
concurrency level. I do admit that 30 seconds sound a bit too extreme,
so it can also be a defect in the I/O reactor layer.

You might want to run your application with I/O event logging on and
analyze i/o activity of a particular connection.

Oleg



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


This e-mail may contain confidential and/or privileged information for the sole use of the intended recipient. 
Any review or distribution by anyone other than the person for whom it was originally intended is strictly prohibited. 
If you have received this e-mail in error, please contact the sender and delete all copies. 
Opinions, conclusions or other information contained in this e-mail may not be that of the organization.


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


Re: Timeout when sending on slow link

Posted by Oleg Kalnichevski <ol...@apache.org>.
On Sat, 2014-04-26 at 19:52 +0000, Boxer, Aaron wrote:
> Hello List,
> 
> I am using the latest version of httpasynchclient to send six 13 MB files over a 10 MBPS link.
> My timeout is set to 30 seconds, and I am getting timeout errors, in the following timeout handler:
> 
>     protected void timeoutCheck(final SelectionKey key, final long now) {
>         final IOSessionImpl session = (IOSessionImpl) key.attachment();
>         if (session != null) {
>             final int timeout = session.getSocketTimeout();
>             if (timeout > 0) {
>                 if (session.getLastAccessTime() + timeout < now) {
>                     sessionTimedOut(session);
>                 }
>             }
>         }
>     }
> 
> Setting my timeout to 2 minutes fixes these timeout errors:
> 
>         IOReactorConfig ioReactorConfig = IOReactorConfig.custom()
>                 .setIoThreadCount(Runtime.getRuntime().availableProcessors())
>                 .setConnectTimeout(120000)
>                 .setSoTimeout(120000)
>                 .setTcpNoDelay(true)
>                 .build();
> 
> 
> Is this reasonable to get timeout errors with a 30 second timeout?
> Is there anything else I can configure to prevent a timeout?
> 
> 
> Over 10 MBPS, each file should take about 15 seconds to send. But, since all files are being sent asynchronously,
> is it true that each file may take a lot longer to send, since there are other concurrent sockets active?
> 
> Thanks very much,
> Aaron

Hi Aaron

I think it is conceivable that a particular connection may get no i/o
activity for a considerable period of time on a slow link with a high
concurrency level. I do admit that 30 seconds sound a bit too extreme,
so it can also be a defect in the I/O reactor layer. 

You might want to run your application with I/O event logging on and
analyze i/o activity of a particular connection.

Oleg  



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