Live data from Hacker News

Netlify Edge Functions: A new serverless runtime powered by Deno

netlify.com

21–30 of 166 posts

Re: Netlify Edge Functions: A new serverless runtime powered by Deno

#21
post #2

Aaron from Deno here, happy to answer any questions you may have !

Question about https://edge-functions-examples.netlify.app/example/rewrite

    export default async (request: Request, context: Context) => {
      return context.rewrite("/something-to-serve-with-a-rewrite");
    };
I'm surprised that the function is async but context.rewrite() doesn't use an await. Is that because the rewrite is handed back off to another level of the Netlify stack to process?

Re: Netlify Edge Functions: A new serverless runtime powered by Deno

#23

Earlier quoted context omitted.

Thanks! Any useful pros and cons vs Cloudflare Workers?

Looks like it comes with Typescript support

Anything running JS comes with some TS support, you just have to transpile it before releasing :) I'm not sure why shipping the transpiler on the production server rather than keeping it in your CI is a good idea, but I think that's what Deno is doing.

Re: Netlify Edge Functions: A new serverless runtime powered by Deno

#24
post #16
post #5

This is great news. I'm really rooting for a successful trend of Serverless runtimes, mainly as a weapon against rising cloud deployment costs. While the general trend today is to back the serverless environment with Javascript runtimes (Cloudflare runs its edge on top of V8, Netlify uses deno, most other serverless runtimes use nodejs), I'm optimistic that WebAssembly will take over this space eventually, for a bunc…

I agree about WASM. I am sort of worried that Deno may be too late tbh. Why would I bother with an interpreted language at all when I can code in any language I want and run it anywhere with WASM?

WASM still needs an interface layer to interact with the outside world (filesystem, etc.) My money is on WASI, but Deno becoming the interface layer has some advantages, mainly that most WASM-supporting languages already have tooling around JavaScript ffi.

Re: Netlify Edge Functions: A new serverless runtime powered by Deno

#25
post #21
post #2

Aaron from Deno here, happy to answer any questions you may have !

Question about https://edge-functions-examples.netlify.app/example/rewrite export default async (request: Request, context: Context) => { return context.rewrite("/something-to-serve-with-a-rewrite"); }; I'm surprised that the function is async but context.rewrite() doesn't use an await. Is that because the rewrite is handed back off to another level of the Netlify stack to process?

Actually `context.rewrite` returns a `Promise`. The `async` isn't necessary here, but it also doesn't particularly hurt. You can return a `Promise` from an async function no problem.

Re: Netlify Edge Functions: A new serverless runtime powered by Deno

#26
post #21
post #2

Aaron from Deno here, happy to answer any questions you may have !

Question about https://edge-functions-examples.netlify.app/example/rewrite export default async (request: Request, context: Context) => { return context.rewrite("/something-to-serve-with-a-rewrite"); }; I'm surprised that the function is async but context.rewrite() doesn't use an await. Is that because the rewrite is handed back off to another level of the Netlify stack to process?

Since it's being returned it doesn't really matter whether `.rewrite()` is returning a promise or not. `return await x` is mostly equivalent to `return x` within an async function.

Re: Netlify Edge Functions: A new serverless runtime powered by Deno

#27
post #5

This is great news. I'm really rooting for a successful trend of Serverless runtimes, mainly as a weapon against rising cloud deployment costs. While the general trend today is to back the serverless environment with Javascript runtimes (Cloudflare runs its edge on top of V8, Netlify uses deno, most other serverless runtimes use nodejs), I'm optimistic that WebAssembly will take over this space eventually, for a bunc…

> a fraction of the overhead of a container I mean, only in theory or when looking at it from the right angle, right? Or are you only comparing against JavaScript (unclear)? WASM is still much slower than native code. Containers spend most of their time executing native code; the "overhead" of containers is at the boundaries and is minor compared to the slowdown by moving from native code to WASM. In the future WASM…

Edge functions are typically run intermittently, with their runtime stopped to free up resources between runs. Therefore a big factor is startup and shutdown speed. Containers are pretty bad there. Deno is better, and WASM is unbeatable, especially with things like Wizer[0].

[0]https://github.com/bytecodealliance/wizer

Re: Netlify Edge Functions: A new serverless runtime powered by Deno

#28

Earlier quoted context omitted.

> a fraction of the overhead of a container I mean, only in theory or when looking at it from the right angle, right? Or are you only comparing against JavaScript (unclear)? WASM is still much slower than native code. Containers spend most of their time executing native code; the "overhead" of containers is at the boundaries and is minor compared to the slowdown by moving from native code to WASM. In the future WASM…

Edge functions are typically run intermittently, with their runtime stopped to free up resources between runs. Therefore a big factor is startup and shutdown speed. Containers are pretty bad there. Deno is better, and WASM is unbeatable, especially with things like Wizer[0]. [0] https://github.com/bytecodealliance/wizer

Deno can in theory do the pre-initialization that wizer does for JS too. We have all of the infrastructure for it, we just have not gotten around to actually implementing it yet.

Re: Netlify Edge Functions: A new serverless runtime powered by Deno

#29
post #16
post #5

This is great news. I'm really rooting for a successful trend of Serverless runtimes, mainly as a weapon against rising cloud deployment costs. While the general trend today is to back the serverless environment with Javascript runtimes (Cloudflare runs its edge on top of V8, Netlify uses deno, most other serverless runtimes use nodejs), I'm optimistic that WebAssembly will take over this space eventually, for a bunc…

I agree about WASM. I am sort of worried that Deno may be too late tbh. Why would I bother with an interpreted language at all when I can code in any language I want and run it anywhere with WASM?

The "any language" advantage of WASM is theoretical. Each language is at a different level of support of WASM, libraries aren't all caught up and at the same point for all languages, etc...

I love the promise of WASM, but every time I look at it I get lost in a sea of acronyms, and my optimistic ideas of using language X with library Y on runtime Z are dashed because there is some missing piece somewhere.

If anything, the "any language" thing creates a giant matrix of potential pitfalls for the programmer.

In comparison, the combination of JS/TS, the browser API and a solid std lib looks pretty good for some problems.

Re: Netlify Edge Functions: A new serverless runtime powered by Deno

#30

Earlier quoted context omitted.

Edge functions are typically run intermittently, with their runtime stopped to free up resources between runs. Therefore a big factor is startup and shutdown speed. Containers are pretty bad there. Deno is better, and WASM is unbeatable, especially with things like Wizer[0]. [0] https://github.com/bytecodealliance/wizer

Deno can in theory do the pre-initialization that wizer does for JS too. We have all of the infrastructure for it, we just have not gotten around to actually implementing it yet.

Issue 3335. I know. I'm watching it. :))
Post reply on HN