Clock Your (server) Speed!

Who wants a slow website? Backend Devs try to write their server code in ways that makes it run really fast. The faster it runs, the faster the website loads in browsers. There are really easy ways to check how fast your server is, also known as benchmarking.

Install NPM Benchmarking Module

Because Node.js is open source, a lot of people have written useful pieces of code for common tasks. The library of all these tools is called NPM, Node Packaged Modules, and you can browse at If you find you need a certain kind of tool, before you make it yourself, check NPM to see if it's been made already!

We'll install this module -g, which means globally, so that we can use it for more than just one project. Next, navigate to where our server is from the earlier challenge,

npm install -g nab
cd super-simple-server

Clock your Speed!

Now we'll test our speed. We're doing this by blasting our server with lots of requests and then seeing how well/fast it's responding. We're going to give it 1000 requests and send them in groups of 100 at a time!

nab -n 10000 -c 100 http://localhost:3000

It will respond with a report similar to the one below. The time is in miliseconds, so totalUsetime: 4566 means about 4.5 seconds total to handle all those requests!

    Benchmark runing [=========================================================================
    ==========================] 100% 0.0s
    { requests: 10000,
      concurrency: 100,
      totalUsetime: 4566,
       { averageUsetime: 2348.8199,
         count: 10000,
         min: 662,
         max: 3874,
         qps: 2190.1007446342533,
         times: {} },
       { 'Request timeout for 10000000000ms.:-1': 
          { averageUsetime: 2341.6781,
            count: 9900,
            min: 916,
            max: 3874,
            times: {} },
         'connect ECONNREFUSED:-1': 
          { averageUsetime: 7.1418,
            count: 100,
            min: 662,
            max: 776,
            times: {} } } }