cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

SAP Cloud Platform - Web IDE - memory allocation

yaniv200976
Explorer
0 Likes
1,046

Hello everyone,

I'm having a difficulty to allocate less memory for my application.

We started to write APIs with SAP Cloud WEB IDE.

I have 3 java applications that are already running on the server.

For some reason, each java application has lower bound of 600+ MB for publishing although the application is using only 100-200MB.

Currently we have 2GB of memory allowed.

How do we change the lower bound to be less than 600+ MB?

Are there any settings in the cloud platform cockpit for it?

Thank you,

Dor Alon

Accepted Solutions (0)

Answers (1)

Answers (1)

Ivan-Mirisola
Product and Topic Expert
Product and Topic Expert

Hi yaniv200976,

Java memory parameters can be tweaked in the JAVA_OPTS JBP options on the Java Buildpack.
Please check:

https://help.sap.com/viewer/65de2977205c403bbc107264b8eccf4b/Cloud/en-US/505a71ae53e84c7a972bb6c34b4...

If you really need 600MB to start your application, there is really no way to share this amount of memory with other applications. Suppose you have your app stopped and other Java Applications running, taking 1.5GB os the available memory. If you try to start your application, since it requires 600MB it will not be able to start. So you would have to stop another app to start yours and later start the app you have stopped previously - which makes no sense at all. Therefore, your application will use 600MB of the available memory in your space.

Try to understand why your application requires 600MB to boot up. Is there another way to prevent this from happening?

If you are still having issues, could you please share your mta.yaml file?

Best regards,
Ivan

yaniv200976
Explorer
0 Likes

Hello,

My application costs maximum 100m runtime memory.

I tried to change the memory calculation without any success.

Here is the print-screen of the error:

Thank you,

Dor Alon

Ivan-Mirisola
Product and Topic Expert
Product and Topic Expert

Hi yaniv200976,

Did you setup the JBP_CONFIG_JAVA_OPTS in your Java module? Are you able to run the same application with with SAP_JVM locally while setting it with memory parameters to fit the JVM into 100MB?

I don't see that in your MTA.yaml and it seems to me that the Memory Calculator V2 is enabled and its settings are the defaults.

Could you please share the java module's settings related to JBP configuration. It should look like this:

modules:
  - name: memory
    type: java
    path: target/memory.jar
    parameters:
      disk-quota: 256M
      memory: 256M
    properties:
      JBP_CONFIG_JAVA_OPTS: "[java_opts: '-Xmn10M -Xms30M -Xmx100M -Xss3M ']"<br>

Please note, that You should figure out any of the -X parameters on your on using a local JVM so it can safely occupy at most 256M (probably using a profiler - like the one you'll find in SAPJVM).

You say that you application doesn't use more than 100MB - and I believe you. However, you need to also account the memory required by the JVM. So, when you tweak the -X parameters, you have to make sure it fit all into a JVM of size 100MB.

I've done so using the same parameters on a simple Hello World based application using Jetty.

Best regard,
Ivan

yaniv200976
Explorer
0 Likes

Dear Ivan,

Thank you for your help.

The problem was the way that i wrote the settings for the memory calculation.

By writing the following lines:

properties:
      JBP_CONFIG_JAVA_OPTS:"[java_opts: '-Xmn10M -Xms30M -Xmx100M -Xss3M ']"

Fixed my error.

Thank you,

Dor Alon