[go: up one dir, main page]
More Web Proxy on the site http://driver.im/

CN113778674A - Lock-free implementation method of load balancing equipment configuration management under multi-core - Google Patents

Lock-free implementation method of load balancing equipment configuration management under multi-core Download PDF

Info

Publication number
CN113778674A
CN113778674A CN202111012642.XA CN202111012642A CN113778674A CN 113778674 A CN113778674 A CN 113778674A CN 202111012642 A CN202111012642 A CN 202111012642A CN 113778674 A CN113778674 A CN 113778674A
Authority
CN
China
Prior art keywords
configuration
data
configuration data
pointer
lock
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
Application number
CN202111012642.XA
Other languages
Chinese (zh)
Inventor
靳龙
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shanghai Hongji Information Technology Co Ltd
Original Assignee
Shanghai Hongji Information Technology Co Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Shanghai Hongji Information Technology Co Ltd filed Critical Shanghai Hongji Information Technology Co Ltd
Priority to CN202111012642.XA priority Critical patent/CN113778674A/en
Publication of CN113778674A publication Critical patent/CN113778674A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements 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/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5027Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals
    • G06F9/505Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals considering the load
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements 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/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5083Techniques for rebalancing the load in a distributed system
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements 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/46Multiprogramming arrangements
    • G06F9/52Program synchronisation; Mutual exclusion, e.g. by means of semaphores
    • G06F9/524Deadlock detection or avoidance

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

The invention discloses a lock-free implementation method of load balancing equipment configuration management under a multi-core condition, which mainly aims at the lock-free implementation of multi-core concurrent multithreading in configuration data access, and threads needing to access the configuration data do not need to care about the change of the configuration data and are directly read and used; the lock-free technology is realized, so that the configuration data is modified and accessed by multiple threads under the condition of multi-core, and the high-speed processing of the data message by the equipment is provided.

Description

