Reputation: 503
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 do I increase the heap size allocated for a java app running in App Engine Standard environment?
Upvotes: 0
Views: 5098
Reputation: 43
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>
Upvotes: 2
Reputation: 503
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>
Upvotes: 1
Reputation: 1572
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.
Upvotes: 0