Giter Club home page Giter Club logo

vanilla-clustering-with-fastify's Introduction

Source of app code: https://gist.github.com/thearegee/3eea038b9f0c5e94de73f3c3482fa732

Documentation of cluster module form nodejs documentation: https://nodejs.org/api/cluster.html#clusterismaster.

fastifyjs uses autocannon to benchmark and autocannon is actually really good in benchmarking though. Source: https://github.com/fastify/fastify#benchmarks

Amazing, Genuine article about load testing *IMO: https://dev.to/ku6ryo/benchmarking-next-js-on-fastify-custom-server-mg4

Another nice article for using pm2: https://medium.com/@tzilist/clustering-node-js-with-pm2-with-benchmarking-e3a7daf792ba

Another fork I made from a benchmarking repo for pm2 for clustertesting: https://github.com/sahilrajput03/pm2_clustering_test

Load test commands:

# Make 15k concurrent requests for 5 seconds
autocannon -c 15000 -d 5 localhost:8123
# Output: So it takes around 13 seconds to complete and total of around
# 115k requests.

# Make 1L requests, 20k concurrency.
ab -n 100000 -c 20000 http://localhost:8123/

# Make 10k each from 10 users (i.e., 10k concurrency, total of 1L requests).
artillery quick --count 10 --num 10000 http://localhost:8123/

For insights about testing tools:

visit: https://www.npmtrends.com/ab-vs-artillery-vs-autocannon-vs-loadtest-vs-wrk

  • Install testing tools:

    • ab: Apache Bench sudo pacman -S apache (for archlinux)
    • autocannon: npm i -g autocannon
    • artillery : npm i -g artillery

  • Fixing ab's eror of too many files open: Max what i can set is ulimit -n 100000 i.e., a maximum of 1 lakhs open file descriptions limit can be set. FYI: YOu can see the help for ulimit @ ulimit --help.

    Source: https://stackoverflow.com/a/1504603/10012446

    ~Sahil: This was helpful to get rid of error from ab i.e., too many files are opened. Yikes!! FYI: I ran above command in stackoverflow with value like 100000 so it can handle that many file descriptions, yikes!

vanilla-clustering-with-fastify's People

Contributors

sahilrajput03 avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.