As of some users are reporting memory leaks in their production environment, I've opened this issue trying to help investigate (possible?) memory leaks causing from Nuxt or SSR engine of vue.js. We may resolve problems before stable 1.0.0 release, but it needs users contribution to help to test different conditions and to provide reports & heap dumps. (Related to #678 #661 #658 #1695)
It may be better to create a new and clean repository to prevent side-effects of using third-party plugins such as lodash. (they may have memory leaks too)
1.0.0-rc*
) because it is using runInNewContext:false
SSR options.6.10.3 LTS
or 8.x
(recommended)nuxt build
, nuxt start
and not nuxt dev
. We are analyzing production environments.yarn
instead of npm to ensure exact dependencies are installed.The article finding-a-memory-leak-in-node-js may help a lot to take offline heap snapshots. Below is a suggested approach for that. If you are using nuxt programmatically (in express for example) you may take another approach.
In nuxt.config.js
before module.exports
:
heapdump = require('heapdump');
setInterval
to periodically (~15min) take snapshotsYou can use tools like ab
to emulate light request traffic on the web server.
Meanwhile, you may also track memory allocation using any tool you want. It is recommended to keep the server running for more than 1 hour.
Important Please notice about garbage collection. Don't try to emulate high memory usage by applying heavy load on SSR engine it may give false positive memory leaks and performance downsides. If actually memory leak exists it may happen even with the normal amount of requests/load.
After tests done, you may personally analyze and compare heap dumps using chrome dev tools. Also providing a report in this thread would be so nice. Please at least include following details: