Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-dev] HttpClient "associate" bugs

Tiger Gui,

I created this bug to track this:

https://bugs.eclipse.org/bugs/show_bug.cgi?id=365828

regards
Jan

On 7 December 2011 17:41, Tiger Gui <tigergui1990@xxxxxxxxx> wrote:
> Hi All,
>
> I found a issue about HttpClient, as we know, before each HttpExchange
> be sent, it will associate with an idle HttpConnection first, this
> associate function is simple like this:
>
> void associate(AbstractHttpConnection connection)
>    {
>        if (connection.getEndPoint().getLocalHost()!= null)
>            _localAddress = new
> Address(connection.getEndPoint().getLocalHost(),connection.getEndPoint().getLocalPort());
>        _connection = connection;
>        if (getStatus() == STATUS_CANCELLING)
>            abort();
>    }
>
> But in one of my online service, one day, i found that It cost me
> about 50 ~ 200 ms to connect to other http service if i use Jetty
> HttpClient, it is unnormal, usually, it cost only 1 - 2 ms. So,
> problem comes, at last, i found this associate function make this
> happen.
>
> "connection.getEndPoint().getLocalHost()" cost usually 50 ~ 200 ms, it
> use function getCanonicalHostName() of Java InetAddress class. In some
> cases, this function will go through DNS server to get the host name,
> so its time taken is very long.
>
> As this associate function was invoked before each http package sent
> (In Jetty 7.4, this function was invoked twice one we sent a http
> package), it is very important and we should keep its time taken is
> short. So, why don't we  change
>
> connection.getEndPoint().getLocalHost()
>
> to
>
> connection.getEndPoint().getLocalAddr()
>
> It will works well, and will prevent this kind of problems. I do not
> know whether it is a bug, but i hope you guys can fix it, thank you.
>
> --
> Best Regards
> ----------------------------------------------------
> Tiger Gui [tigergui1990@xxxxxxxxx]
> _______________________________________________
> jetty-dev mailing list
> jetty-dev@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/jetty-dev


Back to the top