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

Fix memory usage under heavy load in expressWinston.logger #164

Merged
merged 1 commit into from Feb 15, 2018

Conversation

Projects
None yet
2 participants
@Kmaschta
Copy link
Contributor

Kmaschta commented Feb 12, 2018

Create a lodash template for each request requires a lot of memory for nothing.
I just moved the template allocation in the factory instead of the closure.

The following measurement shows that while running, this save a lot of memory.

Measurement

Say you have the following application: https://gist.github.com/Kmaschta/e3d0937334ac9fcccbbaf5c20b63627a

Install and run the server:

yarn install
node --inspect index.js

And send it a huge number of requests:

siege -r 1000 -c 100 http://localhost:3000

Results (before)

Transactions:		      100000 hits
Availability:		      100.00 %
Elapsed time:		      277.24 secs
Data transferred:	       13.26 MB
Response time:		        0.01 secs
Transaction rate:	      360.70 trans/sec
Throughput:		        0.05 MB/sec
Concurrency:		        5.35
Successful transactions:           0
Failed transactions:	           0
Longest transaction:	        2.89
Shortest transaction:	        0.00

At the end
image

While running
image

Results (after)

Transactions:		      100000 hits
Availability:		      100.00 %
Elapsed time:		      270.16 secs
Data transferred:	       13.26 MB
Response time:		        0.01 secs
Transaction rate:	      370.15 trans/sec
Throughput:		        0.05 MB/sec
Concurrency:		        3.25
Successful transactions:           0
Failed transactions:	           0
Longest transaction:	        1.22
Shortest transaction:	        0.00

At the end
image

While running
image

@Kmaschta Kmaschta force-pushed the Kmaschta:master branch from 58f7f14 to 768248a Feb 12, 2018

@bithavoc bithavoc merged commit a861a56 into bithavoc:master Feb 15, 2018

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
@bithavoc

This comment has been minimized.

Copy link
Owner

bithavoc commented Feb 15, 2018

thanks 😍

@bithavoc

This comment has been minimized.

Copy link
Owner

bithavoc commented Feb 15, 2018

Fixed in v2.5.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment