## 4.1.4.2.4 Sizing Guide
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:
Inserts a request handling middleware in the current slot.
- path - handle only requests starting with this path (string, optional)
- handler - a middleware function to invoke (function, mandatory)
Returns this for chaining.
- 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 |
## Testing the Required Memory
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 [page 444]). 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.
## Testing the HTTP Traffic
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.   |
|----------------|---------------------------------------------|
| 256MB          | 5300 800                                    |
| Memory Limit   |   Max. Number of Sessions - Scenario 1 |   Max. Number of Sessions - Scenario 2 |
|----------------|----------------------------------------|----------------------------------------|
| 512MB          |                                  13300 |                                   2300 |
| 1GB            |                                  30100 |                                   8400 |
| 2GB            |                                  65500 |                                  19500 |
| 4GB            |                                 134900 |                                  46400 |
| 8GB            |                                 275500 |                                 102300 |
## Testing Web Socket Traffic
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.
##  Note
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 |
|----------------|----------------------------------------|----------------------------------------|
| 256MB          |                                    600 |                                    300 |
| 512MB          |                                   1100 |                                    500 |
| 1GB            |                                   3100 |                                    800 |
| 2GB            |                                   6500 |                                   1400 |
| 4GB            |                                  13300 |                                   2900 |
| 8GB            |                                  20700 |                                   6100 |
##  Note
--max-old-space-size restricts 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.json file as follows:
```
"scripts": { "start": "node --max-old-space-size=2048 node_modules/@sap/ approuter/approuter.js" }
```