This parameter determines the memory that is allocated by DB2® for each agent thread stack.
On UNIX and Linux, agent_stack_sz is rounded up to the next larger power-of-2 based value. The default settings should be sufficient for most workloads on Linux and UNIX systems.
In Windows environments, this parameter is used to set the initial committed stack size for each agent. Regardless of the setting, each agent stack can grow to the minimum reserved stack size of 256 KB on 32-bit versions of Windows, and 2 MB on 64-bit versions of Windows. If you exceed the minimum reserved stack size, the agent stack might run out of space and return an error.
Windows uses the concepts of a "reserved" stack - the maximum to which the stack can grow, and the "committed" stack - the amount of memory committed to the stack when it is created. In addition, a guard page is added to the specified committed stack size in order to determine the minimum reserved stack space required. For example, with agent_stack_sz (committed stack) set to a value of 16, 1 guard page is added, and so the reserved stack size must be at least 17 pages. The maximum (that is, reserved) agent stack size can be increased by setting agent_stack_sz (that is, the committed stack) to a value that results in a minimum reserved stack size larger than the default reserve stack size of 64 pages. Note that Windows uses multiples of 1 MB for setting reserved stack sizes greater than 256 KB. For example, on 32-bit Windows, setting the agent stack size to a value within the range of [64 - 255] 4-KB pages results in a maximum stack of 1 MB, as 64*4 = 244 KB and 255*4 = 1020 KB round up to 1 MB. Setting the value for agent_stack_sz to a value less than the default reserve stack size has no effect on the maximum limit because the stack still grows as necessary up to the default reserve stack size.
You can change the default reserve stack size by using the db2hdr utility to change the header information for the db2syscs.exe file. The advantage of changing the default reserved stack size using the db2hdr utility is that it provides a finer granularity, therefore allowing the stack size to be set at the minimum required stack size. This conserves virtual address space on 32-bit Windows. However, you have to stop and restart DB2 for a change to the db2syscs.exe process to take effect, and this method must be repeated with any Fix Pack upgrade.
If you are working with large or complex XML data in a 32-bit Windows environment, you should update the value of agent_stack_sz to at least 64 4-KB pages. Very complex XML schemas might require the value of agent_stack_sz to be much higher during schema registration or during XML document validation.
This limit is sufficient for most database operations.