CN109375988A - A kind of distributed lock implementation method and device - Google Patents

A kind of distributed lock implementation method and device Download PDF

Info

Publication number
CN109375988A
CN109375988A CN201811291959.XA CN201811291959A CN109375988A CN 109375988 A CN109375988 A CN 109375988A CN 201811291959 A CN201811291959 A CN 201811291959A CN 109375988 A CN109375988 A CN 109375988A
Authority
CN
China
Prior art keywords
distributed lock
distributed
rbd
node
shared storage
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.)
Granted
Application number
CN201811291959.XA
Other languages
Chinese (zh)
Other versions
CN109375988B (en
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.)
Zhengzhou Yunhai Information Technology Co Ltd
Original Assignee
Zhengzhou Yunhai 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 Zhengzhou Yunhai Information Technology Co Ltd filed Critical Zhengzhou Yunhai Information Technology Co Ltd
Priority to CN201811291959.XA priority Critical patent/CN109375988B/en
Publication of CN109375988A publication Critical patent/CN109375988A/en
Application granted granted Critical
Publication of CN109375988B publication Critical patent/CN109375988B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

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/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • 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/526Mutual exclusion algorithms
    • 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/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • G06F2009/45579I/O management, e.g. providing access to device drivers or storage

Abstract

The invention discloses a kind of distributed lock implementation method and devices.It is related to virtualizing computing platform technology, solves the problems, such as that the compatible RBD distributed lock of integrated I/O model increases memory burden, influences performance.This method comprises: node calls handle, the dedicated finger daemon of distributed lock information is opened;The node uses the finger daemon, carries out I/O operation to the shared storage of distributed lock.Technical solution provided by the invention is suitable for Sanlock distributed lock, realizes the efficient distributed lock system for supporting RBD.

Description

