CN108829522A - A kind of method, apparatus and computer storage medium of concurrent access process - Google Patents
A kind of method, apparatus and computer storage medium of concurrent access process Download PDFInfo
- Publication number
- CN108829522A CN108829522A CN201810654705.3A CN201810654705A CN108829522A CN 108829522 A CN108829522 A CN 108829522A CN 201810654705 A CN201810654705 A CN 201810654705A CN 108829522 A CN108829522 A CN 108829522A
- Authority
- CN
- China
- Prior art keywords
- thread
- pool
- redis
- connection pool
- initialization
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/46—Multiprogramming arrangements
- G06F9/50—Allocation of resources, e.g. of the central processing unit [CPU]
- G06F9/5005—Allocation of resources, e.g. of the central processing unit [CPU] to service a request
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/46—Multiprogramming arrangements
- G06F9/50—Allocation of resources, e.g. of the central processing unit [CPU]
- G06F9/5005—Allocation of resources, e.g. of the central processing unit [CPU] to service a request
- G06F9/5011—Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals
- G06F9/5016—Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals the resource being the memory
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/46—Multiprogramming arrangements
- G06F9/50—Allocation of resources, e.g. of the central processing unit [CPU]
- G06F9/5083—Techniques for rebalancing the load in a distributed system
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
A kind of method, apparatus and computer storage medium of concurrent access process, including:For each thread in thread pool, long-range Dictionary server (Redis) connection pool in initialization thread is distinguished;By the thread in thread pool, the processing that is concurrently accessed;It wherein, include the thread of preset quantity in the thread pool.The embodiment of the present invention improves the stability and quality of concurrent access process.
Description
Technical field
Present document relates to but be not limited to the information processing technology, the method, apparatus and computer of espespecially a kind of concurrent access process
Storage medium.
Background technique
In internet area, (Redis is being write, supported using ANSI C language for an open source to long-range Dictionary server
Network, it is memory-based also can persistence log type, key assignments (Key-Value) database, and provide the application of multilingual
Program Interfaces (API)) it is used as a very efficient non-relational database memory-based, because it provides efficient number
According to read-write operation, and support the complicated data knots such as character string (string), chained list (list), set (set), Hash (hash)
Structure is in the industry cycle used widely;In addition, Redis supports cluster distributed principal and subordinate's deployment and extension, different stage is provided
Data persistence mode, so that the extension of service and cluster disaster tolerance obtain effective guarantee;At the same time, Redis is also applied to order
It reads and issues, the scenes such as message queue.
Service scenarios are accessed in the high frequency including shopping that c++ is realized, to the data of the multithreading high concurrent of Redis
More stringent requirements are proposed for read-write.Currently, generally being carried out the following processing for high frequency access service:Redis connection is constructed first
Pond, request arrives every time, obtains and connects from connection pool in thread, carries out reading and writing data;The scene of above-mentioned high concurrent access service,
Client hiredis (C interface of Redis database) based on c language may cause service crashes, influence concurrently to access service
Stability and quality.
Summary of the invention
It is the general introduction to the theme being described in detail herein below.This general introduction is not the protection model in order to limit claim
It encloses.
The embodiment of the present invention provides the method, apparatus and computer storage medium of a kind of concurrent access process, is able to ascend
The stability and quality of concurrent access process.
The embodiment of the invention provides a kind of methods of concurrent access process, including:
For each thread in thread pool, the long-range Dictionary server Redis connection pool in initialization thread is distinguished;
By the thread in thread pool, the processing that is concurrently accessed;
It wherein, include the thread of preset quantity in the thread pool.
Optionally, before the Redis connection pool in the initialization thread, the method also includes:
When judging service starting, the thread pool is initialized.
Optionally, the method also includes:
Each described thread in the thread pool judges itself when thread is inscribed and receives the request of concurrent processing
Whether the Redis connection pool in thread connects;
When judging that the Redis connection pool in own thread is not connected with, the Redis connection in own thread is reinitialized
Pond.
Optionally, before the Redis connection pool in the initialization thread, the method also includes:
According to the external command received, the quantity of thread in the thread pool is determined.
On the other hand, the embodiment of the present invention also provides a kind of device of concurrent access process, including:Connection pool initialization is single
Member and processing unit;Wherein,
Connection pool initialization unit is used for:For each thread in thread pool, the remote word in initialization thread is distinguished
Allusion quotation server Redis connection pool;
Processing unit is used for:By the thread in thread pool, the processing that is concurrently accessed;
It wherein, include the thread of preset quantity in the thread pool.
Optionally, described device further includes thread pool initialization unit, is used for:When judging service starting, institute is initialized
State thread pool.
Optionally, described device further includes connection processing unit, is used for:
Each described thread in the thread pool judges itself when thread is inscribed and receives the request of concurrent processing
Whether the Redis connection pool in thread connects;
When judging that the Redis connection pool in own thread is not connected with, the Redis connection in own thread is reinitialized
Pond.
Optionally, described device further includes determination unit, is used for:According to the external command received, the thread is determined
The quantity of thread in pond.
In another aspect, the embodiment of the present invention also provides a kind of computer storage medium, deposited in the computer storage medium
Contain computer executable instructions, the method that the computer executable instructions are used to execute above-mentioned concurrent access process.
Compared with the relevant technologies, technical scheme includes:For each thread in thread pool, line is initialized respectively
Long-range Dictionary server (Redis) connection pool in journey;By the thread in thread pool, the processing that is concurrently accessed;Wherein,
It include the thread of preset quantity in the thread pool.The embodiment of the present invention improves the stability and quality of concurrent access process.
Other features and advantages of the present invention will be illustrated in the following description, also, partly becomes from specification
It obtains it is clear that understand through the implementation of the invention.The objectives and other advantages of the invention can be by specification, right
Specifically noted structure is achieved and obtained in claim and attached drawing.
Detailed description of the invention
Attached drawing is used to provide to further understand technical solution of the present invention, and constitutes part of specification, with this
The embodiment of application technical solution for explaining the present invention together, does not constitute the limitation to technical solution of the present invention.
Fig. 1 is the flow chart of the method for the concurrent access process of the embodiment of the present invention;
Fig. 2 is the structural block diagram of the device of the concurrent access process of the embodiment of the present invention.
Specific embodiment
To make the objectives, technical solutions, and advantages of the present invention clearer, below in conjunction with attached drawing to the present invention
Embodiment be described in detail.It should be noted that in the absence of conflict, in the embodiment and embodiment in the application
Feature can mutual any combination.
Step shown in the flowchart of the accompanying drawings can be in a computer system such as a set of computer executable instructions
It executes.Also, although logical order is shown in flow charts, and it in some cases, can be to be different from herein suitable
Sequence executes shown or described step.
Fig. 1 is the flow chart of the method for the concurrent access process of the embodiment of the present invention, as shown in Figure 1, including:
Step 101, for each thread in thread pool, the long-range Dictionary server in initialization thread respectively
(Redis) connection pool;It wherein, include the thread of preset quantity in the thread pool.
Optionally, before the Redis connection pool in initialization thread, present invention method further includes:
When judging service starting, the thread pool is initialized.
It should be noted that the method for initialization thread pond and connection pool may include those skilled in the art in the related technology
The usual processing method of member.
Step 102, by the thread in thread pool, the processing that is concurrently accessed;
Optionally, present invention method further includes:
Each described thread in the thread pool judges itself when thread is inscribed and receives the request of concurrent processing
Whether the Redis connection pool in thread connects;
When judging that the Redis connection pool in own thread is not connected with, the Redis connection in own thread is reinitialized
Pond.
Optionally, before the Redis connection pool in initialization thread, present invention method further includes:
According to the external command received, the quantity of thread in the thread pool is determined.
Compared with the relevant technologies, technical scheme includes:For each thread in thread pool, line is initialized respectively
Long-range Dictionary server (Redis) connection pool in journey;By the thread in thread pool, the processing that is concurrently accessed;Wherein,
It include the thread of preset quantity in the thread pool.The embodiment of the present invention improves the stability and quality of concurrent access process.
Fig. 2 is the structural block diagram of the device of the concurrent access process of the embodiment of the present invention, as shown in Fig. 2, including:At the beginning of connection pool
Beginningization unit and processing unit;Wherein,
Connection pool initialization unit is used for:For each thread in thread pool, the remote word in initialization thread is distinguished
Allusion quotation server (Redis) connection pool;
Processing unit is used for:By the thread in thread pool, the processing that is concurrently accessed;
It wherein, include the thread of preset quantity in the thread pool.
Optionally, the device of that embodiment of the invention further includes thread pool initialization unit, is used for:When judging service starting,
Initialize the thread pool.
Optionally, the device of that embodiment of the invention further includes connection processing unit, is used for:
Each described thread in the thread pool judges itself when thread is inscribed and receives the request of concurrent processing
Whether the Redis connection pool in thread connects;
When judging that the Redis connection pool in own thread is not connected with, the Redis connection in own thread is reinitialized
Pond.
Optionally, the device of that embodiment of the invention further includes determination unit, is used for:According to the external command received, determine
The quantity of thread in the thread pool.
The embodiment of the present invention also provides a kind of computer storage medium, is stored with computer in the computer storage medium
Executable instruction, the method that computer executable instructions are used to execute above-mentioned concurrent access process.
Present invention method is carried out to understand detailed description below by way of using example, is only used for using example old
The present invention is stated, is not intended to limit the scope of protection of the present invention.
Using example
Present invention application example initializes client in this thread and takes to Redis by when thread pool initializes
Access of the different threads to Redis connection pool is isolated in the connection of business.It is first when each concurrent processing request reaches when normal service
It first checks whether Redis connection can be used, needs to reinitialize Redis connection pool for unavailable connection.Application of the present invention is shown
Example method can isolate influence of the different threads access for Redis connection pool, improve the robustness and stability of integrity service.
Present invention application example process includes:
When service starting, the thread pool of specified quantity thread is initialized;
When each thread initializes, while Redis connection pool in initialization thread;
In thread, each time when the processing of concurrent access request, the validity for the connection for getting thread is first checked for, such as
Fruit connection disconnects, and needs to reinitialize the Redis connection pool in thread.
Present invention application example can isolate influence of the different threads access for Redis connection pool, improve integrity service
Robustness and stability.Present invention application example:The thread pool of given thread quantity is initialized when servicing starting first;So
Afterwards thread initialize when initialization thread in Redis connection pool, as thread private data save;Last thread normal service
When, when receiving request every time, first check for obtain Redis connection it is whether effective, if Joint failure, need again initially
Change.Redis connection pool in initialization thread simultaneously when present invention application example thread initializes, rather than all threads shared one
A Redis connection pool;Request processing when, first check for obtain Redis connection it is whether effective, if in vain, reconnected, and
It is not to re-establish Redis connection every time.Present invention application example initializes the thread of given thread quantity when service starts
Pond.
Those of ordinary skill in the art will appreciate that all or part of the steps in the above method can be instructed by program
Related hardware (such as processor) is completed, and described program can store in computer readable storage medium, as read-only memory,
Disk or CD etc..Optionally, one or more integrated circuits also can be used in all or part of the steps of above-described embodiment
It realizes.Correspondingly, each module/unit in above-described embodiment can take the form of hardware realization, such as pass through integrated electricity
Its corresponding function is realized on road, can also be realized in the form of software function module, such as is stored in by processor execution
Program/instruction in memory realizes its corresponding function.The present invention is not limited to the hardware and softwares of any particular form
In conjunction with.
Although disclosed herein embodiment it is as above, the content only for ease of understanding the present invention and use
Embodiment is not intended to limit the invention.Technical staff in any fields of the present invention is taken off not departing from the present invention
Under the premise of the spirit and scope of dew, any modification and variation, but the present invention can be carried out in the form and details of implementation
Scope of patent protection, still should be subject to the scope of the claims as defined in the appended claims.
Claims (9)
1. a kind of method of concurrent access process, which is characterized in that including:
For each thread in thread pool, the long-range Dictionary server Redis connection pool in initialization thread is distinguished;
By the thread in thread pool, the processing that is concurrently accessed;
It wherein, include the thread of preset quantity in the thread pool.
2. the method according to claim 1, wherein before Redis connection pool in the initialization thread, institute
The method of stating further includes:
When judging service starting, the thread pool is initialized.
3. method according to claim 1 or 2, which is characterized in that the method also includes:
Each described thread in the thread pool judges own thread when thread is inscribed and receives the request of concurrent processing
Whether interior Redis connection pool connects;
When judging that the Redis connection pool in own thread is not connected with, the Redis connection pool in own thread is reinitialized.
4. method according to claim 1 or 2, which is characterized in that Redis connection pool in the initialization thread it
Before, the method also includes:
According to the external command received, the quantity of thread in the thread pool is determined.
5. a kind of device of concurrent access process, which is characterized in that including:Connection pool initialization unit and processing unit;Wherein,
Connection pool initialization unit is used for:For each thread in thread pool, the long-range dictionary in initialization thread is taken respectively
Business device Redis connection pool;
Processing unit is used for:By the thread in thread pool, the processing that is concurrently accessed;
It wherein, include the thread of preset quantity in the thread pool.
6. device according to claim 5, which is characterized in that described device further includes thread pool initialization unit, is used for:
When judging service starting, the thread pool is initialized.
7. device according to claim 6 or 7, which is characterized in that described device further includes connection processing unit, is used for:
Each described thread in the thread pool judges own thread when thread is inscribed and receives the request of concurrent processing
Whether interior Redis connection pool connects;
When judging that the Redis connection pool in own thread is not connected with, the Redis connection pool in own thread is reinitialized.
8. device according to claim 6 or 7, which is characterized in that described device further includes determination unit, is used for:According to
The external command received determines the quantity of thread in the thread pool.
9. a kind of computer storage medium, computer executable instructions, the calculating are stored in the computer storage medium
Method of the machine executable instruction for concurrent access process described in any one of perform claim requirement 1~4.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201810654705.3A CN108829522A (en) | 2018-06-22 | 2018-06-22 | A kind of method, apparatus and computer storage medium of concurrent access process |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201810654705.3A CN108829522A (en) | 2018-06-22 | 2018-06-22 | A kind of method, apparatus and computer storage medium of concurrent access process |
Publications (1)
Publication Number | Publication Date |
---|---|
CN108829522A true CN108829522A (en) | 2018-11-16 |
Family
ID=64138029
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201810654705.3A Pending CN108829522A (en) | 2018-06-22 | 2018-06-22 | A kind of method, apparatus and computer storage medium of concurrent access process |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN108829522A (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110300160A (en) * | 2019-06-14 | 2019-10-01 | 杭州爱科科技股份有限公司 | Data sharing method for embedded system |
CN113722078A (en) * | 2021-11-02 | 2021-11-30 | 西安热工研究院有限公司 | High-concurrency database access method, system and equipment based on thread pool |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20050132335A1 (en) * | 2003-12-10 | 2005-06-16 | Jonathan Maron | Application performance tuning server-side component |
CN103605727A (en) * | 2013-11-19 | 2014-02-26 | 浪潮电子信息产业股份有限公司 | Connection pool based efficient multiuser database access optimization method and framework |
CN103841127A (en) * | 2012-11-21 | 2014-06-04 | 苏州易和物联信息技术有限公司 | Data receiving service realizing method in real-time positioning system |
CN104239365A (en) * | 2013-06-24 | 2014-12-24 | 北京新媒传信科技有限公司 | Database connection pool and method for acquiring links in database connection pool |
-
2018
- 2018-06-22 CN CN201810654705.3A patent/CN108829522A/en active Pending
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20050132335A1 (en) * | 2003-12-10 | 2005-06-16 | Jonathan Maron | Application performance tuning server-side component |
CN103841127A (en) * | 2012-11-21 | 2014-06-04 | 苏州易和物联信息技术有限公司 | Data receiving service realizing method in real-time positioning system |
CN104239365A (en) * | 2013-06-24 | 2014-12-24 | 北京新媒传信科技有限公司 | Database connection pool and method for acquiring links in database connection pool |
CN103605727A (en) * | 2013-11-19 | 2014-02-26 | 浪潮电子信息产业股份有限公司 | Connection pool based efficient multiuser database access optimization method and framework |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110300160A (en) * | 2019-06-14 | 2019-10-01 | 杭州爱科科技股份有限公司 | Data sharing method for embedded system |
CN113722078A (en) * | 2021-11-02 | 2021-11-30 | 西安热工研究院有限公司 | High-concurrency database access method, system and equipment based on thread pool |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US11550819B2 (en) | Synchronization cache seeding | |
US20180046554A1 (en) | Managing a Redundant Computerized Database Using a Replicated Database Cache | |
US8156137B2 (en) | Data processing systems and methods | |
US8321482B2 (en) | Selectively modifying files of a container file | |
US20090271451A1 (en) | On-Demand Access to Container File Directories | |
US9286328B2 (en) | Producing an image copy of a database object based on information within database buffer pools | |
US11941429B2 (en) | Persistent multi-word compare-and-swap | |
CN109960678B (en) | Naming processing method and computer processing device | |
US20240037973A1 (en) | Pseudo labelling for key-value extraction from documents | |
CN114925084A (en) | Distributed transaction processing method, system, device and readable storage medium | |
CN108829522A (en) | A kind of method, apparatus and computer storage medium of concurrent access process | |
WO2021147773A1 (en) | Data processing method and apparatus, electronic device and computer-readable storage medium | |
CN110096543B (en) | Data operation method, device, server and medium of application program | |
US20060282437A1 (en) | Apparatus, system, and method for ordered processing of a hierarchical data structure according to a data source | |
CN110489210A (en) | Create method, apparatus, equipment and the computer storage medium of virtual machine | |
US20230316792A1 (en) | Automated generation of training data comprising document images and associated label data | |
CN110471744A (en) | Password amending method, device, equipment and computer readable storage medium | |
CN113448649B (en) | Redis-based home page data loading server and method | |
CN114036218A (en) | Data model switching method and device, server and storage medium | |
CN111026371B (en) | Game development method and device, electronic equipment and storage medium | |
US6950832B2 (en) | Method for dynamically allocating a device in an LPAR system | |
CN114138367A (en) | Service implementation method, device, equipment and storage medium on self-service equipment | |
CN110750569A (en) | Data extraction method, device, equipment and storage medium | |
CN114205333B (en) | IP configuration method, cluster construction method, computer device and storage medium | |
US20240005200A1 (en) | Generation of inference logic from training-time artifacts for machine learning model deployments |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20181116 |
|
RJ01 | Rejection of invention patent application after publication |