Hi there,
I am testing an app for its ability to provide large downloads to concurrent users. However, I am unable to complete my execution due to what seems to be a memory leak in my test scripts.
Here is my code:
def pollExportCompletionAndDownload()={
exec(session=> {
val newSession = session.set(“statusCode”,"")
newSession
})
.asLongAs(condition=session => session(“statusCode”).as[String] != “EXPORT_COMPLETE”, exitASAP=true) {
exec(_.remove(“statusCode”))
exec(flushHttpCache)
exec(http(requestName = “PollExportStatus”)
.get(baseurl + “/export/${exportID}/status?cb=” + System.currentTimeMillis.toString)
.header(“content-type”,“application/json”)
.header(“Accept”,“application/json, text/plain, /”)
.header(“accept-encoding”, “gzip, deflate, br”)
.basicAuth("", “”)
.check(jsonPath("$.statusCode").saveAs(“statusCode”)))
.exec(session => {
println(“Status:” + session(“statusCode”).as[String])
val newSession = session.set(“statusCode”, session(“statusCode”))
newSession
})
.pause(10)}
.exec(http(requestName = “DownloadExport”)
.get(baseurl+"/export/${exportID}")
.header(“Accept”,“text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,/;q=0.8”)
.header(“accept-encoding”, “gzip, deflate, br”)
.basicAuth("","")
.check(status is 200))
}
The error I get is:
i.n.u.i.OutOfDirectMemoryError: failed to allocate 16777216 byte(s) of direct memory (used: 1056964615, max: 1073741824)
I have done this in my gradle.properties:
-XX:MaxDirectMemorySize=4g
Here is what my logback file looks like:
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%d{HH:mm:ss.SSS} [%-5level] %logger{15} - %msg%n%rEx</pattern>
<immediateFlush>false</immediateFlush>
</encoder>
</appender>
<timestamp key="bySecond" datePattern="yyyyMMdd'T'HHmmss" />
<appender name="FILE" class="ch.qos.logback.core.FileAppender">
<file>Perftest-${bySecond}.txt</file>
<append>false</append>
<encoder>
<pattern>%d{HH:mm:ss.SSS} [%-5level] %logger{15} - %msg%n%rEx</pattern>
<immediateFlush>false</immediateFlush>
</encoder>
</appender>