Static webserver: Shortest possible wait: Low activity: Node JS vs bare bones Java thread based

Problem

I am grasping Node JS after already knowing Java.

Given the task to write a webserver that serves one page load every second. These are static pages. However, sometimes the page load consists of only the HTML doc and the images/css/js are cached on the browser… sometimes there are non cached assets that will be loaded separate from the HTML.

Node JS uses the event driven model.

Java can use either an event based or a thread based model.

Which model is better in this case when trying to get just a few milliseconds of wait.

How much better would it be to use Node JS over Java given the decision to use an event based model.

Problem courtesy of: George Bailey

Solution

For the scenario you describe, it does not matter at all whether the server is thread-based synchronous or event-based asynchronous. The difference is mainy relevant when serving a very large number of concurrent requests.

The biggest factor in reducing the load time of static pages is the design of the pages themselves, followed by tuning of the network stack and protocol like increasing the TCP initial window as practised by Google.

Solution courtesy of: Michael Borgwardt

View additional discussion.