Lock-free implementation method of load balancing equipment configuration management under multi-core
Technical Field
The invention relates to the technical field of load balancing configuration management, in particular to a lock-free implementation method of load balancing equipment configuration management under multiple cores.
Background
Load balancing is a key component of the highly available network infrastructure, and is typically used to distribute workload across multiple servers to improve the performance and reliability of a website, application, database, or other service.
Load balancing belongs to high-performance digital communication equipment, a multi-core CPU is generally adopted, and software implementation is based on multi-thread concurrent processing. This results in multiple threads running in parallel accessing the same configuration data at the same time, and currently, it is a common practice to implement read-write protection of data through spin locks.
At present, how to process the data to improve the data forwarding performance of equipment when multithreading accesses the same configuration data in a multi-core manner. A widely used technique at present is spin locking. However, in the multi-core platform, the spin lock is frequently used because the multi-core threads share the same management data, which results in the performance of the threads for processing data messages being reduced. The prior art uses the most intuitive and easily understood locking technology to provide protection for adding spin lock to configuration data shared by multiple cores, and a significant problem is that if multiple cores use the same management data at the same time, the multiple cores can only be queued for sequential execution, resulting in reduced throughput performance of the device on the data. Therefore, a lock-free implementation method for load balancing device configuration management under multiple cores becomes an urgent problem to be solved.
Disclosure of Invention
The invention aims to solve the technical problem of a lock-free implementation method of load balancing equipment configuration management under multiple cores.
In order to solve the above technical problems, the technical solution provided by the present invention is a lock-free implementation method for load balancing device configuration management under multiple cores, comprising the following steps:
the method comprises the following steps: the configuration data management thread is used for being responsible for adding, deleting and modifying the configuration data, and specifying a configuration management data use pointer which points to a configuration data structure;
step two: setting a marking array, wherein members of the marking array mark each use configuration data thread and detect pointer data of all configuration data;
step three: when the configuration data is modified or deleted, the configuration management thread firstly stores a configuration data pointer, then assigns the address of the new configuration data to the pointer of the dominant data, and assigns 1 to each member of the tag array;
step four: the tag array is checked and if all members of the tag array are 0, the old configuration data memory block is deleted.
As an improvement, the management thread is a service processing core thread of the device, and can be bound to a plurality of processing cores of the CPU and can be executed concurrently.
As an improvement, after the thread of the configuration management data acquires the configuration pointer, the configuration pointer should not be acquired again during the period using the configuration data pointed by the pointer.
As an improvement, the subscript of the pointer data in step two is the thread number of each use configuration data.
Compared with the prior art, the invention has the advantages that: the method is mainly aimed at realizing the lock-free access of the configuration data by the concurrent multithreading under the multi-core condition, and the threads needing to access the configuration data do not need to care about the change of the configuration data and are directly read and used; the lock-free technology is realized, so that the configuration data is modified and accessed by multiple threads under the condition of multi-core, and the high-speed processing of the data message by the equipment is provided.
Drawings
Fig. 1 is a schematic diagram of a lock-free implementation method of load balancing device configuration management under multiple cores according to the present invention.
Fig. 2 is a schematic system flow diagram of a lock-free implementation method for load balancing device configuration management under multiple cores according to the present invention.
Detailed Description
The lock-free implementation method of load balancing device configuration management under multiple cores according to the present invention is further described in detail with reference to the accompanying drawings.
With reference to fig. 1-2, a lock-free implementation method for load balancing device configuration management under multiple cores includes the following steps:
the method comprises the following steps: the configuration data management thread is used for being responsible for adding, deleting and modifying the configuration data, and specifying a configuration management data use pointer which points to a configuration data structure;
step two: setting a marking array, wherein members of the marking array mark each use configuration data thread and detect pointer data of all configuration data;
step three: when the configuration data is modified or deleted, the configuration management thread firstly stores a configuration data pointer, then assigns the address of the new configuration data to the pointer of the dominant data, and assigns 1 to each member of the tag array;
step four: the tag array is checked and if all members of the tag array are 0, the old configuration data memory block is deleted.
The management thread is a service processing core thread of the device, and can be bound to a plurality of processing cores of the CPU and can be executed concurrently.
After the thread for configuring the management data acquires the configuration pointer, the configuration pointer cannot be acquired again by using the configuration data pointed by the pointer.
The subscript of the pointer data in step two is the thread number of each use configuration data.
The invention relates to a lock-free implementation method of load balancing equipment configuration management under a multi-core, which comprises the following specific implementation processes:
the configuration management thread is only one, and the thread is responsible for adding, deleting and modifying the configuration data, and specifies that the configuration management data uses a pointer which points to a block of configuration data structure. The configuration data is used by the business processing core thread of the device, and the group of threads can be bound to a plurality of processing cores of the CPU, namely the group of threads using the configuration data is executed concurrently. The thread using the configuration management data is to acquire a configuration pointer, and after the configuration pointer is acquired, the configuration pointer is used to point to the configuration data, and the configuration pointer must not be acquired again in the meantime, because the configuration pointer points to different contents each time the configuration pointer is acquired.
Releasing configuration management data by a configuration management thread ensures that the thread using the data releases the pointer to the configuration data block. The method is realized by a mark array, and is realized as follows: the array members mark whether each configuration data using thread releases all pointers of configuration data, the data subscript is the thread number of each configuration data using thread, when modifying or deleting the configuration data, the configuration management thread firstly stores the configuration data pointers, then assigns the address of new configuration data to the pointer of the dominant data, then assigns 1 to each member of the marked array, then checks the marked array, and deletes the old configuration data if all members of the marked array are 0. And releasing a configuration data pointer after the message is processed by using a configuration data thread each time, and assigning 0 to the member corresponding to the tag array. Through the above operation, the lock-free operation between the modification of the configuration data and the use of the configuration data is realized.
The following explains by pseudo code that if the invention is used to realize that when the configuration data is managed and used concurrently, the data can be protected from correct modification and correct access if a lock is not used.
And setting the processing IP data flow as 32 threads, and respectively binding one CPU core.
Figure BDA0003239514350000031
Figure BDA0003239514350000041
The present invention and its embodiments have been described above, and the description is not intended to be limiting, and the drawings are only one embodiment of the present invention, and the actual structure is not limited thereto. In summary, those skilled in the art should appreciate that they can readily use the disclosed conception and specific embodiments as a basis for designing or modifying other structures for carrying out the same purposes of the present invention without departing from the spirit and scope of the invention as defined by the appended claims.

