You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@kafka.apache.org by Andrei Iatsuk <hi...@yatsukav.com> on 2021/03/17 15:32:47 UTC

[DISCUSS] KIP-723: Add socket.tcp.no.delay property to Kafka Config

Hello everyone, 

I would like to start a discussion on KIP-723, which propose adding a Kafka Config property with TCP_NODELAY socket option flag, that currently hardcoded in true.

https://cwiki.apache.org/confluence/display/KAFKA/KIP-723%3A+Add+socket.tcp.no.delay+property+to+Kafka+Config

Best regards,
Andrei Iatsuk

Re: [DISCUSS] KIP-723: Add socket.tcp.no.delay property to Kafka Config

Posted by Andrei Iatsuk <hi...@yatsukav.com>.
Hi David,

Thanks for your comment. Client connections are insignificant on my test cluster. But I can add this setting just in case.

Best regards,
Andrei

> On 19 Mar 2021, at 23:19, David Jacot <da...@gmail.com> wrote:
> 
> Hi Andrei,
> 
> Thanks for the KIP.
> 
> Should we consider adding the setting in the clients as well? I think that
> it is also enabled by default in the clients. Could it be useful?
> 
> Best,
> David
> 
> Le ven. 19 mars 2021 à 13:41, Ismael Juma <is...@juma.me.uk> a écrit :
> 
>> Hi Andrei,
>> 
>> I would start the vote on Monday if there are no comments.
>> 
>> Ismael
>> 
>> On Fri, Mar 19, 2021 at 5:36 AM Andrei Iatsuk <hi...@yatsukav.com> wrote:
>> 
>>> No comments yet. I don’t know this is good or not. May I start voting?
>>> 
>>>> On 17 Mar 2021, at 18:32, Andrei Iatsuk <hi...@yatsukav.com> wrote:
>>>> 
>>>> Hello everyone,
>>>> 
>>>> I would like to start a discussion on KIP-723, which propose adding a
>>> Kafka Config property with TCP_NODELAY socket option flag, that currently
>>> hardcoded in true.
>>>> 
>>>> 
>>> 
>> https://cwiki.apache.org/confluence/display/KAFKA/KIP-723%3A+Add+socket.tcp.no.delay+property+to+Kafka+Config
>>>> 
>>>> Best regards,
>>>> Andrei Iatsuk
>>> 
>>> 
>> 


Re: [DISCUSS] KIP-723: Add socket.tcp.no.delay property to Kafka Config

Posted by David Jacot <da...@gmail.com>.
Hi Andrei,

Thanks for the KIP.

Should we consider adding the setting in the clients as well? I think that
it is also enabled by default in the clients. Could it be useful?

Best,
David

Le ven. 19 mars 2021 à 13:41, Ismael Juma <is...@juma.me.uk> a écrit :

> Hi Andrei,
>
> I would start the vote on Monday if there are no comments.
>
> Ismael
>
> On Fri, Mar 19, 2021 at 5:36 AM Andrei Iatsuk <hi...@yatsukav.com> wrote:
>
> > No comments yet. I don’t know this is good or not. May I start voting?
> >
> > > On 17 Mar 2021, at 18:32, Andrei Iatsuk <hi...@yatsukav.com> wrote:
> > >
> > > Hello everyone,
> > >
> > > I would like to start a discussion on KIP-723, which propose adding a
> > Kafka Config property with TCP_NODELAY socket option flag, that currently
> > hardcoded in true.
> > >
> > >
> >
> https://cwiki.apache.org/confluence/display/KAFKA/KIP-723%3A+Add+socket.tcp.no.delay+property+to+Kafka+Config
> > >
> > > Best regards,
> > > Andrei Iatsuk
> >
> >
>

Re: [DISCUSS] KIP-723: Add socket.tcp.no.delay property to Kafka Config

Posted by Ismael Juma <is...@juma.me.uk>.
Hi Andrei,

I would start the vote on Monday if there are no comments.

Ismael

On Fri, Mar 19, 2021 at 5:36 AM Andrei Iatsuk <hi...@yatsukav.com> wrote:

> No comments yet. I don’t know this is good or not. May I start voting?
>
> > On 17 Mar 2021, at 18:32, Andrei Iatsuk <hi...@yatsukav.com> wrote:
> >
> > Hello everyone,
> >
> > I would like to start a discussion on KIP-723, which propose adding a
> Kafka Config property with TCP_NODELAY socket option flag, that currently
> hardcoded in true.
> >
> >
> https://cwiki.apache.org/confluence/display/KAFKA/KIP-723%3A+Add+socket.tcp.no.delay+property+to+Kafka+Config
> >
> > Best regards,
> > Andrei Iatsuk
>
>

