Home > Common Problem > Logger buffer size what is log used for

Logger buffer size what is log used for

青灯夜游
Release: 2023-03-13 16:27:31
Original
6403 people have browsed it

The function is to provide feedback usage information and records to engineers to facilitate problem analysis (used during development); since users themselves do not often generate upload logs, they are useless to users. The logging buffer is a small, temporary area used for short-term storage of change vectors for redo logs to be written to disk. A log buffer write to disk is a batch of change vectors from multiple transactions. Even so, the change vector in the log buffer is written to disk in near real-time, and when the session issues a COMMIT statement, the log buffer write operation is performed in real time.

Logger buffer size what is log used for

The operating environment of this tutorial: Windows 7 system, Dell G3 computer.

The function of log recorder buffer size log is: mainly used to feedback usage information and record to engineers to facilitate problem analysis (used during development); since users themselves do not often generate upload logs, so for User is useless.

The logging buffer is a small, temporary area used for short-term storage of change vectors for redo logs that will be written to disk. "Change vectors" are modifications applied to certain objects. Executing a DML statement will generate a change vector applied to the data.

With redo logs, the database can ensure that data is never lost: whenever a data block changes, the change vector applied to the block is written to the redo log. If the data file needs to be restored, then Redo logs allow change vectors to be extracted and applied to data file backups.

Logger buffer size what is log used for

The session server process does not write redo records directly to the redo log file, otherwise the session will have to wait for a disk I/O operation whenever a DML statement is executed Finish. Instead, the session writes redo records to an in-memory log buffer. This will be much faster than writing to disk. Thereafter, the log buffer (which may contain alternating change vectors for multiple sessions) is written out to the redo log file. Therefore, a log buffer write to disk is a batch of change vectors from multiple transactions. Even so, the change vector in the log buffer is written to disk in near real-time, and when the session issues a COMMIT statement, the log buffer write operation is performed in real time. Writing operations are done by the log writer background process (LGWR).

Logger buffer size what is log used for

Features

The log buffer is smaller compared to other memory structures because it is a very short-lived storage area . Insert the change vector into it and have it flow to disk in near real-time. The log buffer does not need to be larger than a few MB at most, and indeed, setting it larger than the default can have a very bad impact on performance. The default value is determined by the Oracle server and depends on the number of CPUs in the server node.

In the developer options, there is an option called "Logger Buffer Size". The default is 256K. Logs are written to the buffer in a circular manner. Under normal circumstances, the oldest one is full. The log will be deleted to make room for new logs.

The size of the logger buffer is generally adjusted according to the individual. It can be set smaller to clean up faster. If you don’t care much, you can set it slightly larger, like around 100.

Theoretically, within a certain value, the bigger the better (because it determines the number of application layers you can open).

Since users themselves do not often generate upload logs, there is no need to adjust it to the minimum. Users can use the default settings. For example, in the case of high device configuration, the default value or even the maximum value can be increased to meet the user's personalized needs.

Logger buffer size what is log used for

How to set

The log buffer cannot be set smaller than the default value. If you try to do this, the log buffer will be set to the default size. It is possible to create a buffer larger than the default, but this is generally not recommended. The problem is that when a COMMIT statement is issued, part of the commit processing involves writing the log buffer contents to the redo log file on disk. The write operation is performed in real time, and while it is in progress, the session that issued the COMMIT will be suspended. Commit processing is a key part of Oracle's architecture. To ensure that a committed transaction is never lost, the data block in the cache cannot be changed until the data block has been changed (meaning that the transaction has completed) and the change vector has been written to the redo log on disk (so that the transaction can be restored if necessary). Returns a commit completion message to the session. A large log buffer means that when a COMMIT statement is issued, more content needs to be written, and it takes longer before the completion of the commit message is issued and the session resumes work.

Logger buffer size what is log used for

illustrate:

  • For some applications it is necessary to set the log buffer size higher than the default, but generally use the default log buffer to start tuning.

  • The log buffer is allocated when the instance is started and cannot be subsequently resized without restarting the instance. It is a circular buffer. The current write address moves back and forth as the server process writes change vectors to it. The log writer process writes out vectors in batches, at which point the space it occupies becomes available and can be covered by more change vectors. At times of peak activity, change vectors may be generated faster than the log writer process can write them out. If this happens, all DML activity will stop for a few milliseconds while the log writer clears the buffer.

  • In Oracle architecture, dumping the log buffer to disk is one of the basic bottlenecks. DML cannot be faster than LGWR can dump change vectors to online redo log files.

  • If redo generation is the factor limiting database performance, the only option is to use RAC. In a RAC database, each instance has its own log buffer and its own LGWR. This is the only way to write redo data to disk in parallel.

Notes on the logger buffer:

1. Size setting: For some applications, it is necessary to buffer the log The extent size is set higher than the default, but usually the default log buffer is used to start the adjustment.

2. Instance allocation: The log buffer is allocated when the instance is started. If the instance is not restarted, its size cannot be adjusted subsequently. It is a circular buffer. The current write address moves back and forth as the server process writes change vectors to it.

3. Batch processing: The log writer process writes out vectors in batch mode. At this time, the space it occupies will become available and can be covered by more change vectors. At times of peak activity, change vectors may be generated faster than the log writer process can write them out. If this happens, all DML activity will stop for a few milliseconds while the log writer clears the buffer.

For more related knowledge, please visit the FAQ column!

The above is the detailed content of Logger buffer size what is log used for. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template