Database connection resource allocation method and system based on semaphore

A technology for connecting resources and databases, which is applied in the field of methods and systems for allocating database connection resources based on semaphores, and can solve problems such as reducing system performance, occupying high resources, and system crashing.

Pending Publication Date: 2022-05-13
徐工汉云技术股份有限公司
View PDF0 Cites 0 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

[0002] In the prior art, every time JDBC is used to access the database, it needs to be reconnected once, and the connection needs to be closed (disconnected) after the access is completed. Every time such a connection is made, resource allocation and release problems are involved. Therefore, frequent establishment, Closing the connection will greatly reduce the performance of the system, and may even cause the system to crash, causing a large amount of performance overhead, occupying and consuming excessive resources

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
  • Database connection resource allocation method and system based on semaphore

Examples

Experimental program
Comparison scheme
Effect test

Embodiment Construction

[0023] The present invention will be further described below in conjunction with the accompanying drawings. The following examples are only used to illustrate the technical solution of the present invention more clearly, but not to limit the protection scope of the present invention.

[0024] Such as figure 1 As shown, a method for allocating database connection resources based on semaphore in the present invention:

[0025] 1) Create a container that contains the database connection pool and its incoming end

[0026] 2) Define the initial value of the incoming parameters of the incoming terminal and the size of the database connection pool

[0027] 3) Initialize the database connection pool

[0028] 4) Initialize the semaphore, which can be set as a fair semaphore or an unfair semaphore as needed

[0029] 5) Create multiple threads as channels for the semaphore to connect to the database. The semaphore obtains the database connection resource by obtaining a license. When ...

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 discloses a method for allocating database connection resources based on semaphore, which comprises the following steps of: establishing a database connection pool for database connection, putting a certain number of connection resources in the database connection pool in advance, and when the database connection needs to be established, only taking out one resource from the database connection pool; and after being used, the device can be put back. The semaphore is used for obtaining and releasing the database connection resources, the database can be connected after the database connection resources are obtained, the database connection resources are released to other semaphores after execution is completed, the database connection resources are alternately used, and the problem that in the prior art, a large amount of performance overhead is caused by frequent establishment and release of the connected database is solved. And too high resources are occupied and consumed.

Description

technical field [0001] The invention belongs to the field of software development, and in particular relates to a method and system for allocating database connection resources based on semaphore. Background technique [0002] In the prior art, every time JDBC is used to access the database, it needs to be reconnected once, and the connection needs to be closed (disconnected) after the access is completed. Every time such a connection is made, resource allocation and release problems are involved. Therefore, frequent establishment, Closing the connection will greatly reduce the performance of the system, and may even cause the system to crash, causing a large amount of performance overhead, occupying and consuming excessive resources. Contents of the invention [0003] The purpose of the present invention is to overcome the deficiencies in the prior art and provide a method and system for allocating database connection resources based on semaphores. By establishing a datab...

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 Applications(China)
IPC IPC(8): G06F16/25G06F16/28G06F9/52
CPCG06F16/252G06F16/284G06F9/52
Inventor 刘鹏
Owner 徐工汉云技术股份有限公司
Who we serve
  • R&D Engineer
  • R&D Manager
  • IP Professional
Why Eureka
  • Industry Leading Data Capabilities
  • Powerful AI technology
  • Patent DNA Extraction
Social media
Try Eureka
PatSnap group products