R3 – High-performance URL router library in C
github.com
github.com
this router library can be used for different purpose (outside of URL dispatching), although we don't gain so much performance from the point of view of each single request.
Not to be confused with my Ruby REST gem of the same name:
If we consider complexity before everything, we must use PHP to implement an OS. :-p
The slowest URL router benchmarked there[1] does 10462.0 runs per second, which is just under 0.1ms per run.
I'm not sure what performance is expected of Rails handlers but the first stackoverflow thread[2] that came up on a simple Google search had twitter doing 600 req/s across 180 instances which comes to 300ms per request.
By that math, the slowest URL router costs 0.033% of the request overhead.
Caveat: 300ms/req is slower than you'd like for an interactive website; real websites may have more complicated routing tables than this benchmark. Counter-caveat: 0.1ms is not enough to matter pretty much anywhere except for the stock market.
[1]: https://github.com/c9s/r3#benchmark
[2]: http://stackoverflow.com/questions/373098/whats-the-average-...
Assume Rails has improved hugely since then, 600 req/s over 180 instances is absolutely abysmal performance O_o
I'd expect Rails to clock in well under 300ms per request now, and looking at Basecamp's site[2], that seems to be the case, impressively snappy page loads (if caching the kitchen sink and not hitting live Rails stack then we'd need to look at a different example, but this site has pretty much optimal load time).
[1] https://blog.twitter.com/2013/new-tweets-per-second-record-a...
This + libev/libuv + the Node.js HTTP parser makes a nice little application server.
You shouldn't go replacing your Ruby apps with C but there are many cases were embedding Ruby/Python/etc into your C app just doesn't make sense and this is a good way of bringing nice features from those more webby frameworks to C.
and in order to ship this package to deb, deploy to different platform, use autotools to test C features is a requirement. (we used to build the project with cmake before we use autotools)
I too reliably avoid libraries that depend on these old bloated tools (although I appreciate its helpful for packaging; the script complexity and lack of portability is undeniably a trade off cost in using automake; the usefulness of this library for me would be for a static embedded use case, where automake is of questionable value)
to use it for a static embedded use case, you may write your own build script to compile the library (it's not hard to write one). the cflags are describe in src/Makefile.am
and you can use pkg-config to list the flags you need.
- cross-compiling
- extra flags (ie. for hardening) for various commands
- non-standard install location
- non-standard compiler location
- skipping/adding steps (strip/nostrip)
...