简体   繁体   English

Azure Webjob-OutOfMemoryError:Java堆空间错误

[英]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. 当我尝试从API读取单行中的JSON数据(约50 mb)时,我在蔚蓝的webjob中遇到“ OutOfMemoryError:Java堆空间”错误。

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. 我也在本地计算机上遇到了同样的问题,在Eclipse运行配置中添加-Xms512m -Xmx1024m参数可以解决该问题,但是将其添加到Web作业批处理文件命令中则无效。

"%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. 编辑:我正在使用Premium 1 Medium应用程序服务计划。

I checked app service plan memory usage as well it didn't exceed 40% 我检查了应用服务计划的内存使用情况,也没有超过40%

What determines how much memory you can use is the App Service Plan that your Web App runs under. 决定可以使用多少内存的是Web应用程序在其下运行的应用程序服务计划。 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. 有关详细信息,请参见https://azure.microsoft.com/zh-cn/pricing/details/app-service/

仅在将服务器更改为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. 我的api-app(spring-boot)是具有3core和7GB ram的S3标准,但是应用程序抛出了Java堆空间错误。 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 所以然后我设置了应用程序设置(平台是64位)->应用程序设置变量为_JAVA_OPTIONS = -Xmx4096m -Xms1512m

I can see initial heap is increased. 我可以看到初始堆增加了。 :) :)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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