Claims (4)

1. A lock-free implementation method of load balancing device configuration management under multi-core is characterized in that: the method comprises the following steps:
the method comprises the following steps: the configuration data management thread is used for being responsible for adding, deleting and modifying the configuration data, and specifying a configuration management data use pointer which points to a configuration data structure;
step two: setting a marking array, wherein members of the marking array mark each use configuration data thread and detect pointer data of all configuration data;
step three: when the configuration data is modified or deleted, the configuration management thread firstly stores a configuration data pointer, then assigns the address of the new configuration data to the pointer of the dominant data, and assigns 1 to each member of the tag array;
step four: the tag array is checked and if all members of the tag array are 0, the old configuration data memory block is deleted.
2. The lock-free implementation method for load balancing device configuration management under multiple cores according to claim 1, wherein: the management thread is a service processing core thread of the device, and can be bound to a plurality of processing cores of the CPU and can be executed concurrently.
3. The lock-free implementation method for load balancing device configuration management under multiple cores according to claim 1, wherein: after the thread for configuring the management data acquires the configuration pointer, the configuration pointer cannot be acquired again by using the configuration data pointed by the pointer.
4. The lock-free implementation method for load balancing device configuration management under multiple cores according to claim 1, wherein: the subscript of the pointer data in step two is the thread number of each use configuration data.
CN202111012642.XA 2021-08-31 2021-08-31 Lock-free implementation method of load balancing equipment configuration management under multi-core Pending CN113778674A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111012642.XA CN113778674A (en) 2021-08-31 2021-08-31 Lock-free implementation method of load balancing equipment configuration management under multi-core

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111012642.XA CN113778674A (en) 2021-08-31 2021-08-31 Lock-free implementation method of load balancing equipment configuration management under multi-core

Publications (1)

Publication Number Publication Date
CN113778674A true CN113778674A (en) 2021-12-10

Family

ID=78840427

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111012642.XA Pending CN113778674A (en) 2021-08-31 2021-08-31 Lock-free implementation method of load balancing equipment configuration management under multi-core

Country Status (1)

Country Link
CN (1) CN113778674A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114327828A (en) * 2021-12-29 2022-04-12 科东(广州)软件科技有限公司 Method, device, equipment and medium for concurrent access of shared data

Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101689143A (en) * 2007-06-20 2010-03-31 富士通株式会社 Cache control device and control method
CN103488717A (en) * 2013-09-11 2014-01-01 北京华胜天成科技股份有限公司 Lock-free data gathering method and lock-free data gathering device
CN103713884A (en) * 2013-12-18 2014-04-09 珠海金山网络游戏科技有限公司 Multithreading method and system for processing data through array and multithreading processor
CN104216767A (en) * 2014-09-18 2014-12-17 东软集团股份有限公司 Method and device for accessing shared data among multiple threads
US20150331720A1 (en) * 2012-10-19 2015-11-19 uCIRRUS Multi-threaded, lockless data parallelization
CN106354572A (en) * 2016-08-31 2017-01-25 成都科来软件有限公司 Multi-thread data transmission method
CN110287044A (en) * 2019-07-02 2019-09-27 广州虎牙科技有限公司 Without lock shared drive processing method, device, electronic equipment and readable storage medium storing program for executing
CN110543373A (en) * 2019-11-04 2019-12-06 长沙新弘软件有限公司 method for accessing kernel by user thread
CN111314217A (en) * 2019-12-09 2020-06-19 上海金融期货信息技术有限公司 Multilink transmission system
US20200409841A1 (en) * 2019-06-26 2020-12-31 International Business Machines Corporation Multi-threaded pause-less replicating garbage collection

