Hacker Newsnew | comments | show | ask | jobs | submitlogin
Show HN: Initial release of H2O, and why HTTPD performance will matter in 2015 (kazuhooku.com)
122 points by kazuho 3 hours ago | 40 comments




rkrzr 3 hours ago | link

Congrats on shipping! This project looks very interesting already and will hopefully pick up more contributors.

Is there already support for configuration files? Because for me the performance isn't the most important issue, in fact the main reason I'm using nginx over Apache is that I don't want to deal with .htaccess any more.

I think if you would consider adding support for the nginx config file format to H2O, thus making it a drop-in replacement for it (if all the used features are actually supported), you could give the project a huge boost.

reply

kazuho 2 hours ago | link

Thank you for the comments.

The configuration file format is YAML, and the directives can be seen by running `h2o --help` (the output of version 0.9.0 is: https://gist.github.com/kazuho/f15b79211ea76f1bf6e5).

Unfortunately they are not compatible with that of Nginx. I do not think it is possible to take such approach considering the differences in the internals of both servers.

reply

currysausage 21 minutes ago | link

> in fact the main reason I'm using nginx over Apache is that I don't want to deal with .htaccess any more.

Wait, you don't use Apache because you don't like .htaccess files?

reply

xorcist 2 hours ago | link

nginx' configuration format leaves a lot to be desired, as evidenced by the (former, hopefully) widespread use of exploitable php calls.

There are also if directives in there, but they don't really work they way you think. You really need a deep understanding of its parsing rules in order to do anything remotely complicated with it. It's certainly possible to do better.

(Please don't mention Apache here and its steaming pile of faux-xml. Existence of worse does not make better.)

reply

meowface 1 minute ago | link

>nginx' configuration format leaves a lot to be desired, as evidenced by the (former, hopefully) widespread use of exploitable php calls.

This has nothing to do with nginx's config format at all. It's simply a vulnerability in FastCGI for PHP and the way PHP file paths are passed.

reply

lonnyk 23 minutes ago | link

> as evidenced by the (former, hopefully) widespread use of exploitable php calls

Could someone elaborate on what this is referring to?

reply

meowface 0 minutes ago | link

Read through https://nealpoole.com/blog/2011/04/setting-up-php-fastcgi-an...

-----

Synless 2 hours ago | link

If you changed that to using the Hawaitha config format it would be perfect ;)

reply

stephth 1 hour ago | link

Interesting article. And congratulations for the release!

Sorry this is a bit off-topic (and doesn't apply to H2O as it's been in the works for a while looking at the commits), but I wonder, today, with a language like Rust (1.0 is at the door [1]), as performant as its safe C equivalent but modern and safe by design (and with an escape hatch to C/C++ if needed), what would be the advantages of starting a long term project of this type in C today?

[1] http://blog.rust-lang.org/2014/12/12/1.0-Timeline.html

Edit: why the downvotes?

reply

coldtea 1 hour ago | link

Rust is not even 1.0.

And even if it was, it would take 3-5 years until it gets any decent adoption (if that happens, which remains to be seen). It doesn't even have Go level adoption yet, and Go's adoption is not something to write home about either.

C, people know very well, has tons of tooling, plays well in all platforms and has all the libraries in the world available for it.

reply

rakoo 1 hour ago | link

> Go's adoption is not something to write home about either.

I wouldn't say so... Go may not be as widespread as other older languages, but the speed at which it's taking over new developments (and sometimes re-writes) can't be glossed over that easily.

Regarding GP's comment, I believe the number 1 argument why that project is started in C is performance. Even nginx, which is also written in C, can't match H2O's speed; I doubt Rust with all the micro-management you can have could beat this level of dedication towards performance.

reply

hueving 21 minutes ago | link

>Edit: why the downvotes?

You could just have easily have asked why it wasn't written in Lisp. It's just not relevant.

reply

justincormack 1 hour ago | link

Not relevant to the article "doesn't apply to H2O as it's been in the works for a while looking at the commits"...

reply

PythonicAlpha 1 hour ago | link

I think, it is because language fights are not appreciated so much here.

reply

halayli 46 minutes ago | link

This doesn't look like a complete HTTP server, comparing it with nginx is not fair.

. It's missing content-encoding handling on the receiving side

. No http continue support

. No regex routing support

. No header rewrites

to name a few.

reply

Shish2k 2 hours ago | link

Looking at the tangentially linked qrintf project that H2O uses ( https://github.com/h2o/qrintf ), replacing generic sprintf calls with specialised versions for a 10x speed boost - that seems like a brilliant idea, I wonder why it took so long for somebody to think of it?

reply

chubot 2 hours ago | link

People have thought of it -- there's probably just not that many applications where sprintf is a bottleneck. Especially enough of a bottleneck to justify a code gen tool.

The OCaml community, and probably others, have noted that printf is an embedded DSL and treat it as something to be compiled rather than interpreted.

http://okmij.org/ftp/typed-formatting/

http://caml.inria.fr/pub/docs/manual-ocaml/libref/Printf.htm... (I have a memory of this being type safe and doing stuff at compile time but I don't see it now)

Rust borrows heavily from OCaml, and uses compile time macros for printf and regex, i.e. format! and regex! (the trailing ! means it's a macro that can be further compiled by the compiler).

http://doc.rust-lang.org/std/fmt/

http://doc.rust-lang.org/regex/regex/index.html

reply

Someone 2 hours ago | link

A quick google gave me https://gcc.gnu.org/ml/gcc/2007-10/msg00073.html, so at least somebody thought of it over 7 years ago.

Also, http://www.ciselant.de/projects/gcc_printf/gcc_printf.html#p... shows gcc did something in this area 9 years ago.

http://www.cygwin.com/ml/libc-hacker/2001-08/msg00003.html indicates gcc had printf optimizations in 2001.

I expect there are older examples.

qrintf seems to be 'just' a more aggressive version of this.

I guess being more aggressive makes sense in applications that do a lot of simple string formatting.

reply

nly 2 hours ago | link

One of the problems with compiling print/scanf is that a lot of the overhead comes from locale handling, which is a runtime variable. Parsing is fairly negligible for short format strings.

reply

justincormack 1 hour ago | link

Few applications want locale support. Mostly you want reproducible output.

reply

robbles 1 hour ago | link

> Instead, switching back to sending small asset files for every required element consisting the webpage being request becomes an ideal approach

This doesn't solve the other side of the problem that spritesheets are meant to solve, namely that an individual image will not be loaded yet when the first UI element using it is displayed (e.g. in a CSS rollover, or new section of a SPA appears). I can't see a way that new protocols are going to solve this, unless I'm missing something in how HTTP2 is going to be handled by the browser?

I assume that once you're forced to preload everything you might need for the page, it's no longer more efficient to break up into multiple tiny requests.

reply

zub 1 hour ago | link

> I can't see a way that new protocols are going to solve this, unless I'm missing something in how HTTP2 is going to be handled by the browser?

HTTP/2 server push. Your server can proactively deliver things like rollover state graphics knowing that the client will need them.

reply

robbles 1 hour ago | link

good point. I imagine determining when to push these assets will become a complex choice though.

Also, I realized shortly after commenting that I missed the obvious benefit of avoiding downloading global spritesheets and other compiled assets for individual pages that only use a subset of the content.

reply

jarnix 2 hours ago | link

Obviously it's great software. Does Kazuho work alone on this ? If it's meant to replace nginx, it needs a lot of other options/functions/extensions/modules/...

Is it getting commercial support/funds ?

reply

kazuho 2 hours ago | link

Contributors are highly welcome, obviously!

For myself, developing H2O is part of my job at DeNA (one of the largest smartphone game providers in Japan).

reply

zzzcpan 2 hours ago | link

Socket API is a bottleneck now, right? So, next step: roll your own http-friendly tcp stack on top of netmap/dpdk and get 10x performance increase over nginx.

reply

ams6110 2 hours ago | link

Another one to keep an eye on might be the new httpd in OpenBSD. http://www.openbsd.org/cgi-bin/man.cgi/OpenBSD-current/man8/...

I'm not seeing that there is yet a portable version however.

reply

justincormack 1 hour ago | link

It is not intended to be anything other than a minimal secure http 1 server, not performant.

reply

xfalcox 56 minutes ago | link

Any plans to get script support, like nginx access_by_lua?

reply

caycep 1 hour ago | link

whoa, and here i was thinking nginx was the be all end all of sweet sweet blistering speed...

reply

PythonicAlpha 2 hours ago | link

Looks very promising!

I am not so much into web-servers (yet), but I found this in the feature list:

  reverse proxy
    HTTP/1 only (no HTTPS)
Are there any plans to add also HTTPS-support for reverse proxy? Since I have to include a secondary (Tornado) web-server unto my stack for dynamic pages.

It also puzzled me, that https is not supported, but in the benchmarks I found a part: "HTTPS/2 (reverse-proxy)". As I said, I am not so much in Web-servers and https/2, but that was a little confusing.

reply

kazuho 2 hours ago | link

Sorry for the confusion.

HTTP and HTTPS (both version 1 and 2) are supported for downstream connections (i.e. connection bet. H2O and web browsers). Only plain-text HTTP/1 is supported for upstream connections (connection bet. H2O and web application servers).

reply

michaelchisari 50 minutes ago | link

Don't be afraid to not add features. I'd love to see something like this stay as a very high speed server, especially with the move towards single-page static apps that connect to restful services.

There's plenty of kitchen sinks out there.

reply

PythonicAlpha 1 hour ago | link

Thank you very much for the answer!

To clarify for my mind:

Can I than use H2O to connect to a web-browser via HTTPS and H2O is routing the same request upstream via HTTP to a web application server? (that of course would suffice for me).

reply

kazuho 1 hour ago | link

Yes, assuming that you wanted to say: "web-browser connect to H2O via HTTPS".

reply

PythonicAlpha 45 minutes ago | link

Of course! Excuse my bad English!

reply

mp3geek 1 hour ago | link

Is spdy supported?

reply

rgbrenner 1 hour ago | link

spdy == http 2

reply

PythonicAlpha 1 hour ago | link

Is it really the same (really asking)?? Sometimes there are subtle protocol changes, when something is standardized -- and as much I understand, HTTP/2 took a while ...

reply

rgbrenner 1 hour ago | link

the initial http 2.0 draft was just a copy of spdy (in nov 2012). There have been changes to 2.0, so they aren't exactly the same.. but http 2.0 is meant to completely replace spdy.

Any of the servers/clients that support spdy currently will eventually make the minor changes, and call it http 2.0.

reply




Guidelines | FAQ | Support | Lists | Bookmarklet | DMCA | Y Combinator | Apply | Contact

Search: