Multer: Performance issues

Created on 13 Oct 2019  路  1Comment  路  Source: expressjs/multer

Hi,

I have created a small service that exposes an endpoint for a user to upload an image.

const express = require('express')
const bodyParser = require('body-parser')
const app = express()
const port = 9999
const multer = require("multer");

app.use(express.json({limit: "16mb"}));
app.use(express.urlencoded({ limit: "16mb", extended: true, parameterLimit: 50000 }));

const upload = multer();

app.get('/', (req, res) => res.send('Hello World!'))

app.post('/upload', upload.single("document"), (req, res) => {

    console.log("upload request made")
    const input = req;
    return res.json("received");

});

app.listen(port, () => console.log(`Example app listening on port ${port}!`))

Using gatling i run a performance test against this service where the number of concurrent users grows from 1-10 over a period of 2 minutes. The image uploaded is of size 3mb i have an upload speed of 3.2. You can see the results below.

https://imgur.com/hBLJRey
https://imgur.com/4eDxGMa

The minimum response time is 10seconds the mean is 29 seconds and the 99th percentile is 72 seconds. I have replicated this test 2-3 times with the same result.

I have ran clinic doctor,flame and bubbleprof to try and see the cause of the bottleneck. You can find the results below.

https://drive.google.com/file/d/1gA819KL-5OJj3QzBXi_xY_B9Lmrzwjno/view?usp=sharing

I'm looking for ways to improve the performance as my service will expect many concurrent users.

Most helpful comment

This turned out to be an issue with gatling, if youre running testing locally must set the hostname otherwise performance is hindered.

>All comments

This turned out to be an issue with gatling, if youre running testing locally must set the hostname otherwise performance is hindered.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

edi picture edi  路  4Comments

adrienbarreau picture adrienbarreau  路  3Comments

sant123 picture sant123  路  4Comments

Gabxi picture Gabxi  路  3Comments

tjabdoullah picture tjabdoullah  路  4Comments