Tuning your COBOL application with VisualVM
The following information focuses on the thin client environment, but the same approach is also applicable to stand-alone and EIS environments.
Measuring the load of your COBOL application
VisualVM can help you calculate the amount of RAM that is necessary for your COBOL application to run in thin client mode with a given number of concurrent users.
Suppose that you’re going to install your COBOL application on a production server where 100 users will connect and you need to suggest the amount of RAM that the server machine should provide. You can calculate it empirically in this way:
1. start the isCOBOL Server;
2. attach isCOBOL Server with VisualVM and take the current Heap usage (we’ll call this value "A");
3. connect with a Client and move among the programs of your application simulating data processing, printing and other operations. Be sure to execute the most used functions of your application;
4. take the current Heap usage (we’ll call this value "B").
Now you can make the following calculation: Necessary_RAM = A + ((B - A) * 100).
Looking for memory leaks
VisualVM can help you find memory leaks.
The steps are similar to the ones described above:
1. start the isCOBOL Server;
2. attach isCOBOL Server with VisualVM and take the current Heap usage (we’ll call this value "A");
3. connect with a Client and move among the programs of your application simulating data processing, printing and other operations. Be sure to execute the most used functions of your application;
4. exit from the application, the Client terminates;
5. force a garbage collection from VisualVM;
6. take the current Heap usage (we’ll call this value "B").
If B is greater than A, then a memory leak is possible. You should repeat steps from 3 to 6 multiple times to see if the difference between A and B increases.
Tuning threads
A COBOL application generates a variable number of threads that run simultaneously. The number of threads generated depends on multiple factors. For example, threads may be created explicitly by the COBOL programs if they use PERFORM THREAD, CALL THREAD or CALL RUN statements, but threads may also be created internally by the runtime system to implement some features (e.g. the BEFORE TIME clause on the ACCEPT statements implies a thread that controls whenever the timeout expires).
VisualVM can help you calculate the amount of concurrent threads generated by your COBOL application when running in thin client mode with a given number of concurrent users.
Suppose that you’re going to install your COBOL application on a production server where 100 users will connect and you wish to know the amount of concurrent threads that will run. You can calculate it empirically in this way:
1. start the isCOBOL Server;
2. attach isCOBOL Server with VisualVM and take the current value of Live peak in the Threads area of the Monitor page (we’ll call this value "A");
3. connect with a Client and move among the programs of your application simulating data processing, printing and other operations. Be sure to execute the most used functions of your application;
4. take the current value of Live peak in the Threads area of the Monitor page (we’ll call this value "B").
Now you can make the following calculation: Number_of_Threads = A + ((B - A) * 100).
If the number of threads is very high, consider reducing the memory that Java dedicates to the threads stack by using the -Xss option. This will allow you to save some memory.
iscserver -J-Xss128k other_options...