Live data from Hacker News

A fast and static web server for serving web apps

shortfin.io

121–130 of 135 posts

Re: A fast and static web server for serving web apps

#121

Earlier quoted context omitted.

Static in the sense that it always executes the one function (doesn't load it from disk, its part of the executable) and so there is never any risk that some other path might get you 'out' of the docs directory and into the cgi_bin directory. So in this case static is code for 'compiled in' versus 'dynamically loaded.'

I'm more familiar with Windows, but Linux should be similar. If your application is executed often, then it's pages should be in memory already, and not necessarily need to be read from disk. In terms of execution, if it's a compiled binary, it should be fast enough, if you need more, what you want is a lightweight application server anyway.

The problem with regular old CGI is that for every request the web server gets it has to run some binary file and setup a new thread for that every single time. Also, that's ignoring the filesystem overhead which isn't negligible even if it's already cached. You're basically turning your web server into a glorified shell script and even though all of your CGI scripts are compiled it's still horribly inefficient. FastCGI on the other hand is basically like giving the web server a socket to a persistent process that runs the associated code in an existing thread instead of having to spawn a new one on every request.

Basically FastCGI is like having another server just for your dynamic content while the web server sits in front of it and takes care of hosting the static content and deferring to the FastCGI server when appropriate.

Re: A fast and static web server for serving web apps

#122
post #27

Earlier quoted context omitted.

It's a lot worse than the standard configure, make and make install. For one, it's only requiring one simple script to get compromised and replaced to compromise your entire machine. At least when I download the tarball, unpack it, etc. I've got several steps before I even get to the make install that I would run as root. And I might not even do that depending on my install target. If I do, I have ample opportunity t…

I'm a Windows user. Virtually every piece of software I install comes in the form of an executable, that I download-and-run directly from the browser. I often give this executable administrator priviledges. The executable can then do whatever it wants on my computer. Usually it will install said piece of software (except when it was made by Oracle, it'll install said software and the Ask.com toolbar) This has been st…

Blindly installing windows executables and giving them admin privileges is at least as stupid. This being common practice is probably the primary reason botnets are easily able to exist. This being common practice is why windows sysadmins disable users from having admin privileges. Because apparently you're too dumb to be trusted with them.

Re: A fast and static web server for serving web apps

#123

A lot of you wanted benchmarks so here's one comparing Shortfin with Nginx. The tests was performed with a 56.1 kB PNG image with keep-alive turned off on my laptop. The best result out of 3 tests is shown below. tl;dr: Shortfin: 18 914 req/sec Nginx: 15 603 req/sec SHORTFIN sudo ab -n 100 -c 100 http://127.0.0.1:40/timothy-johansson.png Server Software: shortfin/0.9.5 Server Hostname: 127.0.0.1 Server Port: 40 Docum…

I don't know how valid a test of five milliseconds is to one of six milliseconds (much less one requesting a single known resource with no keep-alive). Though practically, even if those results held in a realistic test, is it still a viable alternative to nginx? You eliminate an enormous amount of flexibility (I admit -- I ♥ nginx) and proven trust for a margin-of-error theoretical speed advantage? I understand the d…

Nope, I'm not trying to replace nginx. I love nginx too ;) The "challenge" was to build a very lightweight server that was faster than nginx - which I did. Then I've used it as a base for a various of projects (see my other comments).

Re: A fast and static web server for serving web apps

#124

Close. Can add this to the list like thttpd. Something I keep thinking I'll build is a fast, high connection count, limited HTTP server, something that is essentially a wrapper around a program that works like 'regular' and emits HTML. It is a corner case in a custom corner, but the target it something which is essentially a 'transponder.' In the 'Internet of Things' I want to build a wrapper/environment such that my…

"easily wrapped around a 'regular' program" Sounds like you want CGI :)

Sounds like you want AOLServer.

http://www.aolserver.com/docs/devel/c/c-overview.html

Re: A fast and static web server for serving web apps

#125
post #11

Just run the following command as root to install the server. # wget http://shortfin.io/install.sh && sh install.sh What? Are they serious? Is this becoming a thing? Please don't tell me that this is a thing.

Yes, it's a thing, and aside from the lack of HTTPS it's not much worse than your standard "./configure", "make", "make install" install flow of the last 20-whatever years of open source. If you don't trust the developer to serve you a safe install.sh script you shouldn't trust the rest of their code either. If you don't trust them you should audit the code no matter what the install process looks like. That said, if…

The install.sh goes off to github and pulls the latest - it's not a method for keeping the same version across machines. It may be fine for your needs, but it'd still be nice to have 'stable' or suggested versions to use.

Re: A fast and static web server for serving web apps

#126
post #98

Earlier quoted context omitted.

Like a statically linked HTML document? I know you're talking C code, but I could imagine some kind of HTML to C "compiler" that could you then statically link into an executable. Then you could have a full website that ran as a single static executable, including CGI-esque calls.

It's actually rather easy: http://www.linuxjournal.com/content/embedding-file-executabl...

That's cool! I wonder if this would be (much) faster than just letting nginx or this embedded httpd read the files directly and serve them. I would hope that the OS or server would cache things enough to make it unnecessary, but it would be interesting to find out.

HTML isn't that big, so if you used linked resources, it would be pretty simple to make a C program and compile it to a binary for any purely "static" site.

Re: A fast and static web server for serving web apps

#127

Earlier quoted context omitted.

It's actually rather easy: http://www.linuxjournal.com/content/embedding-file-executabl...

That's cool! I wonder if this would be (much) faster than just letting nginx or this embedded httpd read the files directly and serve them. I would hope that the OS or server would cache things enough to make it unnecessary, but it would be interesting to find out. HTML isn't that big, so if you used linked resources, it would be pretty simple to make a C program and compile it to a binary for any purely "static" sit…

That's how the Kore web server works ( https://kore.io/ ); it makes you generate a static.h file at compile time that contains all of you your static content.

But like you say, I have to wonder if it actually makes a difference performance-wise. The kernel will cache the static file data anyways. The only improvement I can see is maybe to avoid having to look up file metadata (length and mtime)? Or to avoid a syscall?

Re: A fast and static web server for serving web apps

#128
post #43

Earlier quoted context omitted.

"Provide an install tarball and provide a checksum of it that we can verify." https://github.com/timothyej/Shortfin My point was the people who are going to blindly run curl/sh commands are also going to blindly download the source tarball and run configure/make/make install, and the people who want to do more verification are certainly free to do so.

Yes people are going to dumb things. But that doesn't mean you need to encourage and facilitate it. That's my point. If you know better you should be facilitating the proper way to do it, not the worst way.

Teaching people good security practices is a lot more involved than telling them to run 3 commands instead of 1.

Re: A fast and static web server for serving web apps

#129
post #74

Earlier quoted context omitted.

If you are taking recommendations, I wouldn't recommend installing them at all. You could ask the authors to support a platform which has a better security model. (Given that there are open-source and robuster-than-Windows platforms freely available.).

Cool, I'll just email MS and ask them to port Sharepoint to BSD.

That might be a good idea, assuming they do listen to user feedback.

Re: A fast and static web server for serving web apps

#130

Earlier quoted context omitted.

Cool, I'll just email MS and ask them to port Sharepoint to BSD.

Good job making an honest and good recommendation sound naive.

How is 'just ditch Windows' an honest and good recommendation?
Post reply on HN