A kind of distributed lock implementation method and device
Technical field
The present invention relates to virtualization computing platform technology, espespecially a kind of distributed lock implementation method and device.
Background technique
With the fast development of computer technology and network technology, large construction cluster is made extensively in actual production environment With.By virtualization, server cluster forms the virtualization system of cloud computing platform.In virtualization system, it is often necessary to assist It transfers and makees, homologous ray does not either share same or one group of resource between same system difference host, generally requires mutually Reprimand is to prevent mutual interference, to guarantee consistency, it is therefore desirable to which distributed lock guarantees the realization of above situation.
In general distributed lock needs to support the use under big specification environment, it is therefore desirable to use the distribution with lease It locks to guarantee to obtain the uniqueness of the node of lock resource, while also to guarantee that the same node uniquely obtains the resource.Due to The taker that obtains of distributed lock is the host memberships in cluster, therefore the implementation of distributed lock is divided into two kinds: one kind is network Type, i.e. DLM implementation;One is shared storage-types, i.e. sanlock implementation.
As distributed storage Ceph, have the characteristics of scalability and robustness, it is additional that its is relatively cheap, therefore it is deep by Cluster user welcomes.In general its iSCSI service, but the I/O Path too long of iSCSI service, therefore serious shadow are used Ring the performance of its distributed storage.But Ceph provides RBD storage pool, carries out I/O by RBD, directly carries out with Ceph node Communication, the path I/O is shorter, therefore its performance is relatively good.And included multipath, does not need third when RBD is used Square multi-path software, therefore more users are desirable for the I/O that RBD mode carries out Ceph, but can be supported without one kind The distributed lock scheme of RBD.
In past trial, the I/O model approach that sanlock integrates RBD is realized, but by increasing I/O model The mode memory that causes sanlock to occupy directly increase 300M or more, memory incrementss cost prohibitive consumes stock number mistake Greatly.
Summary of the invention
In order to solve the above-mentioned technical problems, the present invention provides a kind of distributed lock implementation method and devices.Pass through third The dedicated finger daemon of Fang Daili carries out the read-write operation of distributed lock, realizes the efficient distributed lock system for supporting RBD System solves the problems, such as that the compatible RBD distributed lock of integrated I/O model increases memory burden, influences performance.
In order to reach the object of the invention, the present invention provides a kind of distributed lock implementation methods, comprising:
Node calls handle, opens the dedicated finger daemon of distributed lock information;
The node uses the finger daemon, carries out I/O operation to the shared storage of distributed lock.
Preferably, when there are multinomial I/O operation, the node completes institute by the different threads in the finger daemon State multinomial I/O operation.
Preferably, the step of shared storage to distributed lock carries out I/O operation specifically:
It is communicated by the local socket Local Socket of the node with the shared storage of the distributed lock.
Preferably, the information that the node is interacted with the shared storage of the distributed lock includes the operation letter of I/O operation The volume information that breath and operation are directed to.
Preferably, by the reliable autonomous distributed objects in distributed memory system store block device RBD into The I/O operation to the shared storage is realized in row I/O operation.
Preferably, the step of node uses the finger daemon, carries out I/O operation to the shared storage of distributed lock Later, further includes:
The state that reliable autonomous distributed objects and RBD are checked in I/O operation failure, is closed in abnormal state Originally the handle opened re-calls handle and opens the reliable autonomous distributed objects and RBD.
The present invention also provides a kind of distributed lock realization devices, comprising:
Dedicated process management module opens the dedicated finger daemon of distributed lock information for calling handle;
I/O module carries out I/O operation to the shared storage of distributed lock for using the finger daemon.
Preferably, the I/O module, specifically for when there are multinomial I/O operation, the node by it is described guard into Different threads in journey complete the multinomial I/O operation.
Preferably, the I/O module passes through local socket (Local Socket) and deposits with the shared of the distributed lock Storage is communicated.
Preferably, the dedicated process management module is also used to the state of reliable autonomous distributed objects and RBD, When exception causes I/O operation to fail, the handle opened originally is closed, handle is re-called and opens the reliable autonomous distribution Formula object and RBD.
The present invention provides a kind of distributed lock implementation method and device, node calls handle, opens distributed lock information Dedicated finger daemon, the node use the finger daemon, carry out I/O operation to the shared storage of distributed lock.Pass through Dedicated finger daemon realizes third-party agent I/O operation, solves in the compatible RBD distributed lock increase of integrated I/O model It deposits burden, influence the problem of performance, realize the efficient distributed lock system for supporting RBD.
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 a kind of flow diagram for distributed lock implementation method that one embodiment of the invention provides;
Fig. 2 is a kind of structural schematic diagram for distributed lock realization device that one embodiment of the invention provides.
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.
In past trial, the I/O model approach that sanlock integrates RBD is realized, but by increasing I/O model The mode memory that causes sanlock to occupy directly increase 300M or more, memory incrementss cost prohibitive consumes stock number mistake Greatly.
To solve the above-mentioned problems, the embodiment provides a kind of distributed lock implementation method and devices.Pass through The dedicated finger daemon of third-party agent carries out the read-write operation of distributed lock, realizes the efficient distribution for supporting RBD Lock system solves the problems, such as that the compatible RBD distributed lock of integrated I/O model increases memory burden, influences performance.
With reference to the accompanying drawing, the embodiment of the present invention is described in detail.
The embodiment of the invention provides a kind of distributed lock implementation methods, realize the process of distributed lock such as using this method Shown in Fig. 1, comprising:
Step 101, node call handle, open the dedicated finger daemon of distributed lock information.
In this step, when there are multinomial I/O operation, the node is completed by the different threads in the finger daemon The multinomial I/O operation.By dynamic multi streaming technology, Thread Count is dynamically adjusted, avoids leading to I/O when I/O high pressure Obstruction.
The embodiment of the present invention increases third party's I/O agent way, makes the distribution of sanlock type by calling handle Formula locks the I/O model that can support RBD, to realize a set of distributed lock system that can support RBD.Reduce sanlock clothes It is engaged in committed memory space, realizing the I/O model that sanlock supports RBD, increasing the distributed lock model for supporting RBD storage.
Step 102, the node use the finger daemon, carry out I/O operation to the shared storage of distributed lock.
In this step, pass through the shared storage of the local socket Local Socket and the distributed lock of the node It is communicated.I/O is carried out by Local Socket to issue, and improves the stability and transmission speed of message.
By carrying out I/O to reliable autonomous distributed objects storage block device (RBD) in distributed memory system The I/O operation to the shared storage is realized in operation.
The information that the node is interacted with the shared storage of the distributed lock includes the operation information and operation of I/O operation For volume information.
Step 103, the state that reliable autonomous distributed objects (RADOS) and RBD are checked in I/O operation failure, The handle opened originally is closed in abnormal state, is re-called handle and is opened RADOS and RBD.
Third party's I/O agency service process is dynamic to detect the RADOS's and RBD opened as dedicated finger daemon Handle avoids because the handle opened causes I/O that can not issue when going wrong.
One embodiment of the invention additionally provides a kind of distributed lock implementation method, can be realized and supports RBD's sanlock。
A finger daemon is increased in the embodiment of the present invention, and I/O operation is carried out by the finger daemon.Because integrated The memory that the I/O model of RBD causes sanlock to occupy is larger, and also results in memory as the increase of open file increases Add, therefore remove the I/O of processing RBD using third-party agency in the embodiment of the present invention, while keeping the long connection of RBD, avoids Because the memory that the image of frequent either on or off RBD causes process to occupy increases.It is realized, is reduced by third-party agency The memory information that process occupies, while passing through dynamic thread pool, the dynamic I/O pressure for depressurizing RBD.
Sanlock communicated when I/O by Local Socket, passes through dynamic multithreading in finger daemon Mechanism, pressure is shared when realizing sanlock more I/O, while the state of RBD and RADOS is checked when I/O failure, if It is problematic, the handle opened originally is closed, while reopening RADOS and RBD.By the realization of third-party agent, increase The inspection of the handle of RBD operates, and avoids the problem that because the handle opened causes I/O that can not issue.Pass through Local Socket It realizes, guarantees the transmission of data, while also can be reduced sanlock process committed memory.
One embodiment of the invention provides a kind of distributed lock implementation method, realizes read-write of the sanlock to RBD volumes Model, that is, realizing sanlock can use on RBD, to realize a set of distributed lock system for supporting RBD.
1) increase support of the sanlock to RBD, modify the diskio process of sanlock, it is dynamic to support RBD read-write, together The end client of Shi Shixian local will carry out the information of I/O operation and the volume information of I/O by Local Socket transmission.
2) it realizes the finger daemon for supporting RBD read-write process, realizes the end server of RBD I/O, receive sanlock calling The end client transferring content, carry out RBD I/O, while realizing dynamic multithreading, to avoid sanlock to RBD I/O pressure it is bigger when decompression operation, while realizing the long connection of RBD read-write, avoid because it is frequent open, read-write, The memory that closing causes process to occupy increases.
One embodiment of the invention additionally provides a kind of distributed lock realization device, and structure is as shown in Figure 2, comprising:
Dedicated process management module 201 opens the dedicated finger daemon of distributed lock information for calling handle;
I/O module 202 carries out I/O operation to the shared storage of distributed lock for using the finger daemon.
Preferably, the I/O module 202, specifically for when there are multinomial I/O operation, the node is kept by described Different threads in shield process complete the multinomial I/O operation.
Preferably, the I/O module 202 is deposited by local socket Local Socket with the shared of the distributed lock Storage is communicated.
Preferably, the dedicated process management module 201 is also used to the shape of reliable autonomous distributed objects and RBD State when causing I/O operation to fail extremely, closes the handle opened originally, re-call handle open it is described reliable autonomous Distributed objects and RBD.
The embodiment provides a kind of distributed lock implementation method and device, node calls handle, opens distribution The dedicated finger daemon of formula lock information, the node use the finger daemon, carry out I/O behaviour to the shared storage of distributed lock Make.By dedicated finger daemon, third-party agent I/O operation is realized, it is distributed to solve the compatible RBD of integrated I/O model Lock increases memory burden, influences the problem of performance, realizes the efficient distributed lock system for supporting RBD.
By increasing third-party agent, sanlock is set to support RBD volumes of read-write process, so that sanlock be enable to be compatible with RBD is realized a set of distributed lock system that can support RBD, more easily cluster is allowed to be stored using distributed block, is guaranteed The data consistency of distributed block storage.
It will appreciated by the skilled person that whole or certain steps, system, dress in method disclosed hereinabove Functional module/unit in setting may be implemented as software, firmware, hardware and its combination appropriate.In hardware embodiment, Division between the functional module/unit referred in the above description not necessarily corresponds to the division of physical assemblies;For example, one Physical assemblies can have multiple functions or a function or step and can be executed by several physical assemblies cooperations.Certain groups Part or all components may be implemented as by processor, such as the software that digital signal processor or microprocessor execute, or by It is embodied as hardware, or is implemented as integrated circuit, such as specific integrated circuit.Such software can be distributed in computer-readable On medium, computer-readable medium may include computer storage medium (or non-transitory medium) and communication media (or temporarily Property medium).As known to a person of ordinary skill in the art, term computer storage medium is included in for storing information (such as Computer readable instructions, data structure, program module or other data) any method or technique in the volatibility implemented and non- Volatibility, removable and nonremovable medium.Computer storage medium include but is not limited to RAM, ROM, EEPROM, flash memory or its His memory technology, CD-ROM, digital versatile disc (DVD) or other optical disc storages, magnetic holder, tape, disk storage or other Magnetic memory apparatus or any other medium that can be used for storing desired information and can be accessed by a computer.This Outside, known to a person of ordinary skill in the art to be, communication media generally comprises computer readable instructions, data structure, program mould Other data in the modulated data signal of block or such as carrier wave or other transmission mechanisms etc, and may include any information Delivery media.

