Go v1.15.8 vs Node v14.15.5 Microbenchmark

Multithreaded JavaScript has been published with O'Reilly!
DEPRECATED: This post may no longer be relevant or contain industry best-practices.

This is my fourth annual microbenchmark comparing a very simple Node.js and Go HTTP service running on the local machine. Usual disclaimer: this benchmark is highly contrived and doesn't resemble real-world usage. If you'd like to view the code for the benchmark visit the original benchmark post.

As per usual we run the benchmark using a tool called siege:

siege -t 2m -b http://localhost:8000/

The results are as follows:

Node v14.15.5

Transactions:                1062379 hits
Availability:                 100.00 %
Elapsed time:                 119.59 secs
Data transferred:              15.15 MB
Response time:                  0.00 secs
Transaction rate:            8883.51 trans/sec <--
Throughput:                     0.13 MB/sec
Concurrency:                   24.49
Successful transactions:     1062379
Failed transactions:               0
Longest transaction:            0.05
Shortest transaction:           0.00

Go v1.15.8

Transactions:                2397471 hits
Availability:                 100.00 %
Elapsed time:                 119.37 secs
Data transferred:              33.24 MB
Response time:                  0.00 secs
Transaction rate:           20084.37 trans/sec <--
Throughput:                     0.28 MB/sec
Concurrency:                   22.86
Successful transactions:     2397473
Failed transactions:               0
Longest transaction:            0.02
Shortest transaction:           0.00

Takeaway

Go is 2.26x as fast as Node.js for this particular benchmark. Node.js is relatively slightly faster this time, as the last time I ran this benchmark Go was 2.69x as fast as Node.js.

Thomas Hunter II Avatar

Thomas has contributed to dozens of enterprise Node.js services and has worked for a company dedicated to securing Node.js. He has spoken at several conferences on Node.js and JavaScript and is an O'Reilly published author.