Nonstop Database, HiRDB Version 9 System Operation Guide

[Contents][Index][Back][Next]

24.6.1 Creation of audit trail files

Organization of this subsection
(1) Audit trail file creation convention
(2) Naming of audit trail files
(3) Output to audit trail file (synchronous output)
(4) Output to audit trail file (asynchronous output)

(1) Audit trail file creation convention

HiRDB creates audit trail files automatically in the HiRDB file system area for audit trail files. The first time an audit trail file is created, it becomes the first generation, followed by the second generation, the third generation, and so on. The following figure shows the procedure for creating audit trail files.

Figure 24-5 Audit trail file creation

[Figure]

The maximum number of audit trail files that can be created in the HiRDB file system area is specified in the pd_aud_max_generation_num operand. However, if the value of the pdfmkfs command's -l option is smaller than the value of the pd_aud_max_generation_num operand, the value of the -l option becomes the maximum. Also, if there becomes insufficient space in the HiRDB file system area, it will not be possible to create as many audit trail files as provided for by the specification of the pd_aud_max_generation_num operand.

(2) Naming of audit trail files

The audit trail files are named according to the following convention:

pdaudunit-identifier001-200.aud

Example: If the unit identifier is UNT1 and pd_aud_max_generation_num=100
1st generation file name: pdaudUNT1001.aud
2nd generation file name: pdaudUNT1002.aud
:
99th generation file name: pdaudUNT1099.aud
100th generation file name: pdaudUNT1100.aud

If files other than audit trail files are created in the HiRDB file system area for audit trail files, they must not be files whose names will be inconsistent with these naming conventions.

(3) Output to audit trail file (synchronous output)

Audit trails are output either synchronously or asynchronously, depending on the value specified for the pd_aud_async_buff_size operand. The following explains synchronous output.

If no audit trail file exists, one is created when the first audit trail is collected, and the audit trail is output to this file. If at least one audit trail file exists, an audit trail is output to the current file each time it is collected.

(4) Output to audit trail file (asynchronous output)

Audit trails are output either synchronously or asynchronously depending on the value specified for the pd_aud_async_buff_size operand. The following explains asynchronous output.

(a) Asynchronous output framework

This subsection explains the framework for asynchronously outputting audit trails.

When an audit trail output trigger occurs, audit trails are stored in the asynchronous output buffer and are output to the audit trail file when this buffer becomes full. Therefore, in order for asynchronous output of audit trails to be possible, the asynchronous output buffer must be allocated when the HiRDB system is configured.

The asynchronous output buffer is allocated in shared memory. The following figure shows the framework for asynchronous output.

Figure 24-6 Framework for asynchronous output

[Figure]

Explanation
  1. When the first asynchronous output buffer becomes full, audit trails are output to the audit trail file, and the storage destination is switched to the second asynchronous output buffer.
  2. From that point on, audit trails are stored in the second asynchronous output buffer. When the second asynchronous output buffer becomes full, steps 1 and 2 are repeated.

Note
When audit trails in an asynchronous output buffer are being output to the audit trail file, their order is maintained. Therefore, you cannot output audit trails in another asynchronous output buffer to the audit trail file. Consequently, if audit trail output to the audit trail file takes a long time, multiple asynchronous output buffers might become full.
As a result, an asynchronous output buffer shortage might occur depending on the execution interval or execution concurrency of the transaction or utility that runs on the system. This is called depletion of asynchronous output buffers.
Depletion of asynchronous output buffers causes HiRDB performance degradation.
In the example in the above figure, seven asynchronous output buffers are provided. If all seven of these become full while the content of the first asynchronous output buffer is being output to an audit trail file, any newly generated audit trail cannot be stored. In this case, the transaction or utility holds off on storing the audit trail until an asynchronous output buffer becomes available, resulting in performance degradation.
To prevent HiRDB performance degradation, we recommend that you examine the audit trail output status and, if necessary, revise the size of the asynchronous output buffers.
(b) Revising the size of the asynchronous output buffers

To prevent HiRDB performance degradation, revise the size of the asynchronous output buffers according to the procedure shown in the following figure.

Figure 24-7 Procedure for revising the size of the asynchronous output buffers

[Figure]

1. Estimate the maximum usage of the asynchronous output buffers
First, estimate the maximum usage of the asynchronous output buffers.
This means the maximum amount of asynchronous output buffer space used by stored audit trails while one asynchronous output buffer's worth of audit trails is being output to an audit trail file. You can determine this value from the number of audit trails that are output during an audit trail file generation swap.
Determine the maximum usage of the asynchronous output buffers using the following formula:
maximum usage of asynchronous output buffers (bytes) =
(time required for swapping audit trail file generations ...(i)
[Figure] maximum number of audit trail records stored in 1 second ...(ii)
[Figure] record size per audit trail ...(iii))
+ size of each asynchronous output buffer...(iv)
(i) time required for swapping audit trail file generations
You can derive the time required for swapping audit trail file generations from the time at which HiRDB outputs messages.
The difference between the times at which the following two messages are output is the time it took to swap audit trail file generations:
  • KFPS05703-I message (indicating that an audit trail file generation was released)
  • KFPS05702-I message (indicating that an audit trail file generation was allocated)
