3 ms·
From a performance perspective, you can split the work here into two parts: 1. Reading and parsing HTTP requests, miscellaneous book-keeping. 2. Transferring
by pjscott 15y ago
From a performance perspective, you can split the work here into two parts:
1. Reading and parsing HTTP requests, miscellaneous book-keeping.
2. Transferring a (cached) 1 MB file to a socket.
Netty is plenty fast at #1. At #2, both the Java/Groovy code in this benchmark and the corresponding code using Netty (versions >= 3.2.0) will be doing essentially the same thing: they will have the kernel do a zero-copy write from the filesystem cache directly to the socket. (The node.js version given here repeatedly copies from the filesystem cache into a buffer in its heap, and then writes that to the socket. This involves more memory copying and context switching. Neither Netty nor the author's own framework has this issue.)
So, I doubt there would be any significant performance advantage over Netty.