简体   繁体   中英

Azure Webjob - OutOfMemoryError: Java heap space error

I am facing "OutOfMemoryError: Java heap space" error in azure webjob when I am trying to read JSON data (approx 50 mb) which is coming in a single line from an API.

While I am trying to optimize the code by reading small part of data at once and then processing the data. I would like to know if there is any way to increase heap size in azure?

I faced same issue in my local machine as well, adding -Xms512m -Xmx1024m arguments to eclipse run configuration fixed the problem, but adding same to web job batch file command didn't work.

"%JAVA_HOME%"\bin\java -Djava.net.preferIPv4Stack=true -Djava.net.preferIPv6Addresses=false -Xms512m -Xmx1024m -jar jarfilename.jar

I appreciate any suggestions on how to increase heap size in azure.

Edit: I am using Premium 1 Medium app service plan.

I checked app service plan memory usage as well it didn't exceed 40%

What determines how much memory you can use is the App Service Plan that your Web App runs under. You're not specifying what Plan you are using now, but try scaling up to a higher tier.

See https://azure.microsoft.com/en-us/pricing/details/app-service/ for details.

仅在将服务器更改为64位之后,我才能够将1024 MB分配给最大堆。我发现azure中的32位系统有限制,我们不能向最大堆提交超过512 MB的内存。

My api-app (spring-boot) is S3-standard having 4core and 7GB ram, yet application was throwing java heap space error. Tried various way to set custom heap-size but was no luck. So then I setup application-settings (platform is 64 bit) -> app settings variable as _JAVA_OPTIONS = -Xmx4096m -Xms1512m

I can see initial heap is increased. :)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM