New Java Web Server based on mechanical sympathy

639 views
Skip to first unread message

Nathan Tippy

unread,
Feb 16, 2017, 4:44:11 PM2/16/17
to mechanical-sympathy
Today it only hosts static files, but it does so very fast.

https://github.com/oci-pronghorn/GreenLightning

I am in the process of adding an async REST API and have a lot of other features to add.  This is
a fully open source project and I am looking for potential corporate sponsors who would like to help
and priorities the new features. Any suggestions?   You can reach me at ntippy at ociweb dot com

If not please try it out and give me a star over on github. ;-)

The core of the server is all about ring buffers and lock free cache friendly designs.
BTW it works very well on the Zulu Compact 1 32 bit JVM in about 60MB of memory.

Heath Borders

unread,
Feb 16, 2017, 7:24:49 PM2/16/17
to mechanica...@googlegroups.com
This looks very interesting. As someone that admires mechanical sympathizers mostly from afar, what advantages does this server (or the underlying pronghorn implementation) have over netty, which I picked for an example only because I know it a little better. :)

--
You received this message because you are subscribed to the Google Groups "mechanical-sympathy" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mechanical-sympathy+unsub...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Jin Mingjian

unread,
Feb 16, 2017, 9:47:25 PM2/16/17
to mechanica...@googlegroups.com
Nice to see new wheel:) The claimed bench result of Netty is too low. Your bench case and box are similar to that in Techempower benchmark(plaintext/cloud)[1]. As your seen, the GB connection has long history to be saturated for mainstream network libraries. You can join the Techempower benchmark to get more eyes. Although the benchmark has its own problem, it still makes good sense in comparisons given it as a well-known 3rd party benchmark.



To unsubscribe from this group and stop receiving emails from it, send an email to mechanical-sympathy+unsubscribe...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Nathan Tippy

unread,
Feb 17, 2017, 4:38:47 PM2/17/17
to mechanical-sympathy
Yes the goal is to build something which can replace netty in many situations.  More streamlined, less memory consumed and smarter thread scheduling.  In general netty is not very cache friendly and so its difficult to prefetch the right data to keep the cpu fed.  The internal design of netty is more complex and does not lend itself to hot-spot optimizations.  Using a simpler data flow allows for both better understanding of the work done but also empowers the JVM to see where optimizations can be made.

Nathan Tippy

unread,
Feb 17, 2017, 4:59:03 PM2/17/17
to mechanical-sympathy
Looks like the site is showing (100K) the older number I will update it to the the latest.  The best I can get is 160K RPS.
I am very interested in how the netty numbers could be improved. Here is my test code for netty.
I tried to remove everything possible so only netty its self is tested.  Any suggestions?

    final String msg = "{\"x\":9,\"y\":17,\"groovySum\":26}\n";
   HttpServer<ByteBuf, ByteBuf> server = RxNetty.createHttpServer(8080, 
    (HttpServerRequest<ByteBuf> request, HttpServerResponse<ByteBuf> response) -> {            
       try {
           
           response.getHeaders().setContentLength(msg.length());
           
           response.setStatus(HttpResponseStatus.OK);            
    response.writeStringAndFlush(msg);
           return response.close();
       } catch (Throwable e) {
           System.err.println("Server => Error [" + request.getPath() + "] => " + e);
           response.setStatus(HttpResponseStatus.BAD_REQUEST);
           response.writeString("Error 500: Bad Request\n");
           return response.close();
       }
   });
   server.startAndWait();

Peter Booth

unread,
Mar 16, 2017, 1:50:39 PM3/16/17
to mechanical-sympathy
You don't mention your test setup - how is your test client connecte dto your test server? 
If It's 10G do you manage to saturate your 10G connection? Is there a switch between the two hosts?
Do you run out of ephemeral ports? What do latency scatterplots look like for both web servers?

I would strongly suggest that you take the time to install the TechEmpower benchmarks on a pair of test hosts and implement them for GreenLightning. 
If you can show positive results on these benchmarks (or a subset) then people will take you much more seriously than saying
 "with my benchmark X my server is N times faster than server Z."

It took me about two or three hours to install an older version of the TechEmpower benchmarks in my home lab,  for the  dozen different frameworks
that were interesting to me.

I'm suggesting this because microbenchmarks are so, so easy to get wrong, especially with Java. The Tech Empower project is a highly visible,
independent, open source set of trivial micro-benchmarks with a few years worth of published data for over 80 other webservers/frameworks.
It's been fascinating to see how some frameworkers/servers really are 1000x faster than others, and in many cases some quite popular well known 
platforms underperform enormously. The community is pretty helpful. If you can get results that are comparable with the published results then 
you know that you aren't dealing with errors in your experimental process. 

Peter Booth
Reply all
Reply to author
Forward
0 new messages