nodeload icon indicating copy to clipboard operation
nodeload copied to clipboard

HTTPS Support?

Open franklywatson opened this issue 13 years ago • 2 comments

I was checking this out (very cool tool) for testing some HTTPS stuff were doing... I didn't see any explicit support for it mentioned anywhere, so I played around with the code and tried the quick and easy way of changing all the

require('http')

to

require('https')

However, connecting the clients to SSL seems not to work.. Has anyone done this or where else should I look?

Cheers

J

franklywatson avatar Sep 08 '11 21:09 franklywatson

J --

There's no built in support for https, unfortunately, but nodeload can handle them. You can use the 'https' node.js module with a custom requestGenerator function like this:

var https = require('https');
var readtest = {
        name: "Read HTTPS",
        timeLimit: 60,
        targetRps: 10,
        requestGenerator: function(client) {
            return https.request({method: 'GET', host: 'encrypted.google.com', port: 443, path: '/'});
        }
    },
    loadtest = nl.run(readtest);

You can also do this with nl.js using the -r option (see examples/test-generator.js).

The one caveat is that I don't believe node.js supports persistent connections over HTTPS (let me know if find something to the contrary), so this may skew your results. When generating a large amount of load, you might run into an issue where your request rate suddenly drops to zero for several seconds. This happens when the system runs out of ephemeral ports used for outbound connections, and node.js is waiting for old ports to be cleaned up for reuse. Let me know if see something like that, and we can see if there's a way to work around it.

jonjlee avatar Sep 09 '11 14:09 jonjlee

Hi Jon

That's great, looks like it works a charm! I've also been fiddling around with the report and would love to know how to modify the output to be CSV rather than JSON... It's not completely obvious to me what outputs this

Cheers

Jerome

franklywatson avatar Sep 09 '11 23:09 franklywatson