This method for running Tomcat on iSeries gives room for adequate system performance for production level uses of Tomcat.

First, run Tomcat in its own subsystem.

Create library RJSTOMCAT:

                            Create Library (CRTLIB)      
                                                                          
Type choices, press Enter.                                                     
                                                                          
Library  . . . . . . . . . . . .   RJSTOMCAT     Name                          
Library type . . . . . . . . . .   *PROD         *PROD, *TEST                  
Text 'description' . . . . . . .   Tomcat Commands                             
                                                                          
                                                                          
Create a new source file and enter the source for the command and the command 
processing program that will start Tomcat in the new subsystem.

               Create Source Physical File (CRTSRCPF)                     
                                                                          
Type choices, press Enter.                                                     
                                                                          
File . . . . . . . . . . . . . .   SOURCE        Name                          
Library  . . . . . . . . . . .     RJSTOMCAT   Name, *CURLIB                 
Record length  . . . . . . . . .   132           Number                        
Member, if desired . . . . . . .   *NONE         Name, *NONE, *FILE            
Text 'description' . . . . . . .   *BLANK                                      
                                                                          
                                                                          
                                                                          
Then create the two members:

                     Work with Members Using PDM                 S10571ZM 
                                                                          
File  . . . . . .   SOURCE                                                     
Library . . . .     RJSTOMCAT            Position to  . . . . .              
                                                                          
Type options, press Enter.                                                     
2=Edit         3=Copy  4=Delete 5=Display       6=Print     7=Rename          
8=Display description  9=Save  13=Change text  14=Compile  15=Create module...
                                                                          
Opt  Member      Type        Text                                              
STRRJSCAT   CMD         Start Apache Tomcat                               
STRRJSCATC  CLP         Start Apache Tomcat                               

                                                                          
Columns . . . :    1 120                                      Browse        
RJSTOMCAT/SOURCE 
SEU==>                                                                       
STRRJSCAT 
FMT **  ...+... 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+... 
7 ...+... 8 ...+... 9 ...+... 0 ...+... 1 ...+... 2    
  *************** Beginning of data ********************************************
0001.00              CMD        PROMPT('Start Apache Tomcat')                 
0002.00              PARM       KWD(TOMCATFLR) TYPE(*CHAR) LEN(255) +         
0003.00                           DFT('/tomcat5028') PROMPT('Tomcat 5.x path')
  ****************** End of data ***********************************************   

Columns . . . :    1 120                                      Browse        
RJSTOMCAT/SOURCE 
SEU==>                                                                       
STRRJSCATC 
FMT **  ...+... 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+... 
7 ...+... 8 ...+... 9 ...+... 0 ...+... 1 ...+... 2    
  *************** Beginning of data ********************************************
