## Portal Application for Load Measurements

The application com.mycompany.test is designed to provide predefined load on the portal server for performance measurements. It can also be used to demonstrate memory usage in relation to JVM garbage collection process and for testing of profiling tools.

The application consists of several following components:

### LoadTest component

This is the core component for the measurements, that can be used standalone (by starting of well-known schema <yourPortalServer>/irj/servlet/prt/portal/prtroot/com.mycompany.test.LoadTest , or easily used for creation iIViews in the portal pages. The behavior and the memory allocation can be parametrized by set of request parameters or even taken from the iView profile.

Supported query parameters (and corresponding Profile Values) are:

Parameter Name | DefaultValue | Unit | Description
--- | --- | --- | ---
dynamicMemory | 0 | kB | Dynamic (local) memory allocated in the scope of the doContent() method and therefore used only in the current rountrip. Memory allocated by such way is garbaged by next GC run on JVM Recommended value are 0-100 kB
staticMemory | 0 | kB | Static memory allocated on the component's class. Once allocated, it survives garbage collection runs on JVM done between the component's rountrips and therefore can also be used for simution of memory leaks. Recommended values are 0-100 kB. Important: Complete static memory already allocated can be deallocated when using NEGATIVE value of this parameters
sessionMemory | 0 | kB | Memory allocated in the HttpServlet Sessioon. Once allocated, it survives garbage collection runs on JVM and therefore can also be used for simution of memory leaks. Recommended values are 0-100 kB. Important: Complete session memory allocated in previous roundtrips can be deallocated when using NEGATIVE value of this parameters
size | 5000 | Bytes | Length of the random string included in the reponse. In order to simulate the "fat" responses, you can use big values like 1000000 characters. The characters are rendered in the HTML comments, therefore visible only in the HTML source.
sleepTime | 0 | ms | Delay for waiting using Thread.sleep mechanism. This means the reponse is delayed but without creating CPU load on the server
elapsedTime | 0 | ms | Minimal elapsed time that has to be reached for the response. When the processing of memory allocation and generating of random response tool less time then this value, the remaining time will be filled with waiting in loop under CPU load.

When any of memory allocation happens (see dynamicMemory, staticMemory, sessionMemory), the application creates a chain of instances of the class com.mycompany.test.MemoryContainer , each of them takes about 100 Bytes. Thus, having 100kB extra memory allocated, you will see 1000 instances of these classes on the heap. When the sessionMemory parameter is used, the chain of such class instances are stored under the key com.mycompany.test.LoadTestmemory in the HttpServlet session.

### HttpSession component

This subcomponent displays a basic overview on HttpSession and can be used i.e. to check, that the LoadTest component allocated/released the memory as expected (see sessionMemory parameter). In order to start this component standalone use following URL

<yourPortalServer>/irj/servlet/prt/portal/prtroot/com.mycompany.test.HttpSession

Remember that the HttpServletSession has internal timeout specified on Servlet container, so it may happen the session expired and releases store data when you takes no activity over the defined timeout.

### RequestSniffer component

This subcomponent displays detailed analysis of the HttpRequest in several sections: Request Infomation, Request Headers, Request Parameters parsed, Cookies parsed, Session Tracking and Session Values. Example of the usage:

<yourPortalServer>/irj/servlet/prt/portal/prtroot/com.mycompany.test.HttpSession?a=4711&b=0815

### Help component

The subcomponent giving you this basic info.