Live data from Hacker News

Websocketd

websocketd.com

161–170 of 233 posts

Re: Websocketd

#161
post #148

Earlier quoted context omitted.

You can also just serve HTTP.

That has nothing to do with my question. Of course you "serve HTTP". I want to know how one interfaces with a server without CGI or fastCGI.

You serve HTTP to the server. To the front-end server or the load balancer, aka ‘reverse proxy’. That's how.

Both Apache and Nginx can proxy HTTP, out of the box.

Re: Websocketd

#162

Earlier quoted context omitted.

Ok, lemme spell it out: bundling the app and the server together; that’s what’s implied.

Which comes back to my question. Can one do that with apache and nginx? I'm pretty sure I've seen methods for this in Apache but only the paid version of nginx. Am I wrong?

I mentioned Apache modules in my comment. Write a module, add it to Apache’s config, your code loads with the web server.

Looks like one can also write nginx modules, but I’m not familiar with nginx licensing to know if a purchase is required to use that in a commercial deployment.

Re: Websocketd

#163
post #161

Earlier quoted context omitted.

That has nothing to do with my question. Of course you "serve HTTP". I want to know how one interfaces with a server without CGI or fastCGI.

You serve HTTP to the server. To the front-end server or the load balancer, aka ‘reverse proxy’. That's how. Both Apache and Nginx can proxy HTTP, out of the box.

IOW, opening a socket from the routing HTTP server to an application HTTP server. That’s pretty much how FCGI works.

Re: Websocketd

#164
post #161

Earlier quoted context omitted.

You serve HTTP to the server. To the front-end server or the load balancer, aka ‘reverse proxy’. That's how. Both Apache and Nginx can proxy HTTP, out of the box.

IOW, opening a socket from the routing HTTP server to an application HTTP server. That’s pretty much how FCGI works.

Yeah, people just seemingly realized that there's nothing special about FastCGI that couldn't be done with plain http. And as a bonus, the app itself can work as a server in the dev env, and testing is simpler.

(Only, CGI managed to get headers sorta right by embedding them in protocol vars and not the other way around.)

Re: Websocketd

#165

Earlier quoted context omitted.

Ok, lemme spell it out: bundling the app and the server together; that’s what’s implied.

Which comes back to my question. Can one do that with apache and nginx? I'm pretty sure I've seen methods for this in Apache but only the paid version of nginx. Am I wrong?

Today, app servers are mostly separated from front-end servers because, it turns out, it's best to not hold on to too much memory and/or threads while waiting for a slow client to receive their stuff. So async servers like Nginx are used on the front tier and they knock to app servers over the net.

But Nginx does have a Lua module, and, I think, Perl. Afaik both are in the free version. Mostly used to augment configuration, or for lightweight interfacing directly with databases (ahem Redis and Memcached cough).

Re: Websocketd

#166

Earlier quoted context omitted.

Which comes back to my question. Can one do that with apache and nginx? I'm pretty sure I've seen methods for this in Apache but only the paid version of nginx. Am I wrong?

I mentioned Apache modules in my comment. Write a module, add it to Apache’s config, your code loads with the web server. Looks like one can also write nginx modules, but I’m not familiar with nginx licensing to know if a purchase is required to use that in a commercial deployment.

It's not required, and in fact there's a big open source project taking advantage of that: OpenResty uses a module that loads LuaJIT into Nginx, and builds very fast applications into Nginx using Lua.

Re: Websocketd

#167
> Each inbound WebSocket connection runs your program in a dedicated process. Connections are isolated by process.

I see you and 10,900 other "software developers" get the point of WebSocket. It's especially "impressive" when you written the whole thing in Go and could have used goroutines and channels, which could easily handle hundreds of thousand of connections (maybe millions). Terrible design!

For a long time I thought every software developer must be smart, but a lot of them don't see the big picture very often.

Why this bothers me so much? You created something that a lot of developers think is good enough, so less innovation will happen and more and more slow websites will appear because of tech like this...

Re: Websocketd

#168
post #26

This is the second or third "it's CGI again" thing I've seen in the past year. While these things are cool and definitely have their place, it's still worth noting that process per connection scales fairly poorly, simply because processes and forking are relatively expensive, and therefore it's probably unwise to deploy something like this in production anymore. It is what it is, I suppose.

This is something that confuses me. Servers offer CGI and fastCGI and if you aren't using those to interface with your own code, how do you do so otherwise? Do some languages have their own deep connections into the server flow that makes them faster? I just don't understand this.

You don't need a server like Apache or Nginx. Your code can just bind to 80/443 directly.

Re: Websocketd

#170
post #125
post #115

Earlier quoted context omitted.

The myth that fork is expensive is pervasive, and speaking to the ways that it is true†, well: performance is relative. fork() only takes around 8ms on my Linux machine and I can get 100,000 posix_spawn() per second there with 100MB RSS. That's "fast enough" for a large number of applications. †: fork() is a lot slower (over 20x) on Windows

8ms per fork means you can only accept 125 connections per second. (per core) That means it's only viable for connections where the connection is very long lived and messages are very sparse (because context switches).

I find it ironic that people will complain about milliseconds for a fork and talk about the time for context switches... and then serve their pages using an interpreted language that is an order of magnitude slower than it could be in a compiled language...
Post reply on HN