Re: [DISCUSS] KIP-723: Add socket.tcp.no.delay property to Kafka Config

Posted by Andrei Iatsuk <hi...@yatsukav.com>.
No comments yet. I don’t know this is good or not. May I start voting?

> On 17 Mar 2021, at 18:32, Andrei Iatsuk <hi...@yatsukav.com> wrote:
> 
> Hello everyone, 
> 
> I would like to start a discussion on KIP-723, which propose adding a Kafka Config property with TCP_NODELAY socket option flag, that currently hardcoded in true.
> 
> https://cwiki.apache.org/confluence/display/KAFKA/KIP-723%3A+Add+socket.tcp.no.delay+property+to+Kafka+Config
> 
> Best regards,
> Andrei Iatsuk


Re: [DISCUSS] KIP-723: Add socket.tcp.no.delay property to Kafka Config

Posted by Colin McCabe <cm...@apache.org>.
Hi Andrei,

Kafka intentionally sets TCP_NODELAY in order to disable Nagle's algorithm.  The reason is because Nagle's algorithm can cause to long latencies in Kafka RPC.

Wikipedia explains the problem:

 > [Nagle's] algorithm interacts badly with TCP delayed acknowledgments 
 > (delayed ACK), a feature introduced into TCP at roughly the same time in 
 > the early 1980s, but by a different group. With both algorithms enabled, 
 > applications that do two successive writes to a TCP connection, followed 
 > by a read that will not be fulfilled until after the data from the second 
 > write has reached the destination, experience a constant delay of up to 
 > 500 milliseconds, the "ACK delay". It is recommended to disable either, 
 > although traditionally it's easier to disable Nagle, since such a switch 
 > already exists for real-time applications.

There is no option to disable delayed acks when creating a socket from Java (or from C either, to the best of my knowledge).  So clearly we have to disable Nagle by setting TCP_NODELAY.

In order to figure out why you are getting so many small writes to the socket, it would help to know a bit more about your configuration.  You are using SSL, right?  I think if you used plaintext, sendfile would avoid this issue.  What kind of disks are you using?

We may find that increasing buffering in the SSL layer would avoid this issue without the drawbacks of enabling Nagle's algorithm.

best,
Colin


On Sun, Mar 21, 2021, at 19:51, Chia-Ping Tsai wrote:
> hi Andrei
> 
> Thanks for this find and KIP. Two questions is left.
> 
> 1) Is there significant side effect if we disable it? For example, does 
> it cause higher latency in your cluster? If there is no obvious side 
> effect, could we disable it by default?
> 
> 2) As you mentioned that most packets belong to inter broker messages, 
> is it worth enabling user to use different value (of this new config) 
> to different listener? For example, users can disable it on controller 
> listener and enable it on data listener?
> 
> 
> On 2021/03/17 15:32:47 Andrei Iatsuk wrote:
> > Hello everyone, 
> > 
> > I would like to start a discussion on KIP-723, which propose adding a Kafka Config property with TCP_NODELAY socket option flag, that currently hardcoded in true.
> > 
> > https://cwiki.apache.org/confluence/display/KAFKA/KIP-723%3A+Add+socket.tcp.no.delay+property+to+Kafka+Config
> > 
> > Best regards,
> > Andrei Iatsuk
>

Re: [DISCUSS] KIP-723: Add socket.tcp.no.delay property to Kafka Config

Posted by Chia-Ping Tsai <ch...@apache.org>.
hi Andrei

Thanks for this find and KIP. Two questions is left.

1) Is there significant side effect if we disable it? For example, does it cause higher latency in your cluster? If there is no obvious side effect, could we disable it by default?

2) As you mentioned that most packets belong to inter broker messages, is it worth enabling user to use different value (of this new config) to different listener? For example, users can disable it on controller listener and enable it on data listener?


On 2021/03/17 15:32:47 Andrei Iatsuk wrote:
> Hello everyone, 
> 
> I would like to start a discussion on KIP-723, which propose adding a Kafka Config property with TCP_NODELAY socket option flag, that currently hardcoded in true.
> 
> https://cwiki.apache.org/confluence/display/KAFKA/KIP-723%3A+Add+socket.tcp.no.delay+property+to+Kafka+Config
> 
> Best regards,
> Andrei Iatsuk