Claims (10)

1. a kind of distributed lock implementation method characterized by comprising
Node calls handle, opens the dedicated finger daemon of distributed lock information;
The node uses the finger daemon, carries out I/O operation to the shared storage of distributed lock.
2. distributed lock implementation method according to claim 1, which is characterized in that described when there are multinomial I/O operation Node completes the multinomial I/O operation by the different threads in the finger daemon.
3. distributed lock implementation method according to claim 1, which is characterized in that the shared storage to distributed lock The step of carrying out I/O operation specifically:
It is communicated by the local socket Local Socket of the node with the shared storage of the distributed lock.
4. distributed lock implementation method according to claim 3, which is characterized in that the node and the distributed lock The information of shared storage interaction includes the operation information of I/O operation and the volume information that operation is directed to.
5. distributed lock implementation method according to claim 1, which is characterized in that by distributed memory system Reliable autonomous distributed objects storage block device RBD carries out I/O operation of the I/O operation realization to the shared storage.
6. distributed lock implementation method according to claim 1, which is characterized in that the node using it is described guard into Journey, after the step of carrying out I/O operation to the shared storage of distributed lock, further includes:
The state that reliable autonomous distributed objects and RBD are checked in I/O operation failure, is closed original in abnormal state The handle of opening re-calls handle and opens the reliable autonomous distributed objects and RBD.
7. a kind of distributed lock realization device characterized by comprising
Dedicated process management module opens the dedicated finger daemon of distributed lock information for calling handle;
I/O module carries out I/O operation to the shared storage of distributed lock for using the finger daemon.
8. distributed lock realization device according to claim 7, which is characterized in that
The I/O module, specifically for when there are multinomial I/O operation, the node passes through the difference in the finger daemon Thread completes the multinomial I/O operation.
9. distributed lock realization device according to claim 7, which is characterized in that the I/O module passes through local socket Word Local Socket is communicated with the shared storage of the distributed lock.
10. distributed lock realization device according to claim 7, which is characterized in that
The dedicated process management module is also used to the state of reliable autonomous distributed objects and RBD, leads to I/O extremely When operation failure, close the handle opened originally, re-call handle open the reliable autonomous distributed objects and RBD。
CN201811291959.XA 2018-11-01 2018-11-01 Distributed lock implementation method and device Active CN109375988B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811291959.XA CN109375988B (en) 2018-11-01 2018-11-01 Distributed lock implementation method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811291959.XA CN109375988B (en) 2018-11-01 2018-11-01 Distributed lock implementation method and device

