deploy_feedback icon indicating copy to clipboard operation
deploy_feedback copied to clipboard

deploy docs should be explicit that it's _CPU_ time

Open hayd opened this issue 2 years ago • 4 comments

CPU Time per request | 10ms | 50ms

https://deno.com/deploy/docs/pricing-and-limits

This row has caused some confusion with "time per request" i.e. that 10ms is the maximum time a request can take before responding, rather than the total CPU time.

This could be made cleared by either: have another row directly after this (as "time per request | unlimited (?!)"), or comment explicitly that CPU time != time.

hayd avatar Jun 22 '22 22:06 hayd

Also confused with the "CPU time limit" thing.

Written some tests: https://github.com/rhapsodyn/fresh-foo/blob/master/routes/api/timeout.ts, but haven't seen any 500 yet.

rhapsodyn avatar Jun 24 '22 08:06 rhapsodyn

I was searching for this answer. I was wondering if I could even run a query without getting a 500. Good to know it's actual CPU time and not runtime.

Hedzer avatar Jun 27 '22 01:06 Hedzer

playground:

import { delay } from "https://deno.land/[email protected]/async/mod.ts";
import { serve } from "https://deno.land/[email protected]/http/server.ts";

const DEFAULT_TIMEOUT = 0;

serve(async (req: Request) => {
    const ms = new URL(req.url).searchParams.get("ms");
    const timeout = parseInt(ms) || DEFAULT_TIMEOUT;
    await delay(timeout);
    return new Response(`delayed ${timeout/1000} seconds`)
});

I tried with ?ms=600000 to demonstrate response can take >10 minutes. (I have not tested with larger numbers.)

hayd avatar Jun 27 '22 16:06 hayd

In testing again it seems like 60s is the cut off. Longer than that and I am now seeing (when using curl):

$ time curl "https://funny-ferret-64.deno.dev?ms=61002" curl: (92) HTTP/2 stream 1 was not closed cleanly before end of the underlying stream curl "https://funny-ferret-64.deno.dev?ms=61002" 0.02s user 0.01s system 0% cpu 1:00.18 total

This may well be a bug, of course.

hayd avatar Jun 28 '22 00:06 hayd