Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Oct 29 23:38
    dependabot-preview[bot] commented #294
  • Oct 29 23:37
    dependabot-preview[bot] labeled #294
  • Oct 29 23:37
    dependabot-preview[bot] opened #294
  • Oct 29 23:37

    dependabot-preview[bot] on npm_and_yarn

    Bump standard from 15.0.1 to 16… (compare)

  • Oct 29 15:44
    salmanm commented #290
  • Oct 29 15:43
    mcollina commented #290
  • Oct 29 14:01
    salmanm ready_for_review #290
  • Oct 29 13:52
    salmanm commented #290
  • Oct 29 11:39
    salmanm synchronize #290
  • Oct 29 11:21
    salmanm synchronize #290
  • Oct 29 09:00
    simoneb commented #290
  • Oct 29 07:34
    salmanm commented #290
  • Oct 28 17:13
    simoneb commented #290
  • Oct 28 16:39
    simoneb commented #290
  • Oct 28 14:35
    salmanm synchronize #290
  • Oct 28 14:31
    salmanm synchronize #290
  • Oct 28 12:56
    salmanm edited #290
  • Oct 28 12:54
    salmanm edited #290
  • Oct 28 12:26
    salmanm edited #290
  • Oct 28 11:59
    salmanm synchronize #290
Christian Sadi
@bizdevchristian

that won't work for my use case. Tried it out, but I'm getting a bunch of errors.

I'm looking for the following approach. If it isn't possible with the current implementation of autocannon, that's alright, but I'd like to ask before determining if this suits our use case:
Let's say I've got 20 connections. I have an array of unique requests for each of the 20 connections. Is there a way to assign each of the unique arrays of requests to each of the connections? That way, only one connection would ever hit a specific appointment id.

I tried to use client.setRequests(uniqueArrayOfRequests) in order to accomplish it, but it sets the requests for all connections.
@mcollina
Alternatively, if this is functionality that you think would be beneficial for autocannon, I'd be down to working on a PR to add it. I'd like to get your ideas about where to start though.
Matteo Collina
@mcollina
I think that functionality would be handy in autocannon.
Christian Sadi
@bizdevchristian
@mcollina Sorry for the late response, I'm new to gitter. Just downloaded the app.
Hmm. Looks like the modifying request example might work with some tweaks. As an event listener, it should update the request for each individual request, no matter the connection, right? Or does it modify it for all connections in that iteration? I'd also need a client.setPath() so I could dynamically update the endpoint on a PUT request for a specific record ID.
I just need to read the code more to find out.
Christian Sadi
@bizdevchristian
I'm currently losing my performance proof of concept proposal to another senior developer using artillery. He went above and beyond and implemented multithreaded test running, but loses all the benefits of a simple API that I get with autocannon.
Robert DeSimone
@icenine457
wow. i came here to ask a question but @mcollina answered it in July lol
thanks!
jang-choe-ibm
@jang-choe-ibm
I think I might be misunderstanding the requests array. I seems like it's only hitting the first request object in the array. For example, if I have requests: [ { path: "path1"}, {path: "path2"}], it only seems to hit "path1". Is this right? I thought it would hit path1 and path2 over and over again.
Mike Austin
@mikeaustin
Hi, I like how straightforward autocannon is, but is there a way to view the errors in more detail?
I translated a request from curl, but it just returns "1 error". I have no idea what the error is.
const autocannon = require('autocannon')

const instance = autocannon({
  url: 'https://api.8base.com/ck0n...',
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'Authorization': 'Bearer 5b6f...',
  },
  body: '{ "query": "{ labelsList { items { title } } }" }',
  connections: 1,
  amount: 1,
})

