Looking for breakthrough ideas for innovation challenges? Try Patsnap Eureka!

An Efficient Multithreaded Log Writing Method

A multi-threading and logging technology, applied in the field of computer programming, can solve problems such as blocking and competing for business threads, and achieve the effect of reducing frequency and overhead

Inactive Publication Date: 2017-07-21
EASTLAND DIGITAL CORP
View PDF4 Cites 1 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

[0006] The present invention designs an efficient multi-threaded log writing method, which solves the technical problem that all threads compete for a lock in the prior art and cause business threads to be blocked in writing disk operations.

Method used

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
View more

Image

Smart Image Click on the blue labels to locate them in the text.
Viewing Examples
Smart Image
  • An Efficient Multithreaded Log Writing Method
  • An Efficient Multithreaded Log Writing Method
  • An Efficient Multithreaded Log Writing Method

Examples

Experimental program
Comparison scheme
Effect test

Embodiment Construction

[0018] Combine below Figure 1 to Figure 3 , the present invention is further described:

[0019] The invention provides an efficient multi-thread log writing method. The invention includes an interface for application programs, a front end for generating log information, and a back end responsible for writing log information into local files. The specific implementation of the method includes the following steps:

[0020] 1. Initialize the four front-end and back-end buffers and the full buffer queue to be written into the file, including the current buffer currentBuffer, the preliminary buffer nextBuffer, the free buffer newBuffer1, the free buffer newBuffer2 and the waiting buffer Queue buffers of filled buffers written to the file. The front end has the current buffer currentBuffer, the preparation buffer nextBuffer, and the buffer queue buffers that have been filled in the front end to be written to the file, and the back end has the free buffer newBuffer1, the free buf...

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to View More

PUM

No PUM Login to View More

Abstract

The invention relates to an efficient multi-thread log writing-in method. An interface used for an application program, a front terminal for generating log information and a rear terminal responsible for writing the log information into a local file are used. The efficient multi-thread log writing-in method includes the steps that (1) buffering regions of the front terminal and buffering regions of the rear terminal are initialized, (2) the front terminal is responsible for filling the buffering regions of the front terminal with the log information, (3) the rear terminal writes log data of the buffering regions of the rear terminal into the local file, (4) after the buffering regions of the front terminal are filled through writing, the buffering regions of the front terminal and the buffering regions of the rear terminal are exchanged, the rear terminal writes the data of the buffering regions of the rear terminal into the local file, the front terminal fills the buffering regions of the front terminal with the new log information, and the steps are circularly executed in this way. According to the efficient multi-thread log writing-in method, obvious performance losses can be avoided when thousands of logs are written per second, the scene that a large number of log data are generated through one course can be dealt with, normal executing flow is not blocked, and lock contention in a multi-thread program is avoided.

Description

technical field [0001] The invention relates to the field of computer programming, and more specifically realizes an efficient log writing method through a multi-thread asynchronous method. Background technique [0002] "Log" belongs to the log function provided by the log library commonly used in the field of computer programming, that is, a text log for human reading, which is usually used for fault diagnosis and tracking, and can also be used for performance analysis. Currently, logging is essential in server programming in general. In a production environment, the log usually records the id of each internal message received, the full text of each external message received, key internal state changes, and so on. Each log has a time stamp, so that the ins and outs of an event in the system can be completely tracked, and only in this way can we find out what happened when a failure occurred, such as which step the business processing process got stuck in. [0003] Multi-t...

Claims

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to View More

Application Information

Patent Timeline
no application Login to View More
Patent Type & Authority Patents(China)
IPC IPC(8): G06F3/06G06F11/34
Inventor 邹国卫
Owner EASTLAND DIGITAL CORP
Who we serve
  • R&D Engineer
  • R&D Manager
  • IP Professional
Why Patsnap Eureka
  • Industry Leading Data Capabilities
  • Powerful AI technology
  • Patent DNA Extraction
Social media
Patsnap Eureka Blog
Learn More
PatSnap group products