user1171006
user1171006

Reputation: 13

K6 Memory Consumption per VU

I have recently started to work with k6 and really liked the approach of writing tests. When I started my first serious test I found that the memory consumption per VU is pretty high even though my test was not huge. As I read here memory consumption should be around 1-2 MB per VU if the scripts are small. In my case the memory consumption is around 5 MB per VU.

To verify how much memory a very simple script needs I created a script that is doing nothing:

export default function() {

}

When I run this script with 2000 users

docker run --rm -v /tmp:/tmp loadimpact/k6 run -u 2000 --paused --no-teardown --no-setup /tmp/MemTest.js

I end up with memory usage of 10 GB (about 5MB per VU)

So even if the JS is empty the memory usage is quite high. Is this expected?

Upvotes: 1

Views: 2470

Answers (1)

na--
na--

Reputation: 1106

Unfortunately you are right, it seems like either the memory usage has grown, or our previous measurements were incorrect. A brief investigation revealed that the chief culprit of the current memory usage was our use of the core.js library. I've created a new github issue to further investigate how we can improve or ameliorate the situation: https://github.com/loadimpact/k6/issues/1036

@user1171006, try using the loadimpact/k6:master docker image, VU memory usage should have been almost halved after we merged https://github.com/loadimpact/k6/pull/1038. That 2000 VU test you tried is taking just under 5GB of RAM on my machine now.

Upvotes: 2

Related Questions