Patent Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101689143A (en) * 2007-06-20 2010-03-31 富士通株式会社 Cache control device and control method
US20150331720A1 (en) * 2012-10-19 2015-11-19 uCIRRUS Multi-threaded, lockless data parallelization
CN103488717A (en) * 2013-09-11 2014-01-01 北京华胜天成科技股份有限公司 Lock-free data gathering method and lock-free data gathering device
CN103713884A (en) * 2013-12-18 2014-04-09 珠海金山网络游戏科技有限公司 Multithreading method and system for processing data through array and multithreading processor
CN104216767A (en) * 2014-09-18 2014-12-17 东软集团股份有限公司 Method and device for accessing shared data among multiple threads
CN106354572A (en) * 2016-08-31 2017-01-25 成都科来软件有限公司 Multi-thread data transmission method
US20200409841A1 (en) * 2019-06-26 2020-12-31 International Business Machines Corporation Multi-threaded pause-less replicating garbage collection
CN110287044A (en) * 2019-07-02 2019-09-27 广州虎牙科技有限公司 Without lock shared drive processing method, device, electronic equipment and readable storage medium storing program for executing
CN110543373A (en) * 2019-11-04 2019-12-06 长沙新弘软件有限公司 method for accessing kernel by user thread
CN111314217A (en) * 2019-12-09 2020-06-19 上海金融期货信息技术有限公司 Multilink transmission system

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
吴和生;王崇骏;谢俊元;: "一种多核环境中无锁的多进程负载均衡会话保持方案", 电子与信息学报, no. 04 *

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114327828A (en) * 2021-12-29 2022-04-12 科东(广州)软件科技有限公司 Method, device, equipment and medium for concurrent access of shared data

Similar Documents

Publication Publication Date Title
US8381230B2 (en) Message passing with queues and channels
CN107113341B (en) System for high throughput processing of transactions in a distributed relational database management system for data partitioning
CN110865888A (en) Resource loading method and device, server and storage medium
US11204813B2 (en) System and method for multidimensional search with a resource pool in a computing environment
US20110137889A1 (en) System and Method for Prioritizing Data Storage and Distribution
CN103150149A (en) Method and device for processing redo data of database
US8543722B2 (en) Message passing with queues and channels
CN113778674A (en) Lock-free implementation method of load balancing equipment configuration management under multi-core
US9223690B2 (en) Freeing memory safely with low performance overhead in a concurrent environment
CN109597697B (en) Resource matching processing method and device
US8341368B2 (en) Automatic reallocation of structured external storage structures
US11281666B2 (en) Interception of database queries for delegation to an in memory data grid
CN113961364B (en) Large-scale lock system implementation method and device, storage medium and server
CN109284177B (en) Data updating method and device
US10528625B2 (en) Client cloud synchronizer
US20150324133A1 (en) Systems and methods facilitating multi-word atomic operation support for system on chip environments
US11582133B2 (en) Apparatus and method for distributed processing of identical packet in high-speed network security equipment
US11579801B2 (en) Write ordering in SSDs
CN110347517B (en) Dual-system communication method and computer-readable storage medium
WO2015004571A1 (en) Method and system for implementing a bit array in a cache line
CN107102901A (en) A kind of task processing method and device
CN112486421B (en) Data storage method and device, electronic equipment and storage medium
JP4462504B1 (en) A multi-transaction control system with update access counters owned by the transaction process that is the starting point for maintaining consistency
CN115687286A (en) Incremental big data calculation method and system based on impala
US9378045B2 (en) System and method for supporting cooperative concurrency in a middleware machine environment

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