Publications (2)

Publication Number Publication Date
CN109375988A true CN109375988A (en) 2019-02-22
CN109375988B CN109375988B (en) 2021-07-30

Family

ID=65396841

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811291959.XA Active CN109375988B (en) 2018-11-01 2018-11-01 Distributed lock implementation method and device

Country Status (1)

Country Link
CN (1) CN109375988B (en)

Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5699500A (en) * 1995-06-01 1997-12-16 Ncr Corporation Reliable datagram service provider for fast messaging in a clustered environment
US7565406B2 (en) * 2002-07-24 2009-07-21 Sun Microsystems, Inc. Last thread lock management for multi-threaded process and distributed data systems
CN106201357A (en) * 2016-07-18 2016-12-07 浪潮(北京)电子信息产业有限公司 The construction method of a kind of storage pool and system
CN106572130A (en) * 2015-10-09 2017-04-19 阿里巴巴集团控股有限公司 Method used for realizing distributed lock management and equipment thereof
CN106909384A (en) * 2017-02-27 2017-06-30 郑州云海信息技术有限公司 A kind of sanlock optimization method and devices based on cluster file system
CN107239238A (en) * 2017-07-27 2017-10-10 郑州云海信息技术有限公司 A kind of I/O operation method and device of the storage based on distributed lock
CN107357664A (en) * 2017-07-13 2017-11-17 郑州云海信息技术有限公司 The implementation method and device of a kind of distributed lock
CN107517277A (en) * 2017-10-09 2017-12-26 郑州云海信息技术有限公司 A kind of sanlock lock implementation methods and device
CN107888689A (en) * 2017-11-16 2018-04-06 无锡地铁集团有限公司 Locking resource allocation method based on shared storage

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5699500A (en) * 1995-06-01 1997-12-16 Ncr Corporation Reliable datagram service provider for fast messaging in a clustered environment
US7565406B2 (en) * 2002-07-24 2009-07-21 Sun Microsystems, Inc. Last thread lock management for multi-threaded process and distributed data systems
CN106572130A (en) * 2015-10-09 2017-04-19 阿里巴巴集团控股有限公司 Method used for realizing distributed lock management and equipment thereof
CN106201357A (en) * 2016-07-18 2016-12-07 浪潮(北京)电子信息产业有限公司 The construction method of a kind of storage pool and system
CN106909384A (en) * 2017-02-27 2017-06-30 郑州云海信息技术有限公司 A kind of sanlock optimization method and devices based on cluster file system
CN107357664A (en) * 2017-07-13 2017-11-17 郑州云海信息技术有限公司 The implementation method and device of a kind of distributed lock
CN107239238A (en) * 2017-07-27 2017-10-10 郑州云海信息技术有限公司 A kind of I/O operation method and device of the storage based on distributed lock
CN107517277A (en) * 2017-10-09 2017-12-26 郑州云海信息技术有限公司 A kind of sanlock lock implementation methods and device
CN107888689A (en) * 2017-11-16 2018-04-06 无锡地铁集团有限公司 Locking resource allocation method based on shared storage

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
王志翔: "面向高并发数据访问的并行I/O性能优化机制研究", 《万方平台》 *