0001.00              PGM        PARM(&TOMCATFLR)                        
0002.00                                                                     
0003.00              DCL        VAR(&TOMCATFLR) TYPE(*CHAR) LEN(255)      
0004.00              DCL        VAR(&CMD) TYPE(*CHAR) LEN(1024)           
0005.00                                                                       
0006.00              MONMSG     MSGID(CPF0000) EXEC(GOTO CMDLBL(ERRORS))      
0007.00                                                                     
0008.00              /* BUILD TOMCAT STARTUP COMMAND STRING */                
0009.00              CHGVAR     VAR(&CMD) VALUE(&TOMCATFLR |< +    
0010.00                           '/bin/catalina400.sh')                      
0011.00                                                                       
0012.00              /* SUBMIT TOMCAT STARTUP TO BATCH */                 
0013.00              SBMJOB CMD(STRQSH CMD(&CMD)) JOB(TOMCATSVR) +        
0014.00                         JOBQ(RJSTOMCAT) CURLIB(*CRTDFT) INLLIBL(*NONE) +
0015.00                         CPYENVVAR(*YES) ALWMLTTHD(*YES)               
0016.00                                                                       
0017.00              SNDPGMMSG  MSGID(CPF9898) MSGF(QCPFMSG) MSGDTA('Tomcat + 
0018.00                           startup job was submitted') MSGTYPE(*COMP)  
0019.00              RETURN                                           
0020.00 ERRORS:                                                           
0021.00              SNDPGMMSG  MSGID(CPF9898) MSGF(QCPFMSG) MSGDTA('Error +  
0022.00                           submitting Tomcat startup job. Check the +  
0023.00                           joblog') MSGTYPE(*ESCAPE)                 
0024.00                                                                     
0025.00              ENDPGM                                           
  ****************** End of data ***********************************************

Create a new subsystem description with the CRTSBSD command.
                                                                          
               Create Subsystem Description (CRTSBSD)                     
                                                                          
Type choices, press Enter.                                                     
                                                                          
Subsystem description  . . . . . > RJSTOMCAT     Name                  
Library  . . . . . . . . . . . >   RJSTOMCAT   Name, *CURLIB             
Storage pools:                                                                
Pool identifier  . . . . . . . > 1             1-10                      
Storage size . . . . . . . . . > 500000        Number, *BASE, *NOSTG...  
Activity level . . . . . . . . > 100           Number                    
          + for more values                                             
Maximum jobs . . . . . . . . . .   *NOMAX        0-1000, *NOMAX             
Text 'description' . . . . . . . > 'RJS Tomcat Subsystem'                
                                                                        
                                                                          
                      Additional Parameters                               
                                                                          
Sign-on display file . . . . . .   *QDSIGNON     Name, *QDSIGNON            
Library  . . . . . . . . . . .                 Name, *LIBL, *CURLIB         
Subsystem library  . . . . . . .   *NONE         Name, *NONE                
                                                                  More... 
F3=Exit   F4=Prompt   F5=Refresh   F12=Cancel   F13=How to use this display   
F24=More keys                                                               
                                                                        
The important part here is the storage pool of adequate size.

It is easiest to manage this subsystem and Tomcat if the Tomcat start command 
starts automatically when the subsystem is started. To do so, create a job 
description and reference it in an autostart job entry relative to the subsystem.

Add a job queue to the subsystem so jobs submitted by the STRTOMCAT command can 
route into the subsystem.

                     Create Job Queue (CRTJOBQ)                           
                                                                          
Type choices, press Enter.                                                     
                                                                          
Job queue  . . . . . . . . . . .   rjstomcat     Name                          
Library  . . . . . . . . . . .     rjstomcat   Name, *CURLIB                 
Text 'description' . . . . . . .   Job queue for tomcat jobs                   
                                                                          
                                                                   Bottom 
F3=Exit   F4=Prompt   F5=Refresh   F10=Additional parameters   F12=Cancel      
F13=How to use this display        F24=More keys                              
                                                                          

Add the job queue to the subsystem description.

                   Add Job Queue Entry (ADDJOBQE)                         
                                                                          
Type choices, press Enter.                                                    
                                                                          
Subsystem description  . . . . .   rjstomcat     Name                          
Library  . . . . . . . . . . .     rjstomcat   Name, *LIBL, *CURLIB          
Job queue  . . . . . . . . . . .   rjstomcat     Name                          
Library  . . . . . . . . . . .     rjstomcat   Name, *LIBL, *CURLIB          
Maximum active jobs  . . . . . .   *nomax        0-1000, *NOMAX                
Sequence number  . . . . . . . .   10            1-9999                        
Max active priority 1  . . . . .   *NOMAX        0-99, *NOMAX                  
Max active priority 2  . . . . .   *NOMAX        0-99, *NOMAX                  
Max active priority 3  . . . . .   *NOMAX        0-99, *NOMAX                  
Max active priority 4  . . . . .   *NOMAX        0-99, *NOMAX                  
Max active priority 5  . . . . .   *NOMAX        0-99, *NOMAX                  
Max active priority 6  . . . . .   *NOMAX        0-99, *NOMAX                  
Max active priority 7  . . . . .   *NOMAX        0-99, *NOMAX                  
Max active priority 8  . . . . .   *NOMAX        0-99, *NOMAX                  
Max active priority 9  . . . . .   *NOMAX        0-99, *NOMAX                  
                                                                          
                                                                   Bottom 
F3=Exit   F4=Prompt   F5=Refresh   F12=Cancel   F13=How to use this display    
F24=More keys                                                                  
                                                                          

Add a routing entry.

                     Add Routing Entry (ADDRTGE)                          
                                                                          
Type choices, press Enter.                                                     
                                                                          
Subsystem description  . . . . .   RJSTOMCAT     Name                          
Library  . . . . . . . . . . .     RJSTOMCAT   Name, *LIBL, *CURLIB          
Routing entry sequence number  .   9999          1-9999                        
Comparison data:                                                               
Compare value  . . . . . . . .   *ANY                                        
                                                                          
Starting position  . . . . . .                 1-80                          
Program to call  . . . . . . . .   QCMD          Name, *RTGDTA                 
Library  . . . . . . . . . . .     QSYS        Name, *LIBL, *CURLIB          
Class  . . . . . . . . . . . . .   QSYSCLS50     Name, *SBSD                   
Library  . . . . . . . . . . .     QSYS        Name, *LIBL, *CURLIB          
Maximum active routing steps . .   *NOMAX        0-1000, *NOMAX                
Storage pool identifier  . . . .   1             1-10                          
                                                                          

Create the job description.

                  Create Job Description (CRTJOBD)                        
                                                                          
Type choices, press Enter.                                                     
                                                                          
Job description  . . . . . . . . > RJSTOMCAT     Name                          
Library  . . . . . . . . . . . >   RJSTOMCAT   Name, *CURLIB               
Job queue  . . . . . . . . . . . > RJSJOBQ       Name                      
Library  . . . . . . . . . . . >   RJSTOMCAT   Name, *LIBL, *CURLIB        
Job priority (on JOBQ) . . . . .   5             1-9                           
Output priority (on OUTQ)  . . .   5             1-9                           
Print device . . . . . . . . . .   *USRPRF       Name, *USRPRF, *SYSVAL...     
Output queue . . . . . . . . . .   *USRPRF       Name, *USRPRF, *DEV, *WRKSTN  
Library  . . . . . . . . . . .                 Name, *LIBL, *CURLIB          
Text 'description' . . . . . . . > 'Autostart Tomcat'                      
                                                                          
                                                                          
                      Additional Parameters                               
                                                                          
User . . . . . . . . . . . . . . > DKIMMEL       Name, *RQD                
Print text . . . . . . . . . . .   *SYSVAL                                    
Accounting code  . . . . . . . .   *USRPRF                                    
Routing data . . . . . . . . . .   QCMDI                                      
                                                                          
Request data or command  . . . . > 'RJSTOMCAT/STRRJSCAT TOMCATFLR(''/tomcat
5028'')'                                                                      
                                                                          
                                                                          
CL syntax check  . . . . . . . .   *NOCHK        0-99, *NOCHK                 
Initial library list . . . . . .   *SYSVAL       Name, *SYSVAL, *NONE         
          + for more values                                               
End severity . . . . . . . . . .   30            0-99                         
Message logging:                                                              
Level  . . . . . . . . . . . .   4             0-4                           
Severity . . . . . . . . . . .   0             0-99                          
Text . . . . . . . . . . . . .   *NOLIST       *NOLIST, *MSG, *SECLVL        
Log CL program commands  . . . .   *NO           *NO, *YES                    
Inquiry message reply  . . . . .   *RQD          *RQD, *DFT, *SYSRPYL         
Hold on job queue  . . . . . . .   *NO           *NO, *YES                    
Job date . . . . . . . . . . . .   *SYSVAL       Date, *SYSVAL                
Job switches . . . . . . . . . .   00000000      Character value              
Device recovery action . . . . .   *SYSVAL                                    
Time slice end pool  . . . . . .   *SYSVAL       *SYSVAL, *NONE, *BASE        
Authority  . . . . . . . . . . .   *LIBCRTAUT    Name, *LIBCRTAUT, *CHANGE... 
Job message queue maximum size     *SYSVAL       2-64, *SYSVAL                
Job message queue full action  .   *SYSVAL       *SYSVAL, *NOWRAP, *WRAP...   
Allow multiple threads . . . . .   *NO           *NO, *YES                    
                                                                          
                                                                   Bottom 
F3=Exit   F4=Prompt   F5=Refresh   F12=Cancel   F13=How to use this display    
F24=More keys                                                                  

Add an autostart job entry to the subsystem referencing the job description.

                  Add Autostart Job Entry (ADDAJE)                        
                                                                          
Type choices, press Enter.                                                     
                                                                          
Subsystem description  . . . . .   rjstomcat     Name                          
Library  . . . . . . . . . . .     rjstomcat   Name, *LIBL, *CURLIB          
Job name . . . . . . . . . . . .   rjstomcat     Name                          
Job description  . . . . . . . .   rjstomcat     Name, *SBSD                   
Library  . . . . . . . . . . .     rjstomcat   Name, *LIBL, *CURLIB          
                                                                          
                                                                   Bottom 
F3=Exit   F4=Prompt   F5=Refresh   F12=Cancel   F13=How to use this display    
F24=More keys                                                                  

The subsystem is complete for all that is needed to run Tomcat and optimize 
it for performance. It may be started with the STRSBS command or added to the 
QSTRUP program for the system so that the subsystem and the Tomcat job will 
start whenever the iSeries is re-IPL'ed.

The regular ENDTOMCAT command will still end Tomcat as it listens for contol 
strings on the same port no matter its subsystem.

The subsystem can now be tuned with the WRKSYSSTS command. Pool 1 of the 
RJSTOMCAT subsystem as described above is system pool 5 in this screen print.

                      Work with System Status                    S10571ZM 
                                                       03/04/06  15:14:19 
% CPU used . . . . . . . :         .5    Auxiliary storage:                    
% DB capability  . . . . :         .0      System ASP . . . . . . :    87.74 G 
Elapsed time . . . . . . :   00:00:01      % system ASP used  . . :    42.1663 
Jobs in system . . . . . :        698      Total  . . . . . . . . :    87.74 G 
% perm addresses . . . . :       .007      Current unprotect used :     3597 M 
% temp addresses . . . . :       .009      Maximum unprotect  . . :     4101 M 
                                                                          
Type changes (if allowed), press Enter.                                        
                                                                          
System    Pool    Reserved    Max   -----DB-----  ---Non-DB---                 
Pool   Size (M)  Size (M)  Active  Fault  Pages  Fault  Pages                 
1      131.87     69.50   +++++     .0     .0     .8     .8                 
2      380.69       .98      61     .0     .0     .0     .0                 
3       51.19      2.10      26     .0     .0    4.4   10.5                 
4       10.23       .00       8     .0     .0     .0     .0                 
5      450.00       .24     100     .0     .0     .0     .0                 
                                                                   Bottom 
Command                                                                        
===>                                                                           
F3=Exit   F4=Prompt           F5=Refresh   F9=Retrieve   F10=Restart           
F11=Display transition data   F12=Cancel   F24=More keys 

 

IBM recommends that the Non-DB Fault pages should stay below about 50. Adjust the pool size such that it stays below 50. When the subsystem starts (and Tomcat starts) the activity and the Non-DB fault rate will be quite high. Wait until it settles before making your final adjustments.


Still have questions? We can help. Submit a case to Technical Support.

Last Modified On: December 10, 2016