Skip to content

Simple server for simulating server CPU, memory, network load

License

Notifications You must be signed in to change notification settings

luoyjx/mock-load-server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mock-load-server

Simple server for simulating server CPU, memory, network load

Pre-requisites

  • Node.js

Usage

install dependencies

npm install

install pm2 globally

npm i -g pm2

start server

# set max memory limit to 4GB
pm2 start app.js --node-args="--max-old-space-size=4096"

API Usage

# mock CPU load
curl http://localhost:3001/cpu
# mock memory leak
curl http://localhost:3001/mem
# mock network data output
curl http://localhost:3001/net > /dev/null

Add crontab on other server

you can change the rule depending on your needs

# For more information see the manual pages of crontab(5) and cron(8)
#
# m h  dom mon dow   command
*/3 * * * * curl http://your-server-address:3001/cpu
*/4 * * * * curl http://your-server-address:3001/mem
*/5 * * * * curl http://your-server-address:3001/net > /dev/null

About

Simple server for simulating server CPU, memory, network load

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published