I use rampUsers(20)over (120) in my gatling load test. But I got the following result
I expected the active user should be constant during the test.
rampUsers injects the defined numbers of users linearly over a given time. So your use of rampUsers(20)over (120)
will result in gatling starting one user every 6 seconds. The graph you're getting shows this, but what might be confusing is that since your scenario completes in less than 6 seconds there's never more than one user active at a time.
if you're aiming for 20 concurrent users over 120 seconds, there's a different injection profile for that...
constantConcurrentUsers(20) during (120 seconds)