How to increase the heap size of the google cloud app engine?

泄露秘密 提交于 2019-12-29 08:25:10

问题


I am now using Google Cloud App Engine Standard environment for Java application and I am getting outOfMemory Error cause the Java heap size` is quite filled.

I know why cause I'm processing a lot of data which might reach 1GB, so how to increase the heap size allocated for a java app running in App Engine Standard environment.


回答1:


I've fixed my problem by moving to java8 and now Im using java 8 environmental variables to increase the java heap size by adding this to the appengine-web.xml

   <env-variables>       
        <env-var name="GAE_MEMORY_MB" value="1024M" />
        <env-var name="HEAP_SIZE_RATIO" value="90" />
    </env-variables>



回答2:


By default App Engine Standard use the F instances which only has 128MB and 600MHz processors. We had the same heap issues and we ended up "upgrading" to more powerful App Engine Standard instances. You can also switch to auto-scaling basic or manual which will give you more control over your requests (requests no longer timeout in 10 minutes for example). More info about the different Instance classes can be found here In order to apply the change you will have to update your appengine-web.xml and add the following:

<instance-class>B4</instance-class>
<basic-scaling>
  <idle-timeout>60m</idle-timeout>
  <max-instances>10</max-instances>
</basic-scaling>



回答3:


Unless it's possible to use Cloud Storage or Datastore to offload some of the data, you should consider using Kubernetes or Compute engine as they allow more fine tuning and have more options to choose from compared to GAE.



来源:https://stackoverflow.com/questions/48314063/how-to-increase-the-heap-size-of-the-google-cloud-app-engine

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!