8 ms·
Nxweb – Fast and Lightweight Web Server
- giancarlostoro 11y agoWhich Python is supported? Python 2 or 3? For some it makes a big difference. I really want to play with this, also what OS? Only Linux? I am trying to find it on the site but I'm not seeing it, maybe adding it on the front page or in an FAQ would help (requires creating an FAQ page or section). Thanks! Looks interesting otherwise.
- hayksaakian 11y agoit says > Limitations: > - only tested on Linux
- sanxiyn 11y agoPython 2, since https://bitbucket.org/yarosla/nxweb/src/tip/src/lib/modules/python.c https://bitbucket.org/yarosla/nxweb/src/tip/src/lib/modules/... uses PyInt_FromLong, which was replaced by PyLong_FromLong in Python 3. On the other hand, it doesn't look hard to port.
- molixiaoge 11y agoit is just for linux.
- RUG3Y 11y agoLooks cool. Must have Python 3 for me to use, would definitely try it out if it's supported.
- ktRolster 11y agoA lot of ad-tech companies build ad-servers in C, because the latency is so crucial in that context.
- geocar 11y agoSpecifically it's garbage collection. e.g. node.js has no problem getting 20k/sec per core, but a stall at the wrong time kills every pipelined HTTP request that follows (until you tear down the connection and restart it).
- deleted 11y ago[deleted]
- ex3ndr 11y ago20k/sec is a joke performance. Java/Scala with Akka handles millions of packages per sec and this is performance.
- geocar 11y ago40k/sec http requests (no pipelining) per core is about as fast as it gets unless you move TCP into user space. Reports of "millions per sec" are usually talking about messages on established channels across all CPUs. If you're actually aware of a java based web server that can beat even 150k http requests measured by wrk or similar on local host I'd like to see it.
- deleted 11y ago[deleted]
- zzzcpan 11y ago> 40k/sec http requests (no pipelining) per core is about as fast as it gets unless you move TCP into user space. I think it can be micro-optimized beyond that. With predictions to avoid unnecessary syscalls, with syscalls grouped together to make cpu more efficient for the rest of the time it spends in event loop, and if it's possible to modify kernel a bit - with batching syscalls together to make them very cheap.
- geocar 11y agoAt some point, your complexity gets bigger than simply coding a state machine that operates directly on the network buffers themselves: That is to say, I suspect that if micro-optimisations can double our performance, they will be more complicated than just writing a customised ring0 that implements HTTP directly inside the network driver. Here is how I'm looking at it: • 10Gb/sec network port • 4k max requests and responses • == 1.3 million HTTP requests per second. Now the problem is that main memory is not much faster than our fastest network: About 15Gb/sec, so what we're talking about here is code and state staying entirely in L1, and streaming the network buffers across the CPU, and responding in one pass, to get that 1.3 million optimal performance. My dash server gets ~135k HTTP requests per second on localhost (I should be able to approach 300k/sec over a network if I ever get around to it). That's 22% of our optimal performance, and a lot better than any other HTTP server I'm aware of. At this speed, one of those micro-optimisations `writev()` is actually slower than `write()` -- likely because the code path is shorter in the simpler codebase -- but it illustrates my concern nicely: That we are close to that break-even point with the optimisations we can make. If we make our server bigger and more complicated, it might not make our programs any faster. That suggests to me that the solution is actually fewer, simpler syscalls, not more, bigger ones.
- pjmlp 11y agoOr they don't know any better. I took part in a few projects that replaced high throughput servers handling mobile network traffic from C++ to Java.
- faint_coder 11y agoOr maybe THEY don't know any better way to optimize/use C++ instead of switching to Java
- pjmlp 11y agoGiven that I remember the days when C and C++ compilers generated code worse than a junior Assembly programmer, I always find such comparisons interesting. Not that they aren't true, rather their validaty depends a lot of programmer skillset and compilers being used.
- deleted 11y ago[deleted]
- goldenkey 11y agoJava is garbage unless you specific 20 -D options to bend it to your will.
- eva1984 11y agoCan confirm. I work at two ad-tech related companies, one large one medium, both use Java from the beginning. And I know other company using Python/Golang as well. Didn't know C(not C++) is particular popular until today. Note that ad company are pretty business focused, add or remove features for big clients are pretty common, so development efficiency matters a lot.
- glossyscr 11y agoWhy? While Nxweb looks very promising, my first question would be 'Why should I use it over eg Nginx?' It would be helpful to have some direct comparison to other servers on the landing page. EDIT: Ok, there is a link to some odd benchmarks and it includes performance comparisons to Nginx and others which are not understandable (Nginx 141 req/s and Nxweb 200 / 121 req/s while it's not clear when 200 and when 121); moreover they compare it to Mongoose which is an ORM/ODM
- sanxiyn 11y agoMongoose is a web server. See https://github.com/cesanta/mongoose https://github.com/cesanta/mongoose. It's obviously not https://github.com/Automattic/mongoose https://github.com/Automattic/mongoose.
- chrissnell 11y agoThose benchmarks are well and great but with HTTP/2 support in nginx, do they even matter? I'm reasonably certain that nginx will out-perform for the average client in real-world, TLS-enabled testing.
- rand1012 11y agoI want to use it on Raspberry Pi
- rdw 11y agoTook me a bit of searching to figure out the 200/121 numbers. The answer: "first measurement is for inprocess handler, second is for inworker handler"
- bigdubs 11y agoSeems cool, but curious if teams have investigated golang for these use cases, specifically if throughput is sufficiently high and the GC pauses are sufficiently small.
- 22klinda 11y agoI would like to see how good it perform against a webserver like cowboy.
- elcct 11y agoI remember playing with it some time ago. Pretty cool thing.
- joosters 11y agoThey discount using CGI, which is fair enough, but why not use FastCGI? It's a sensible enough protocol, there are libraries for most languages and there's a good chance that your existing web server supports it. Technically, there's no good reason why a FastCGI based system would be significantly slower than a custom reimplementation like this.
- geocar 11y ago> Technically, there's no good reason why a FastCGI based system would be significantly slower than a custom reimplementation like this. An HTTP server speaking to a FastCGI application will: • read the HTTP message • decode HTTP • encode FastCGI • write to application The FastCGI application will then: • read the FastCGI message • decode the FastCGI message • do application stuff • encode the FastCGI response • write to the web server The webserver then resumes: • reading the FastCGI response • decoding the FastCGI response • writing the HTTP response Meanwhile, an in-process HTTP server (like nxweb) system will simply: • read the HTTP message • decode HTTP • do application stuff • write the HTTP response Less code runs faster; it is obvious to me why this is faster.
- iMerNibor 11y agoI'd imagine encoding/decoding will be really insignificant compared to generating the requested page or fetching data from a database in most, if not all, cases
- geocar 11y agoMost websites do not see more than 100 requests per second. In those cases you are correct: parsing and de-parsing is insignificant compared to the amount of energy the computer is using to heat the room. However in order to do a trillion requests per day you need around 30 machines using a custom web server, or 300 machines using Fastcgi: In this situation the cost is an order of magnitude.
- mhd 11y ago
- amelius 11y agoDoes it support HTTP 2, or will it in the future?
- mp3geek 11y agohttps://groups.google.com/forum/?hl=en#!topic/nxweb/8NAnQ0ImYSE https://groups.google.com/forum/?hl=en#!topic/nxweb/8NAnQ0Im... Unlikely, and given his attitude I'm not going to waste my time trying nxweb.
- lox 11y ago> "No plans so far. Why whould you need it? Yeah, nope. Check out H2O if you haven't already https://h2o.examp1e.net/ https://h2o.examp1e.net/.
- susi22 11y agoIf CloudFlare can handle many thousands of sites [1] with nginx+lua then I'm not sure if it's worth it to go the C route. [1] https://groups.google.com/d/msg/openresty-en/aoBL22H8fP4/bJ3LrHHfGAAJ https://groups.google.com/d/msg/openresty-en/aoBL22H8fP4/bJ3...
- kjs3 11y agoNginx is written in C, no? So is Lua?
- ex3ndr 11y agoSome questions: 1) Why you think that java is slower than C++? Server-side JIT compiles much more optimized code as it is really know what and how to optimize. 2) What about security? Almost half of the problems in security in last days came from native code stuff.
- Ace17 11y ago"Server-side JIT compiles much more optimized code as it is really know what and how to optimize." While this seems perfectly plausible, would you happen to know some benchmark backing this claim? Thanks.
- iso-8859-1 11y ago> half of the problems citation needed > native code stuff That is inaccurate. But if you said that it comes from C memory management issues, that sounds more plausible. We could talk about Rust, but I even think that C++ is usually written in a much safer style than C.
- thenomad 11y agoThe templating engine is an interesting, and slightly curious, addition here. It looks significantly more flexible than anything nginx offers without having to bolt on a server-side language like PHP - unless nginx has something similar in its millions of modules that I'm not aware of. (I know about and love nginx SSIs, but the templating here looks more flexible than them.)
- Ace17 11y agoAgain?
- jedisct1 11y agoH2O is also written in C, is also easy to embed, and supports HTTP/2. https://h2o.examp1e.net/ https://h2o.examp1e.net/
- iso-8859-1 11y agoOther than being C and not C++, how does it compare to CppCMS (not a CMS)? http://cppcms.com/wikipp/en/page/main http://cppcms.com/wikipp/en/page/main
- arca_vorago 11y agoIm curious about security features, which are one of the main reasons I have been using Hiawatha.
- ramr 11y agohttps://github.com/facebook/proxygen https://github.com/facebook/proxygen C++, used by Facebook in production. We have been using it in a high performance RTB application and has performed remarkably well.
- niksmac 11y agoI am so glad to see nginx is there to give a competition that Nxweb deserves.
- chx 11y agoTechnical prowess is one thing, support is another. There are 20 times as many openresty questions (although still very few) on stackoverflow than nxweb and the few nxweb questions there are from years ago. I am not sure why is this on hacker news frontpage suddenly.
- known 11y agoGood initiative;