This guide explains how much application runtime you must purchase to run HTML5 applications.
To develop and run HTML5 Applications using a standalone application router on Cloud Foundry, customers must purchase the Cloud Foundry application runtime.
The memory consumption for an idle application router is around 50 MB. An application router process should run with at least 256MB memory. It may require more memory depending on the application. These aspects influence the memory usage:
-
Number of concurrent users. The number of users that log on to the applications at the same time has the greatest impact on the required runtime.
-
Number of active sessions
-
JWT token size
-
Backend session cookies
Using the following table, estimate how much application runtime allocation you need, based on t-shirt sizes and the expected number of concurrent users.
|
T-Shirt Size |
Concurrent Users |
Required Application Runtime (in GB) |
|---|---|---|
|
S |
1000 |
1 |
|
M |
10000 |
4 |
|
L |
30000 |
8 |
|
XL |
80000 |
16 |
The following tests provide measurements for different application router scenarios. You can use the measurements to approximately calculate the amount of memory that will be required by the application router. The tables contain the exact results from the measurements with Node.js v6.9.1. We recommend assuming higher numbers for productive use.
All measurements were done with authentication. If you have additional session content and want to count the session memory consumption, take a look at what is stored in the session (see "Sessions" in Application Router Configuration). You must add the calculated session size taking into account the number of different users and the session timeout. In our tests,the JWT token alone required approximately 4 KB.
We tested two different test scenarios
-
Scenario 1: A 'Hello World' static resource is served.
-
Scenario 2:
-
A 'Hello World' static resource is served.
-
A static resource of 84.78 KB (compressed by application router to 28.36 KB) is served.
-
A backend application which returns a payload of 80 kb (compressed by application router to 58 KB) is called.
-
Another backend which returns a payload of 160 KB (compressed by application router to 116 KB) is called.
-
Results for HTTP Traffic Tests
|
Memory Limit |
Max. Number of Sessions - Scenario 1 |
Max. Number of Sessions - Scenario 2 |
|---|---|---|
|
256 MB |
5300 |
800 |
|
512 MB |
13300 |
2300 |
|
1 GB |
30100 |
8400 |
|
2 GB |
65500 |
19500 |
|
4 GB |
134900 |
46400 |
|
8 GB |
275500 |
102300 |
We tested two different test scenarios:
-
Scenario 1:
-
A 'Hello World' static resource is served.
-
A single 'Hello' message is sent and then received through a web socket connection.
-
-
Scenario 2:
-
A 'Hello World' static resource is served.
-
A static resource of 84.78 KB (compressed by the application router to 28.36 KB) is served.
-
A backend which returns a payload of 80 KB over a web socket is called.
-
Another backend which returns a payload of 160 KB over a web socket is called.
-
Web sockets require a certain number of file handles to be available for the process. This number is approximately two times the number of the sessions. In Cloud Foundry, the default value is 16384.
Results for Web Socket Traffic Tests
|
Memory Limit |
Max. Number of Sessions - Scenario 1 |
Max. Number of Sessions - Scenario 1 |
|---|---|---|
|
256 MB |
600 |
300 |
|
512 MB |
1100 |
500 |
|
1 GB |
3100 |
800 |
|
2 GB |
6500 |
1400 |
|
4 GB |
13300 |
2900 |
|
8 GB |
20700 |
6100 |
--max-old-space-sizerestricts the amount of memory used in the JavaScript heap. Its default value is below 2 GB. To use the full resources that has been provided to the application, the value of this restriction should be set to a number equal to the memory limit of the whole application.For example, if the application memory is limited to 2 GB, set the V8 heap limit in the
package.jsonfile as follows:"scripts": { "start": "node --max-old-space-size=2048 node_modules/@sap/approuter/approuter.js" }