If the difference is 0 seconds, use 1 second for the calculation.
(ii) maximum number of audit trail records stored in 1 second
You can determine the maximum number of audit trail records stored in 1 second from the number of SQL statements issued and the number of tables accessed.
Use the following formula to obtain an estimate:
 
maximum number of audit trail records stored in 1 second = maximum number of SQL statements issued in 1 second [Figure] 3 [Figure] the number of tables accessed
 
To accurately determine the number of audit trail records, see 24.13 Audit trail record items (during privilege checking) and 24.14 Audit trail record items (at event termination).
(iii) record size per audit trail
To estimate this size, see Audit trail record size under Determining audit trail file capacity in the HiRDB Version 9 Installation and Design Guide.
(iv) size of each asynchronous output buffer
Use the value specified for the pd_aud_async_buff_size operand. The default value is 401,408.

2. Estimate the total size of the asynchronous output buffers
Determine the total size of the asynchronous output buffers using the following formula:
total size of asynchronous output buffers =
pd_aud_async_buff_size operand specification value [Figure] pd_aud_async_buff_count operand specification value
 
If the total size of the asynchronous output buffers is less than twice their maximum usage, we recommend that you increase the size to twice the maximum usage of the asynchronous output buffers for the following reason:
If audit trail output to the audit trail file takes a long time, multiple asynchronous output buffers might become full. If at that point the number of transactions increases abruptly, the asynchronous output buffers might become depleted. To prevent depletion even in such cases, we recommend that you increase the total size to twice the maximum usage of the asynchronous output buffers.

3. Estimate the size of a single asynchronous output buffer and the number of buffers required
Use the table below to estimate the values for the pd_aud_async_buff_size and pd_aud_async_buff_count operands of the system definition.
The following table shows the size per asynchronous output buffer and the number of buffers required.

Table 24-16 Recommended size per asynchronous output buffer and the number of buffers required

Determination criterion Asynchronous output buffer
Size per buffer (pd_aud_async_buff_size operand specification value) Number of buffers required (pd_aud_async_buff_count operand specification value)
Recommended value (maximum usage of asynchronous output buffers [Figure] 2) [Figure] total size of asynchronous output buffers No change is needed. No change is needed.
Recommended value (maximum usage of asynchronous output buffers [Figure] 2) > total size of asynchronous output buffers Change to the maximum value of 6,553,600. Change to the value determined using the following formula:
MAX(current specification value for the pd_aud_async_buff_count operand, [Figure]maximum usage of asynchronous output buffers [Figure] 2 [Figure] 6,553,600[Figure])
Note
If swapping of audit trail file generations keeps occurring even after the total size of asynchronous output buffers has been revised, audit trail output from the asynchronous output buffers to the audit trail file does not go smoothly and might lead to depletion of the asynchronous output buffers.
To prevent HiRDB performance degradation due to depletion of asynchronous output buffers, we recommend that you make sure that the size of the asynchronous output buffers, as well as the maximum capacity of each generation of audit trail file (the value of the pd_aud_max_generation_size operand), satisfy the following inequality:
(maximum usage of asynchronous output buffers [Figure] 2 [Figure] 1,024 [Figure] 1,024) < pd_aud_max_generation_size operand specification value
(megabytes)
(c) Asynchronous output buffer flush opportunities

If asynchronous output is selected, when an opportunity to output to the audit trail file occurs, the audit trail is stored temporarily in a buffer used for asynchronous output. The audit trail stored in a buffer used for asynchronous output is output to the audit trail file at the following opportunities; these are called asynchronous output buffer flush opportunities:

If asynchronous output buffer flush opportunities occur frequently, all sectors of the asynchronous output buffer might be placed in flush-wait status. For details about actions to take in such a case, see 24.10(4) When all sectors of the asynchronous output buffer are placed in flush-wait status.

When 180 seconds have passed since all sectors were placed in flush-wait status, HiRDB executes processing according to the value specified in the pd_aud_no_standby_file_opr operand.

When forcewrite (default) is specified
Outputting of audit trails continues by overwriting the audit trails in the first asynchronous output buffer that was placed in flush-wait status. The audit trails in the overwritten asynchronous output buffer are discarded.

When down is specified
The message KFPS05722-E is output and HiRDB (a unit in the case of a HiRDB parallel server configuration) is forcibly terminated. Both the audit trails that were in the asynchronous output buffers and the audit trails that were about to be output to the asynchronous output buffer are discarded.