public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: Vallish Vaidyeshwara <vallish@amazon•com>
To: Richard Cochran <richardcochran@gmail•com>
Cc: <davem@davemloft•net>, <shuah@kernel•org>,
	<netdev@vger•kernel.org>, <linux-kernel@vger•kernel.org>,
	<eduval@amazon•com>, <anchalag@amazon•com>, <tglx@linutronix•de>
Subject: Re: [PATCH RESEND 0/2] enable hires timer to timeout datagram socket
Date: Tue, 22 Aug 2017 11:17:23 +0000	[thread overview]
Message-ID: <20170822111723.GB102755@amazon.com> (raw)
In-Reply-To: <20170822062311.okn7coroki2fjgyc@localhost>

On Tue, Aug 22, 2017 at 08:23:11AM +0200, Richard Cochran wrote:
> On Mon, Aug 21, 2017 at 06:22:10PM +0000, Vallish Vaidyeshwara wrote:
> > AWS Lambda is affected by this change in behavior in
> > system call. Following links has more information:
> > https://en.wikipedia.org/wiki/AWS_Lambda
> 
> Quote:
> 
>     Unlike Amazon EC2, which is priced by the hour, AWS Lambda is
>     metered in increments of 100 milliseconds.
>
> So I guess you want the accurate timeout in order to support billing?
> In any case, even with the old wheel you didn't have guarantees WRT
> timeout latency, and so the proper way for the application to handle
> this is to use a timerfd together with HIGH_RES_TIMERS, and PREEMPT_RT
> in order to have sub-millisecond latency.
> 
> Thanks,
> Richard

Hello Richard,

4.4 kernel implementation of datagram socket wait code is calling
schedule_timeout() which in-turn calls __mod_timer(). __mod_timer()
does not add any slack. mod_timer() is the function that adds slack.
This gives good consistent results for event handling response time
on datagram socket timeouts.

strace from 4.4 test run of waiting for 180 seconds:
10:25:48.239685 setsockopt(3, SOL_SOCKET, SO_RCVTIMEO, "\264\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0", 16) = 0
10:25:48.239755 recvmsg(3, 0x7ffd0a3beec0, 0) = -1 EAGAIN (Resource temporarily unavailable)
10:28:48.236989 fstat(1, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 0), ...}) = 0

strace from 4.9 test run of waiting for 180 seconds times out close to 195 seconds:
setsockopt(3, SOL_SOCKET, SO_RCVTIMEO, "\264\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0", 16) = 0 <0.000028>
recvmsg(3, 0x7ffd6a2c4380, 0)           = -1 EAGAIN (Resource temporarily unavailable) <194.852000>
fstat(1, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 0), ...}) = 0 <0.000018>

This change of behavior in system call is breaking the application logic and
response time.

Thanks.
-Vallish

      reply	other threads:[~2017-08-22 11:17 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-18 18:44 [PATCH RESEND 0/2] enable hires timer to timeout datagram socket Vallish Vaidyeshwara
2017-08-18 18:44 ` [PATCH RESEND 1/2] net: enable high resolution timer mode to timeout datagram sockets Vallish Vaidyeshwara
2017-08-21 20:10   ` Cong Wang
2017-08-22 11:14     ` Vallish Vaidyeshwara
2017-08-18 18:44 ` [PATCH RESEND 2/2] selftests/net: add test to verify datagram socket timeout Vallish Vaidyeshwara
2017-08-18 20:18 ` [PATCH RESEND 0/2] enable hires timer to timeout datagram socket Richard Cochran
2017-08-18 22:27   ` Vallish Vaidyeshwara
2017-08-19  6:21     ` Richard Cochran
2017-08-20  1:47       ` Vallish Vaidyeshwara
2017-08-21 18:22         ` Vallish Vaidyeshwara
2017-08-22  6:23           ` Richard Cochran
2017-08-22 11:17             ` Vallish Vaidyeshwara [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170822111723.GB102755@amazon.com \
    --to=vallish@amazon$(echo .)com \
    --cc=anchalag@amazon$(echo .)com \
    --cc=davem@davemloft$(echo .)net \
    --cc=eduval@amazon$(echo .)com \
    --cc=linux-kernel@vger$(echo .)kernel.org \
    --cc=netdev@vger$(echo .)kernel.org \
    --cc=richardcochran@gmail$(echo .)com \
    --cc=shuah@kernel$(echo .)org \
    --cc=tglx@linutronix$(echo .)de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox