Skip to content

GitLab

  • Menu
Projects Groups Snippets
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in / Register
  • S ServerClientTestInNodeJSRedis
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 0
    • Issues 0
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 0
    • Merge requests 0
  • Deployments
    • Deployments
    • Releases
  • Monitor
    • Monitor
    • Metrics
    • Incidents
  • Packages & Registries
    • Packages & Registries
    • Package Registry
    • Container Registry
    • Infrastructure Registry
  • Analytics
    • Analytics
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
Collapse sidebar
  • Tashrif Ahmad
  • ServerClientTestInNodeJSRedis
  • Wiki
  • Home

Home · Changes

Page history
Create Home authored Nov 23, 2021 by Tashrif Ahmad's avatar Tashrif Ahmad
Hide whitespace changes
Inline Side-by-side
Showing with 24 additions and 0 deletions
+24 -0
  • Home.md Home.md +24 -0
  • No files found.
Home.md 0 → 100644
View page @ cb5bd30c
This project implements a basic <i>server & client</i> application in <i>Node.js</i><br></br>
##
**server.js:** The <i>server</i> is listening on 'http://localhost:3000' and is connected to a <i>redis</i> database. It receives an user-name from the client, check in the <i>redis</i> database, if exists, response with <i>'Hello user-name(in upper case)'</i> else with 'Oops...'.<br></br>
##
**client.js:** Creates a <i>socket.io-client</i>, which connects to the server and sends an <i>user-name</i> to check if it exists in the <i>redis</i> database.<br></br>
##
**createDatabase.js:** If a <i>key</i> named 'user' exists in the <i>'redis-server'</i>, it deletes it and creates a new <i>set</i> named <i>'user'</i> with 8000 user-name.<br></br>
##
**loadTester.js:** Code for load testing manually. It creates a new client at a given rate and prints number of connected clients every seconds. <br></br>
##
**my-script.yaml:** Script for load testing with <i>['artillery'](https://www.artillery.io/)</i>. It starts with creating (arrivalRate = ) 200 clients per second to (rampTo = ) 10000 clients per second. <i>'functions.js'</i> is used to create a random user-name for each clients that it creates. It also generates reports as <i>'report.json'</i> and <i>'report.html'</i> format. <br></br>
##
**How to use**<br></br>
* Start a redis server at default port. (Head over [here](https://redis.io/topics/quickstart) if you are new in redis)
* Run ```npm i socket.io redis socket.io-client bluebird async-redis```
* Run ```npm run database``` to prepare the database.
* Run ```npm run server``` to start the server.
* Run ```npm run loadtester``` to load test manually.
* Run ```npm run client``` to connect a single client.
* Run ```npm install -g artillery``` to install Artillery. (Only works for node.js version >= 12)
* Run ```artillery dino``` to test if artillery is working.
* Run ```artillery run --output report.json my-script.yaml``` to load test and generate report on <i>report.json</i>.
* Run ```artillery report --output report.html report.json``` to generate graphical report.
\ No newline at end of file
Clone repository
  • Home