Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ECONNREFUSED errors when using Artillery to test a Deno HTTP server #1509

Closed
GJZwiers opened this issue Jul 9, 2022 · 4 comments
Closed

Comments

@GJZwiers
Copy link

GJZwiers commented Jul 9, 2022

I am trying to use Artillery with a Deno HTTP server, but this results in a lot of ECONNREFUSED errors.

My artillery.yaml file:

config:
  target: "http://localhost:8000"
  phases:
    - duration: 60
      arrivalRate: 5
      name: Warm up
    - duration: 120
      arrivalRate: 5
      rampTo: 50
      name: Ramp up load
    - duration: 600
      arrivalRate: 50
      name: Sustained load

scenarios:
  - name: "get hello"
    flow:
      - get:
          url: "/"

Deno server code:

import { opine } from "https://deno.land/x/opine@2.2.0/mod.ts";
const app = opine();

app.get("/", function (req, res) {
  res.send("Hello World");
});

app.listen(8000);

Output:

> artillery run .\artillery.yaml
Phase started: Warm up (index: 0, duration: 60s) 09:49:10(+0200)

--------------------------------------
Metrics for period to: 09:49:20(+0200) (width: 8.002s)
--------------------------------------

errors.ECONNREFUSED: ........................................................... 45
http.request_rate: ............................................................. 5/sec
http.requests: ................................................................. 45
vusers.created: ................................................................ 45
vusers.created_by_name.get hello: ................................................. 45
vusers.failed: ................................................................. 45

If I start a similar server in Node, everything is fine:

const express = require('express');
const app = express();

app.get('/', function (req, res) {
  res.send('Hello World')
})

app.listen(8000);
Phase started: Warm up (index: 0, duration: 60s) 09:51:01(+0200)

--------------------------------------
Metrics for period to: 09:51:10(+0200) (width: 7.004s)
--------------------------------------

http.codes.200: ................................................................ 40
http.request_rate: ............................................................. 5/sec
http.requests: ................................................................. 40
http.response_time:
  min: ......................................................................... 1
  max: ......................................................................... 9
  median: ...................................................................... 2
  p95: ......................................................................... 7.9
  p99: ......................................................................... 8.9
http.responses: ................................................................ 40
vusers.completed: .............................................................. 40
vusers.created: ................................................................ 40
vusers.created_by_name.get hello: ................................................. 40
vusers.failed: ................................................................. 0
vusers.session_length:
  min: ......................................................................... 2.5
  max: ......................................................................... 26.6
  median: ...................................................................... 4.2
  p95: ......................................................................... 25.8
  p99: ......................................................................... 25.8

In Deno the errors are happening for various server frameworks so it is not a problem with the opine server. The debug output shows the following requests and responses for the Node server, while nothing except the errors are shown for the Deno server:

2022-07-07T19:57:12.467Z http request: {
  "url": "http://localhost:8000/",
  "method": "GET",
  "headers": {
    "user-agent": "Artillery (https://artillery.io)"
  }
}
2022-07-07T19:57:12.467Z http:response "Hello World"
2022-07-07T19:57:12.467Z http:response {
  "x-powered-by": "Express",
  "content-type": "text/html; charset=utf-8",
  "content-length": "11",
  "etag": "W/\"b-Ck1VqNd45QIvq3AZd8XYQLvEhtA\"",
  "date": "Thu, 07 Jul 2022 19:57:12 GMT",
  "connection": "keep-alive",
  "keep-alive": "timeout=5"
}

I do not know if this is a problem in Deno or Artillery, but I thought I would post this issue here first. Here is my artillery version:

VERSION INFO:

Artillery Core: 2.0.0-20
Artillery Pro:  not installed (https://artillery.io/product)

Node.js: v18.1.0
OS:      win32
@juanig1
Copy link
Contributor

juanig1 commented Jul 20, 2022

Hey, did you figure this out?
Seems like a Deno config issue, as the script is correct and it works with Node (also working fine against netcat in my machine)

@GJZwiers
Copy link
Author

Changing the target to http://127.0.0.1:8000 instead of localhost made it work. :) Since it's definitely not an issue with Artillery I will close this now.

@nicotrozzo
Copy link

Same was happening to me with an express server, changing to 127.0.0.1 solved it. Thanks for sharing!

@harsh-sri
Copy link

thanks for sharing it 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants