deploy_feedback icon indicating copy to clipboard operation
deploy_feedback copied to clipboard

Highly inconsistent isolate start times

Open cknight opened this issue 2 years ago • 18 comments

Problem description

This isn't necessarily a bug report per se, but isolate start times seem slower than previously and much more variable.

What factors affect the isolate start time in Deploy? For example, in the last 20 minutes or so, isolate start times in my global-db-comparison project are varying wildly from blazing fast (144 ms) to very slow (2.2 sec). Can we expect more consistent, faster, times in the future?

image

Steps to reproduce

N/A

Expected behavior

This is more desired than expected and I do not know the limitations you are working under, but ideally:

  • Isolates start times do not vary dramatically and are generally consistent
  • Isolates start times are less than 200ms

Environment

No response

Possible solution

No response

Additional context

No response

cknight avatar Sep 18 '23 22:09 cknight

I'm experiencing similar, and I rarely get under 1s isolate start times. Is this something that upgrading from the free tier would change or is this just the way deno deploy is right now?

AW0005 avatar Nov 03 '23 19:11 AW0005

In another project (dev-tools), I am seeing wildly different times (from 144ms to 9.14s). This is a simple Fresh project with very little going on (primarily client side JS), and no special imports, KV, WASM, broadcast channel or other special features employed.

image

cknight avatar Nov 03 '23 23:11 cknight

I'm also experiencing very slow start up times.

time

I rarely see below 100ms and more often 500ms+ to over a second.

This defeats the point of "edge" hosting and makes Deno Deploy not a viable platform for professional use.

dbushell avatar Nov 07 '23 16:11 dbushell

I'm also experiencing very slow start up times. But for my case, i verified the problem is with the Import modules.

In this example, I have a global file with 4x imports, and its run with 2seg only for import files on deno deploy:

image

patrickalima98 avatar Jan 10 '24 03:01 patrickalima98

More updates, its very estrange how it is random:

image

This problem its not 100% for all locations. For example the first request of the day for us-east-4 and europe in general is acceptable. The main problem is in the south america

patrickalima98 avatar Jan 11 '24 19:01 patrickalima98

FYI - this is being investigated by the Deploy team.

igorzi avatar Jan 11 '24 20:01 igorzi

Thanks for comment @igorzi, only to put here more details, a little and very simple script is having long cold start too: image

patrickalima98 avatar Jan 16 '24 21:01 patrickalima98

Hi, to help provide some more use cases I'm attaching here my code where I'm using it for production and having 6 seconds of cold start every now and then, most of the time it works fine with an average of 250 - 400ms:

import { config } from 'npm:dotenv';
import { Hono } from "hono/preset/quick.ts";
config();

const app = new Hono();

app.onError((err: any, c): any => {
  if (err.message === 'Validation failure') {
    return c.json({ errors: err.messages }, err.status)
  }

  return c.json(err.error, err.status)
})

const routes = {
  user: 'name_of_a_deno_project',
}

app.all('*', (c) => {
  const url = new URL(c.req.url);
  const { pathname, search } = url;
  const pathWithParams = pathname + search;
  
  const foward2 = url.pathname.match(new RegExp(Object.keys(routes).join('|')));
  if (foward2 && foward2.length) {
    const newPath = `https://${routes[foward2[0] as keyof typeof routes]}-${Deno.env.get('ENV_TYPE')}.deno.dev` ;
    console.info('newPath ', newPath + pathWithParams)
    const newReq = new Request(newPath + pathWithParams, c.req.raw);

    return fetch(newReq);
  }

  return c.text('');
})

Deno.serve(app.fetch);

The cold start:

image

patrickalima98 avatar Jan 19 '24 18:01 patrickalima98