Re: [httpapi] client-specified timeout?

Ben Bucksch <news@bucksch.org> Fri, 05 February 2021 20:38 UTC

Return-Path: <news@bucksch.org>
X-Original-To: httpapi@ietfa.amsl.com
Delivered-To: httpapi@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id E53773A0045 for <httpapi@ietfa.amsl.com>; Fri, 5 Feb 2021 12:38:11 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.901
X-Spam-Level:
X-Spam-Status: No, score=-1.901 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, HTML_MESSAGE=0.001, NICE_REPLY_A=-0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no
Received: from mail.ietf.org ([4.31.198.44]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id VFoEiroiy64J for <httpapi@ietfa.amsl.com>; Fri, 5 Feb 2021 12:38:09 -0800 (PST)
Received: from mail.server.beonex.com (mail.server.beonex.com [144.76.227.234]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 658673A003E for <httpapi@ietf.org>; Fri, 5 Feb 2021 12:38:08 -0800 (PST)
From: Ben Bucksch <news@bucksch.org>
To: httpapi@ietf.org
References: <7613F010-431C-47B3-802E-5258BAA5E156@akamai.com>
Organization: Me, myself and I
Message-ID: <35f5defe-e908-d0b8-5947-bba0da6a34c8@bucksch.org>
Date: Fri, 05 Feb 2021 21:38:00 +0100
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.0
MIME-Version: 1.0
In-Reply-To: <7613F010-431C-47B3-802E-5258BAA5E156@akamai.com>
Content-Type: multipart/alternative; boundary="------------08B1BA7F2C9EF1B8EB9F41FD"
Content-Language: fr
Archived-At: <https://mailarchive.ietf.org/arch/msg/httpapi/hEop1Vk55t_GqATuTeFNxn9JeVg>
Subject: Re: [httpapi] client-specified timeout?
X-BeenThere: httpapi@ietf.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Building Blocks for HTTP APIs <httpapi.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/httpapi>, <mailto:httpapi-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/httpapi/>
List-Post: <mailto:httpapi@ietf.org>
List-Help: <mailto:httpapi-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/httpapi>, <mailto:httpapi-request@ietf.org?subject=subscribe>
X-List-Received-Date: Fri, 05 Feb 2021 20:38:12 -0000

Am 05.02.21 um 19:54 schrieb Salz, Rich:
>
> Is it reasonable for a client to want the ability to say things like 
> “if this takes more than 300ms send a failure status code back” ?
>

Question:

What would that mean for the server, exactly?

Do you mean the server should attempt to make the query (e.g. against a 
SQL database or similar), and if 300ms have passed and no result could 
be obtained yet, abort the query? If that's what you want, then the 
client can already abort the HTTP request/connection, and the server 
should notice that and abort the backend query. Many servers already do 
that (abort query when client aborts), and many clients already have 
implemented such a timeout feature.

Or do you mean the server should make guess whether the query will take 
more than 300ms (possibly with the help of the database, which checks 
how the query would look like and perform), and return a failure code 
immediately, *without* attempting to actually make the query?

This detail would be important to specify. The whole purpose of such a 
header field would be to save server resources. (Otherwise the client 
should just abort the request and/or ignore a late result, which many 
clients already do as-is.) So the purpose of such a header would be to 
avoid wasting server resources. If that's the goal, then the question 
whether a server would attempt a slow query or would make a quick and 
cheap reply "too slow", would be really important for the client. I 
could even see that client logic depends on exactly these semantics: 
Attempt to make a few queries, and if they are slow, narrow them down, 
or make other queries, or whatever. But if such attempts already use 
server resources, that wouldn't be a viable client strategy.

So, if you define such a header, I think it would be important to 
clarify whether the server is expected to abort queries right away, 
before running them, or whether the server is expected to make an 
attempt, and abort only when the query actually took too long.

In the "make an attempt and abort after the time elapsed" case, I would 
argue that it would be better to give the client a clear and clean way 
to abort a query, and then the client can do the timeout. Or abort based 
on other criteria, e.g. whether the user has already moved on to 
something else or clicked on something else. I think that would be more 
generic.

Ben