Calculating storage requirements for Node.js applications

To start one or more Node.js applications in a CICS® region, you must ensure that there is enough free storage available for each Node.js application to use. CICS and other products that are running in the same region might require a considerable amount of z/OS® storage. CICS storage allocation parameters such as DSALIM and EDSALIM affect storage availability and might be over-allocated compared to the peak requirements.

About this task

The storage that is required for a Node.js application is not allocated from CICS DSA or EDSA storage. Some storage is managed by the Language Environment® handling requests such as malloc() issued by C code, and some is managed directly by the Node.js application that uses z/OS storage management requests such as IARV64 and STORAGE OBTAIN. Language Environment uses z/OS storage services.

4 KB of 24-bit storage is required for each thread used by the Node.js runtime. The number of threads used is fixed once the Node.js runtime has started, and is typically between 8 and 12, unless you set the UV_THREADPOOL_SIZE environment variable. In addition, UNIX System Services require 256 KB of contiguous 24-bit storage during the process of creating each thread.

The Node.js runtime allocates a heap for JavaScript objects and JIT compiled code. On z/OS 2.3 or higher, the heap can span both 31-bit and 64-bit storage. Also, the heap is comprised of several spaces, and their sizes vary independently. Measuring the heap usage in a test environment is the simplest way to estimate the heap size requirement. 31-bit storage is also required to load UNIX System Services dynamic link library (DLL) files for the Node.js runtime.

In addition, 64-bit storage is allocated by Language Environment for the C++ heap and stack. This used by Node.js runtime code internally, and by native modules.

To estimate the total storage required for Node.js applications, perform the following procedure.

Procedure

  1. Use the sample statistics program DFH0STAT to measure 24-bit, 31-bit and 64-bit memory usage.

    View the MVS user region and extended user region storage report for information about the use of 24-bit and 31-bit MVS storage.

    View the Storage above 2 GB report for information about the use of 64-bit MVS storage.

    • Note the values for  1  Current Unallocated Total, which indicate the current amount of unallocated 24-bit (user region) and 31-bit (extended user region) storage.
    • Note the value for  2  MEMLIMIT minus Current Address Space active, which indicates the current amount of 64-bit storage available to the CICS region.
    MVS User Region and Extended User Region
    _________________________________________________________
                                                        User Region               Extended User Region
                                                       ______________________________________________________
      Last Monitor Sample Time . . . . . . . . . . . :  03/11/2022  16:22:13      03/11/2022  16:22:13        
      State. . . . . . . . . . . . . . . . . . . . . :                Normal                    Normal       
      Current Unallocated Total. . . . . . . . . . . :                5,956K                  392,956K          1 
      LWM Unallocated Total. . . . . . . . . . . . . :                5,956K                  392,956K     
      Current Unallocated Largest Contiguous Area. . :                5,956K                  392,168K  
      LWM Unallocated Largest Contiguous Area. . . . :                5,956K                  392,168K  
      Last date and time SOS . . . . . . . . . . . . :          
      Current Tasks Waiting Because SOS. . . . . . . :                     0                         0   
      Peak Tasks Waiting Because SOS . . . . . . . . :                     0                         0 
      Total Waits Because SOS. . . . . . . . . . . . :                     0                         0 
      Time Tasks Waited Because SOS. . . . . . . . . :        00:00:00.00000            00:00:00.00000 
    
    Storage ABOVE 2GB   
    _________________________  
      MEMLIMIT Size. . . . . . . . . . . . :               15,360M    
      MEMLIMIT Set By. . . . . . . . . . . :                  JCL 
      
      Current Address Space active (bytes) :      1,143,996,416    
      Current Address Space active . . . . :             1,091M    
      Peak Address Space active. . . . . . :             1,091M       
         
      MEMLIMIT minus Current Address Space active. . . . . . . :          14,269M     2 
      MEMLIMIT minus allocated to Private Memory Objects . . . :          13,144M
      MEMLIMIT minus bytes usable within Private Memory Objects:          14,269M 
      Number of Private Memory Objects . . . . . . . . . . . . :               33 
        ....minus Current GDSA extents . . . . . . . . . . . . :               32 
      Bytes allocated to Private Memory Objects. . . . . . . . :           2,216M  =       2,323,644,416
        ....minus Current GDSA allocated . . . . . . . . . . . :           1,192M  =       1,249,902,592
      Bytes hidden within Private Memory Objects . . . . . . . :           1,125M  =       1,179,648,000
        ....minus Current GDSA hidden. . . . . . . . . . . . . :           1,124M  =       1,178,599,424
          ....minus CICS Internal Trace Table hidden . . . . . :             130M 
      Bytes usable within Private Memory Objects . . . . . . . :           1,091M  =       1,143,996,416
      Peak bytes usable within Private Memory Objects  . . . . :           1,806M  =       1,893,728,256
      Current GDSA Allocated . . . . . . . . . . . . . . . . . :           1,024M  =       1,073,741,824
      Peak GDSA Allocated. . . . . . . . . . . . . . . . . . . :           1,024M 
    
  2. Enable the NODEJSAPP and run a representative workload. Observe how the values for each private storage area available change, and make sure that the private storage areas are not constrained.