Git Product home page Git Product logo

hellgrenj / hulken Goto Github PK

View Code? Open in Web Editor NEW
295.0 295.0 14.0 195 KB

Hulken is a stress testing tool for everything speaking HTTP. Hulken supports multiple urls, GETs and POSTs, static and dynamic payloads, multiple agents and more. Hulken is highly configurable but defaults to some reasonable settings. Hulken works both as a library and a stand-alone command line tool. Hulken is swedish for The Hulk.

JavaScript 100.00%

hulken's Introduction

Hi!

I like to create stuff and share it with others.

...and sometimes my clients let me open source stuff i build for them as well!
for example:

slu-docbot
a QA bot using Retrieval-Augmented Generation (RAG), Redis, Semantic Search, OpenAI and Python.

pg_event_stream
a proof-of-concept for using Postgres as an event stream with one or more producers and multiple consumers using topics and the NOTIFY and LISTEN commands.

hulken's People

Contributors

hellgrenj avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

hulken's Issues

Unable to use non-string payload for POST

I tried to add a more complex payload to hulken and found that it does not support non-string values due to it's randomize feature.

Sample playload:

[
  {"method":"POST","path":"/foo","payload": {"value":1}}
]

And the error stack trace:

.\node_modules\hulken\lib\worker.js:147
      if (propertyValue.substring(0, 2) == '::') {
                        ^
TypeError: undefined is not a function
    at Object.worker._setPostValues (.\node_modules\hulken\lib\worker.js:147:25)
    at Object.worker._makePOSTrequest (.\node_modules\hulken\lib\worker.js:126:10)
    at null._onTimeout (.\node_modules\hulken\lib\worker.js:105:24)
    at Timer.listOnTimeout (timers.js:119:15)

Command line tool produces wrong response times

Hi,
when I use the command line tool to test a simple CORS AJAX web service I get response times wrong by a factor of 50.

I tested with different web services, here is an example.

$ hulken bitcoin_options.json 
setting options from file bitcoin_options.json
number of times to repeat each request set to 10
target url set to https://blockchain.info/ticker
request file path (including file name) set to ./bitcoin_request.json
the following characters (in an url) will cause a request to be skipped :,{,}
happyTimeLimit set to 10
numberOfHulkenAgents set to 1
slowRequestsTimeLimit set to 0.5
angryOnFailedRequest set to true
chatty set to true
happyMessage set to HULKEN PLEASED, YOU MAY CONTINUE WITH YOUR DAY!
angryMessage set to HULKEN ANGRY! HULKEN SMASH!
minWaitTime set to 500
maxWaitTime set to 4000
headers set to {"Accept":"application/json, text/javascript, */*; q=0.01","Accept-Encoding":"gzip, deflate, sdch","Accept-Language":"en,de;q=0.8,en-US;q=0.6,it;q=0.4","Cache-Control":"no-cache","Connection":"keep-alive","Pragma":"no-cache","User-Agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/40.0.2214.45 Safari/537.36"}

 ..::HULKEN SMASH::.. 

initiating agent 1 of 1
... no login required, continuing with anonymous user
... starting to execute requests
GET ?cors=true (by agent 1/1) responded in 8.494 seconds
GET ?cors=true (by agent 1/1) responded in 7.47 seconds
GET ?cors=true (by agent 1/1) responded in 7.398 seconds
GET ?cors=true (by agent 1/1) responded in 9.561 seconds
GET ?cors=true (by agent 1/1) responded in 9.27 seconds
GET ?cors=true (by agent 1/1) responded in 8.376 seconds
GET ?cors=true (by agent 1/1) responded in 7.283 seconds
GET ?cors=true (by agent 1/1) responded in 7.397 seconds
GET ?cors=true (by agent 1/1) responded in 9.067 seconds
GET ?cors=true (by agent 1/1) responded in 11.115 seconds
.. all requests have been executed

 **************** RESULT ******************
number of concurrent requests 10
number of hulken agents running 1
number of unique requests 1
number of slow requests 10
number of failed requests 0
total seconds elapsed  15.058
avg response time (in seconds)  8.5431
req/sec 0.66
random request wait time (in seconds) 0.5-4
******************************************
HULKEN ANGRY! HULKEN SMASH!

In contrast when I employ the Chrome browser API using jQuery I get an average response time of 123ms. The browser cache is disabled and I confirmed that the 23 request in my test yielded unique api responses. The JavaScript measurement is consistent with the measured times in the Network panel of the Chrome developer tools.
Here is the simple code:

var
    dT = 200,
    varDT = 100;

function callingBC()
{
    $.ajax("https://blockchain.info/ticker",
        {
            data: { cors: true },
            dataType: "json"
        })
        .then((function(startTime)
        {
            return function( data, textStatus, jqXHR )
            {
                responseTimes.push(Date.now() - startTime);

                if (!abort)
                {
                    var waitFor = dT + Math.random() * varDT - varDT / 2;

                    setTimeout(callingBC, waitFor);
                }
            };
        }(Date.now()))
        , function( jqXHR, textStatus, errorThrown )
        {
            console.log(textStatus, errorThrown);
        }
    );
}

What am I doing wrong?

Best regards
Semmel

File upload support

Does this support uploading files (I can't see it in the documentation)? I want to test ~20mb file uploads

Add an option, perhaps named `requests`, that overrides the need for using `requestsFilePath`

It would be helpful to be able to simply include the requests array inside an options.json file rather than requiring a reference another requests.json file for loading at runtime.

Providing this would:

  • Allow ability to add hulken as a devDependency to other modules; rather than requiring it to be installed globally
  • Fix path resolution issues when using the hulken cli as a devDependency (e.g. when using export PATH="node_modules/.bin:$PATH")
  • Reduce file clutter

I recommend something like this:

if (hulken.settings.requests) {
  hulken.requestsInfo = JSON.parse(hulken.settings.requests);
  return worker._authenticateAgentsRecursive(0, worker._executeRequests);
}

fs.readFile(hulken.settings.requestsFilePath, 'utf-8', function(err, data) {
    if (err) throw err;
    hulken.requestsInfo = JSON.parse(data);
    worker._authenticateAgentsRecursive(0, worker._executeRequests);
  });

In place of this:
https://github.com/hellgrenj/hulken/blob/master/lib/worker.js#L16-L20

Headers option in path configs

Authentication is done by a different service from my API.
I need to pass an authentication header value into my app for load testing. I'd love to see this as a configuration option to the paths.

Tiny doc error

The example:
"The requestsFile is a json file and looks like this."

“foo”: “bar”
}]

should be

“foo”: “bar”
}}]

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.