autocannon.track(instance)
Mike Austin
@mikeaustin
ahh, there exists the option "debug", but it's not in the documentation.
Error: write EPROTO 4513390016:error:14094410:SSL routines:ssl3_read_bytes:sslv3 alert handshake failure
Mike Austin
@mikeaustin
Looks like I needed to use servername: 'api.8base.com'
Alexander Papageorgiou
@alex-ppg
Hello everyone, how can one programmatically print the default output table of autocannon?
Glen Keane
@GlenTiki
@alex-ppg the following will print the results table when autocannon finishes, where args is you autocannon args: autocannon.track(autocannon(args), {renderResultsTable: true, renderLatencyTable: true, renderProgressBar: false})
You can also look at this code here to see how to do your own rendering of the table: https://github.com/mcollina/autocannon/blob/master/lib/progressTracker.js
If you wanted you could log to a stream you instantiate, and pipe to stdout with your own logic.
Alexander Papageorgiou
@alex-ppg
@GlenTiki Thanks, this was exactly what I was looking for!
Alexander Papageorgiou
@alex-ppg
One more quick question, it appears the reqError event is not firing when a 4xx or 5xx status code is returned by the requests. The request event also proved unhelpful as it did not include the response body. I have some seemingly random 4xx & 5xx requests that I want to debug.
Alexander Papageorgiou
@alex-ppg
Nevermind, found a solution here
Alexander Papageorgiou
@alex-ppg
It appears setupClient does not work per request in the requests array for instance. Am I correct?
Alexander Papageorgiou
@alex-ppg
I found something else that is really weird and it refers to one of your other packages @mcollina, the fastify framework. I'm trying to benchmark a server I created using the framework but I am getting the following error message: FST_ERR_CTP_INVALID_MEDIA_TYPE: Unsupported Media Type: %s. The "%s" here should have been swapped with the media type but for some reason was returned raw as "%s".
I've been playing around with GoLang a lot lately, and I had the idea to try replicate autocannon as a fun experiment. It was pretty easy, ~250 lines of code for a barebones implementation.
Matteo Collina
@mcollina
@alex-ppg please open an issue.
Alexander Papageorgiou
@alex-ppg
I opened PR #239 for adding the ability to mutate each request independently via a setupRequest property on each request rather than providing a setupClient property, I would appreciate your thoughts on this.
Alexander Papageorgiou
@alex-ppg
I think I'll need to open another PR, but is it possible to force autocannon to construct each request in the requests array each time it is called? What I am basically trying to do is sequentially create multiple entities and then conduct PATCH requests on these entities but it appears that the PR I opened does not solve the issue as setupRequest is only called based on the number of connections.
Matteo Collina
@mcollina
@alex-ppg that will slow down things significantly
Please make sure that you can actually address your use case in your next PR.
(write an actual test that does what you need, and possibly test using npm link)
Alexander Papageorgiou
@alex-ppg
Well @mcollina we can perhaps supplement a new parameter that will dictate the number of requests to do in total so that they are constructed in advance?
Matteo Collina
@mcollina
That would work
it should already be there (I think)
Ilia Isupov
@SwinX
Hi guys. Maybe you can advice how can I add authorization cookies to requests autocannon does?
I need to shoot pages which are hidden behind authentication.
moonthug
@moonthug
Hi all. Does autocannon work with clusters/child_process? It seems to not be able to read the JSON 🤔\
Roman Milovskiy
@dcromster
Hello!
How i can send x-www-form-urlencoded ? -F and -b did not work
Roman Milovskiy
@dcromster
ok. it works with '{data}' :)
thanx!
^)
Jannis Pohlmann
@Jannis

Hi! Autocannon is amazing. I'm so glad I found something like wrk that can be used as a JS/TS library! I seem to be running into a bug though:

In onRequest, the body is almost always partial. Sometimes it starts from the beginning and is truncated, other times it starts somewhere in the middle. Is this a known issue?

Jannis Pohlmann
@Jannis
I think the way the way this is implemented currently just calls onResponse every time more body data is read from the response. If the response is longer, it could be called multiple times.
I think you'd expect onResponse to only be called once when the response message is complete.
Looking into a fix.