Comments (4)
I'm noticing multer is often very slower using memoryStorage
. I running this app on Heroku (2 dynos 2.5GB RAM each) and can't reproduce this problem local.
I'm uploading/processing binary files < 10mb
Node: 10.13.0
Express: 4.16.4
Multer: 1.4.1
Procfile
web: node --optimize_for_size --max_old_space_size=960 --gc_interval=100 ./bin/www
From the Heroku logs:
14 Dec 2018 22:10:40.888111...app web.2 - multer: 546.008ms
14 Dec 2018 22:10:41.273111...app web.2 - multer: 799.298ms
14 Dec 2018 22:11:02.265113...app web.2 - multer: 14022.644ms
14 Dec 2018 22:11:20.837113...app web.1 - multer: 15048.781ms
14 Dec 2018 22:11:27.108113...app web.2 - multer: 15581.935ms
14 Dec 2018 22:11:50.460112...app web.2 - multer: 9385.592ms
14 Dec 2018 22:12:10.792112...app web.1 - multer: 1873.741ms
14 Dec 2018 22:12:17.253112...app web.1 - multer: 6949.123ms
14 Dec 2018 22:12:18.849111...app web.2 - multer: 459.384ms
14 Dec 2018 22:12:19.396111...app web.1 - multer: 762.943ms
14 Dec 2018 22:12:48.720112...app web.2 - multer: 8931.458ms
14 Dec 2018 22:12:48.927113...app web.2 - multer: 33099.362ms
14 Dec 2018 22:13:12.387112...app web.1 - multer: 6995.448ms
14 Dec 2018 22:13:52.009112...app web.2 - multer: 1641.400ms
14 Dec 2018 22:13:56.123111...app web.1 - multer: 448.621ms
14 Dec 2018 22:13:56.851111...app web.2 - multer: 746.916ms
14 Dec 2018 22:13:58.788112...app web.2 - multer: 7218.541ms
14 Dec 2018 22:14:22.591111...app web.2 - multer: 402.261ms
14 Dec 2018 22:14:22.840111...app web.2 - multer: 688.741ms
14 Dec 2018 22:14:23.346112...app web.1 - multer: 5194.058ms
14 Dec 2018 22:14:26.019111...app web.2 - multer: 534.709ms
14 Dec 2018 22:15:13.401112...app web.2 - multer: 3775.944ms
14 Dec 2018 22:15:17.796111...app web.2 - multer: 397.492ms
14 Dec 2018 22:15:18.204111...app web.2 - multer: 752.125ms
14 Dec 2018 22:15:41.958111...app web.1 - multer: 544.359ms
14 Dec 2018 22:15:42.480111...app web.2 - multer: 836.787ms
14 Dec 2018 22:15:47.693112...app web.1 - multer: 1727.417ms
14 Dec 2018 22:15:52.398111...app web.1 - multer: 791.530ms
14 Dec 2018 22:15:53.531112...app web.1 - multer: 6623.814ms
14 Dec 2018 22:15:56.511112...app web.1 - multer: 4379.295ms
14 Dec 2018 22:16:30.912111...app web.2 - multer: 585.118ms
14 Dec 2018 22:17:10.618112...app web.2 - multer: 1406.447ms
14 Dec 2018 22:17:13.976111...app web.2 - multer: 117.054ms
14 Dec 2018 22:17:16.091112...app web.2 - multer: 1649.331ms
My route is somthing like this:
const router = require('express').Router()
const multer = require('multer')
const upload = multer({ storage: multer.memoryStorage() })
const fileUpload = upload.single('file')
router.post('/file', (req, res) => {
console.time('multer')
fileUpload(req, res, async (err) => {
console.timeEnd('multer')
if (err) console.error(err)
//
// upload file to AWS S3.
//
return res.json({ })
})
})
module.exports = router
Is there any way to search for the root of the problem?
from multer.
Buffer is null for me. Is that normal?
from multer.
If inMemory
is true and the buffer is null, this is not normal. If the default setting is used (where inMemory
is false), then yes it is normal. Maybe it's the latter?
from multer.
I'm not sure that this is an issue anymore with never node. From the blog:
UPDATE: None of this should be necessary, as FileReadStream in the latest node uses buffers by default. However, it appears that either I'm doing something wrong or the docs are out of date, as it doesn't work that way on node HEAD.
We are using buffers internally in 1.0.0
.
Please reopen if you feel that this is still an issue.
from multer.
Related Issues (20)
- Error: Invalid 'path' Argument Type in File Upload Code HOT 6
- how can I upload image or json file ? HOT 1
- Why Postman filename is right, but in the web I use formdata.append() the filename is rong? HOT 1
- ERROR UPLOADING FILE
- ERROR UPLOADING FILE using the javascript and I also use multer in handling the fileupload HOT 5
- Translation of Documentation to Indonesian
- Multer gives error on serverless if using without express js
- Error in uploading a photo in javascript using a multer. HOT 2
- There is a way to effectively add a custom Error handler to multer? HOT 2
- (love) Just to tell you how great your software is HOT 1
- TypeError: Cannot read properties of undefined (reading 'length') when fieldNameSize is not set HOT 1
- Upgrade to the latest version of busboy to prevent potential DOS attack via Dicer HOT 1
- File upload got stuck while uploading large text files HOT 3
- Upload file use Multer with Multer-gridfs-storage in environment of bun is not working but when I use environment of nodejs then it's working? HOT 1
- req.file returning Undefined on frontend, but with Insomnia returns correctly HOT 4
- Custom storage engine not working
- MulterError: Unexpected field when trying to use different storage configuration HOT 1
- Update Docs: Error: read ECONNRESET thrown during test using supertest, mocha but works fine while using postman. HOT 1
- Why does Multer does not release memory? HOT 1
- `preservePath` option not respected HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from multer.