Live data from Hacker News

Show HN: Nano-web – a low latency one binary webserver designed for serving SPAs

github.com

31–40 of 119 posts

Re: Show HN: Nano-web – a low latency one binary webserver designed for serving SPAs

#31
post #23

Considering the latency between the user web browser and the server, does the “extremely low latency on account of caching all files in memory” really matter? The files should already be cached by the OS and using sendfile lets the OS copy the file directly to the network.

I just figured any savings where savings can be made is a good thing, especially if there are zero downsides, plus it means very low CPU usage as it's literally just pulling from RAM without any CPU usage. It also precaches gzipped and brotli'd versions of sensible files so that it can accept-encoding for a variety of browsers.

[flagged]

Re: Show HN: Nano-web – a low latency one binary webserver designed for serving SPAs

#32

Earlier quoted context omitted.

When was this added? I recall several years ago having to do this with edge lambdas. IE the it would happily resolve / to /index.html would be fine, but if you wanted to do /my-dir and have it resolve to /my-dir/index.html it would 404.

Now that I'm curious because I remember facing no such issues. Cloudfront was my way of testing all of these scenarios to see what happens when the URL endpoint changes, etc. and then move to Akamai to scale up. Did some quick searches and I think there seems to be some kinks indeed and of course the solutions. Here are a few; - https://stackoverflow.com/questions/59634922/how-do-i-serve-... - https://aws.amazon.com/…

Yeah, I ended up writing a whole thing for it as part of my static website CDK construct.

Here's the request edge lambda:

https://github.com/radiosilence/cdk-static-web/blob/master/s...

Here's the response edge lambda:

https://github.com/radiosilence/cdk-static-web/blob/master/s...

It's been a while since I've updated that project though.

With nano-web for my current site (https://blit.cc) I am just spinning up a free-tier unikernel instance on EC2 and using it as the CF origin. Possibly even more cost effective than S3, and far simpler.

Response times for the "waiting" portion are usually around 5-10ms with CF and if I am going direct to the origin it's around 2-5ms

Re: Show HN: Nano-web – a low latency one binary webserver designed for serving SPAs

#33
post #23

Considering the latency between the user web browser and the server, does the “extremely low latency on account of caching all files in memory” really matter? The files should already be cached by the OS and using sendfile lets the OS copy the file directly to the network.

Latency between me and my cloud provider is about 10x lower than the latency of Python's http.server on localhost.

(It's negated by the SSL handshake, but that's another discussion...)

Re: Show HN: Nano-web – a low latency one binary webserver designed for serving SPAs

#34
post #33
post #23

Considering the latency between the user web browser and the server, does the “extremely low latency on account of caching all files in memory” really matter? The files should already be cached by the OS and using sendfile lets the OS copy the file directly to the network.

Latency between me and my cloud provider is about 10x lower than the latency of Python's http.server on localhost. (It's negated by the SSL handshake, but that's another discussion...)

that sounds broken

Re: Show HN: Nano-web – a low latency one binary webserver designed for serving SPAs

#35

h2o ( https://h2o.examp1e.net/index.html ) is a full-fledged, single-binary, open source web server. Check it out.

The last time I used it for serving multiple WordPress sites and realise having lengthy YAML can be hard to maintain, and I read that mruby can impacts the performance. Their alternative, picohttpparser that V langauge uses on Techempower benchmark is fast but not useful for real world.

Re: Show HN: Nano-web – a low latency one binary webserver designed for serving SPAs

#36
post #23

Considering the latency between the user web browser and the server, does the “extremely low latency on account of caching all files in memory” really matter? The files should already be cached by the OS and using sendfile lets the OS copy the file directly to the network.

We deploy little apps internally. Users have low latency on the network - even home users we steer to use ISPs we know have low latency. I've found that speed can make a difference in user like for an app. Even going out to google etc I'm currently at 5-6 ms.

Some things we might have 1000+ checkboxs to work through on a checklist (cut down by some initial tailoring steps). Even things with a small wait on a click etc are frustrating. If you can drive using a keyboard shortcut and get very immediate response you can really move through things.

Re: Show HN: Nano-web – a low latency one binary webserver designed for serving SPAs

#37
post #23

Considering the latency between the user web browser and the server, does the “extremely low latency on account of caching all files in memory” really matter? The files should already be cached by the OS and using sendfile lets the OS copy the file directly to the network.

I just figured any savings where savings can be made is a good thing, especially if there are zero downsides, plus it means very low CPU usage as it's literally just pulling from RAM without any CPU usage. It also precaches gzipped and brotli'd versions of sensible files so that it can accept-encoding for a variety of browsers.

Couldn't the extra memory copies end up being an actual downside? I.e. the sort of thing that inspired sendfile(2) usage in some servers?

Re: Show HN: Nano-web – a low latency one binary webserver designed for serving SPAs

#38
post #33
post #23

Considering the latency between the user web browser and the server, does the “extremely low latency on account of caching all files in memory” really matter? The files should already be cached by the OS and using sendfile lets the OS copy the file directly to the network.

Latency between me and my cloud provider is about 10x lower than the latency of Python's http.server on localhost. (It's negated by the SSL handshake, but that's another discussion...)

Is that wall-clock measurement or are you using a tool like Apache Benchmark to see the latency?

I ask because those numbers seem really off.

Re: Show HN: Nano-web – a low latency one binary webserver designed for serving SPAs

#39

Earlier quoted context omitted.

How has your experience with Nanos unikernel been so far since you started? Have you noticed any benefits over Docker?

I mean, I think it's an interesting approach to and kind of nice to be going back to more PaaS primitives. I haven't used it in production, it does seem extremely quick and kind of simple and nice. Either way, I figure the more projects that support it natively, the bigger the ecosystem grows and the more data we'll see based on real world usage. The tooling seems pretty good, though the documentation could do with s…

> Either way, I figure the more projects that support it natively, the bigger the ecosystem grows and the more data we'll see based on real world usage.

I like your approach towards this, I'm thinking the same. I appreciate the response you provided, I've been planning on playing around with it for a while when I get the time. Your comment made me even more interested.

It went quite quick from seeing your comment on the post about Nanos to your own project integrating it!

Re: Show HN: Nano-web – a low latency one binary webserver designed for serving SPAs

#40
> SPA_MODE when set to 1 404 request will return /public/index.html as a 200.

oof, as someone who frequently has to run DAST tools, returning a 200 for something that should be a 404 is the bane of my existence.

The tool will try to request sensitive files by trying something as simple as fetching hxxps://example.com/../../../etc/passwd. If you return a "200 OK", it will flag as a security issue, even if the resulting data isn't a passwd file.

I don't think you can convince me that returning a 200 OK and some default content for a URL that doesn't exist is ever the correct thing to do. If you want to use 301 or 302 to redirect them to the front page, that's probably fine, but the most correct thing to do is 404.

Post reply on HN