Also Published As

Publication number Publication date
CN109375988B (en) 2021-07-30

Similar Documents

Publication Publication Date Title
US11372802B2 (en) Virtual RDMA switching for containerized applications
US8429675B1 (en) Virtual machine communication
US8443231B2 (en) Updating a list of quorum disks
US8788579B2 (en) Clustered client failover
US11698759B2 (en) Resolving failed or hanging mount points in a clustered storage solution for containers
US20160077996A1 (en) Fibre Channel Storage Array Having Standby Controller With ALUA Standby Mode for Forwarding SCSI Commands
US20130081013A1 (en) Memory Coherency Acceleration Via Virtual Machine Migration
EP3815294B1 (en) Method and apparatus for implementing a distributed blockchain transaction processing element in a datacenter
US10838977B2 (en) Key-value replication with consensus protocol
US11917023B2 (en) Fast session restoration for latency sensitive middleboxes
US20180095694A1 (en) Small storage volume management
CN113342422A (en) Linux-compatible Android multi-application camera access method and device
CN109375988A (en) A kind of distributed lock implementation method and device
CN110018782B (en) Data reading/writing method and related device
CN110058790B (en) Method, apparatus and computer program product for storing data
CN106302733A (en) A kind of distributed type assemblies merges implementation method and the device of NFS protocol
WO2024001403A1 (en) Application update method, apparatus and system
US20230028407A1 (en) In-band modification of event notification preferences for server events
US11899935B2 (en) System and method for user space NVMe-over-RDMA host library
CN109358966A (en) A kind of storage service management method and device
CN106293678B (en) Method and system for managing variables of application service

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
GR01 Patent grant
GR01 Patent grant