Security News
OpenJS: “XZ Utils Cyberattack Likely Not an Isolated Incident”
OpenJS is warning of social engineering takeovers targeting open source projects after receiving a credible attempt on the foundation.
Weekly downloads
Readme
npm install siege --save
http benchmark
siege()
.on(3000)
.for(10000).times
.get('/')
.attack()
save as benchmark.js
and run
node benchmark.js
siege(cmd)
can start service before benchmark, stop service after benchmark, for agile development.
siege('node /path/to/app.js')
.on(3000)
.get('/')
.attack()
You can also use siege('/path/to/app.js')
to benchmark http handler of nodejs, require('app.js')
must return a function(req, res)
.
siege(__dirname + '/app.js')
.on(3000)
.get('/')
.attack()
Code above will start server listen at port 3000, benchmark module will connect to 3000. You can ignore .on(3000)
, default is .on('/tmp/siege.sock')
Server maybe need a little while to prepare, use .wait(ms)
let benchmark wait a moment to do benchmark.
siege(__dirname + '/app.js')
.wait(1000)
.get('/')
.attack()
Use method(url, params)
to define task, you can define multiple tasks, this will help you figure out which page is slow on your site.
siege()
.get('/')
.post('/hello', {hello: 'world'})
.attack()
Tasks will execute as define order one by one.
Use .for(n).times
define repeate times, use for(n).seconds
define duration, you can use on siege for all tasks,
or use it on single task.
siege()
.for(10000).times
.get('/').for(2).seconds
.get('/about').for(3000).times
.get('/contact')
.attack()
Code above, /
will do benchmark for 2 seconds, /about
will do for 3000 times, /contact
will do for 10000 times.
Use .concurrent(n)
to control concurrent request. default is 15
siege()
.concurrent(100)
.get('/')
.attack()
Use .withCookie
to enable cookie jar, so you can do benchmark on the page require login.
siege()
.withCookie
.post('/login', {user: pass}).for(1).times
.get('/')
.attack()
Use .attack()
to start siege attack.
In theory Siege can do benchmark on multiple app.
siege('app1.js')
.get('/')
.attack()
siege('app2.js')
.get('/')
.attack()
But under unknow reason, after first app done, seconde app will quit. You have two options,
Siege will add new feature base on requirement, we have with304
options, but it is not implement.
Siege also want more beautiful report.
It's welcome to send a pull request.
FAQs
http benchmark by nodejs
The npm package siege receives a total of 300 weekly downloads. As such, siege popularity was classified as not popular.
We found that siege demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
OpenJS is warning of social engineering takeovers targeting open source projects after receiving a credible attempt on the foundation.
Company News
Come meet the Socket team at BSidesSF and RSA! We're sponsoring several fun networking events and we would love to see you there.
Security News
OSI is starting a conversation aimed at removing the excuse of the SaaS loophole for companies navigating licensing and the complexities of doing business with open source.