CN112583626B - Information processing method and device based on distributed lock and computer readable medium - Google Patents

Information processing method and device based on distributed lock and computer readable medium Download PDF

Info

Publication number
CN112583626B
CN112583626B CN201910944837.4A CN201910944837A CN112583626B CN 112583626 B CN112583626 B CN 112583626B CN 201910944837 A CN201910944837 A CN 201910944837A CN 112583626 B CN112583626 B CN 112583626B
Authority
CN
China
Prior art keywords
session
statistical window
distributed
active
distributed 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.)
Active
Application number
CN201910944837.4A
Other languages
Chinese (zh)
Other versions
CN112583626A (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.)
Alibaba Group Holding Ltd
Original Assignee
Alibaba Group Holding 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 Alibaba Group Holding Ltd filed Critical Alibaba Group Holding Ltd
Priority to CN201910944837.4A priority Critical patent/CN112583626B/en
Publication of CN112583626A publication Critical patent/CN112583626A/en
Application granted granted Critical
Publication of CN112583626B publication Critical patent/CN112583626B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/50Network service management, e.g. ensuring proper service fulfilment according to agreements
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/50Network service management, e.g. ensuring proper service fulfilment according to agreements
    • H04L41/5003Managing SLA; Interaction between SLA and QoS
    • H04L41/5009Determining service level performance parameters or violations of service level contracts, e.g. violations of agreed response time or mean time between failures [MTBF]

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computer And Data Communications (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The scheme firstly determines active sessions in a statistical window and first sessions which are not expired in the statistical window in the active sessions, then determines a first number of distributed locks associated with the active sessions in the statistical window and a second number of distributed locks associated with the first sessions according to the number of the distributed locks associated with each active session, and further determines the service quality of the distributed locks of the statistical window according to the first number and the second number. According to the scheme, whether the session is expired in the statistical window and the number of the distributed locks related to the session are used as core indexes, and the condition that the expiration event of each session only affects one statistical window is limited, so that the service quality of the distributed locks can be accurately reflected.

Description

Information processing method and device based on distributed lock and computer readable medium
Technical Field
The present application relates to the field of information technologies, and in particular, to an information processing method and apparatus based on a distributed lock, and a computer readable medium.
Background
Distributed lock services are widely applied to cloud computing products, and in order to promote standardization of Service quality, an SLA (Service-Level Agreement) is generally used as a measure of Service quality.
The distributed lock service has the following two characteristics: firstly, mutual exclusivity is adopted, namely the lock resource of a server is preempted by at most one client at the same time; then is the final availability, i.e., the occupancy of the distributed lock resource by any client is a lifetime that depends on a periodic heartbeat between the client and the server to continue. If the heartbeat packet reply from the server is not received within the lifetime determined by the client, the client judges that the session is overdue, confirms that the lock is lost, and further does not provide the resource access service associated with the distributed lock.
The implementation of the distributed lock service relies on the client and the server maintaining a two-way session with keep-alive as shown in figure 1. The session maintains its lease on both client/server sides through periodic heartbeat requests. The server and the client both record lease timeout time, the client can send heartbeat requests to the server regularly, and the server can return a response to the client after receiving the heartbeat requests, so that one successful heartbeat interaction is completed, the lease timeout time of the client and the lease timeout time of the server are respectively prolonged, and the purpose of maintaining sessions without over-term is achieved.
A successful heartbeat interaction can extend a lifetime lease of a session if the heartbeat response arrival time point must be earlier than the lease expire time point. The heartbeat request is sent one at a time interval, so the lease duration is usually set to be several times longer than the interval time, so as to improve the robustness of the distributed lock service, and avoid the occurrence of a distributed lock loss event due to the session expiration caused by the failure of sending a single heartbeat request. Therefore, if the distributed lock service quality is measured based on the unit time failed heartbeat to total heartbeat by referring to the existing SLA index calculation mode, for a scene that a part of heartbeats in a session lifetime fails, a part of heartbeats succeeds, and the distributed lock lifetime continues successfully, in fact, the access service provided by the service based on the distributed lock service is not affected, but the SLA index of the related distributed lock service is jittered, so that the scheme cannot accurately measure the distributed lock service quality.
Summary of the invention
An object of the present application is to provide an information processing scheme based on distributed locks to solve the problem that the current scheme cannot accurately measure the service quality of distributed locks.
To achieve the above object, some embodiments of the present application provide an information processing method based on a distributed lock, including:
determining active sessions within a statistical window and a first session of the active sessions that is not expired within the statistical window;
determining a first number of distributed locks associated with the active session and a second number of distributed locks associated with the first session in the statistical window according to the number of distributed locks associated with the active session;
and determining the distributed lock service quality of the statistical window according to the first quantity and the second quantity.
An embodiment of the present application further provides an information processing apparatus based on a distributed lock, including:
the session calculation module is used for determining an active session in a statistical window and a first session which is not expired in the statistical window in the active session;
a lock calculation module, configured to determine, according to the number of distributed locks associated with the active session, a first number of distributed locks associated with the active session and a second number of distributed locks associated with the first session within the statistics window;
and the service quality calculation module is used for determining the service quality of the distributed locks of the statistical windows according to the first quantity and the second quantity.
Furthermore, some embodiments of the present application also provide a computing device comprising a memory for storing computer program instructions and a processor for executing the computer program instructions, wherein the computer program instructions, when executed by the processor, trigger the device to perform the distributed lock-based information processing method.
Still other embodiments of the present application provide a computer-readable medium having stored thereon computer program instructions executable by a processor to implement the distributed lock-based information processing method.
In the information processing scheme based on the distributed locks provided by the embodiment of the application, firstly, active sessions in a statistical window and a first session which is not expired in the statistical window in the active sessions are determined, then, according to the number of the distributed locks associated with the active sessions, a first number of the distributed locks associated with the active sessions in the statistical window and a second number of the distributed locks associated with the first session are determined, and further, according to the first number and the second number, the service quality of the distributed locks in the statistical window is determined. According to the scheme, whether the session in the statistical window is expired or not and the number of the distributed locks related to the session are used as core indexes, and the fact that the expiration event of each session only affects one statistical window is limited, so that the service quality of the distributed locks can be accurately reflected.
Drawings
Other features, objects and advantages of the present application will become more apparent upon reading of the following detailed description of non-limiting embodiments thereof, made with reference to the accompanying drawings in which:
FIG. 1 is a schematic diagram of the heartbeat keep alive principle of a distributed lock service;
FIG. 2 is a flowchart illustrating a process for determining a distributed lock based information processing method according to an embodiment of the present application;
FIG. 3 is a diagram illustrating session states in one embodiment of the present application;
fig. 4 is a schematic diagram of a service scenario of a distributed lock service in an embodiment of the present application;
FIG. 5 is a diagram illustrating session states in another embodiment of the present application;
fig. 6 is a schematic structural diagram of an information processing apparatus based on a distributed lock according to an embodiment of the present application;
FIG. 7 is a schematic structural diagram of another information processing apparatus based on a distributed lock according to an embodiment of the present application;
the same or similar reference numbers in the drawings identify the same or similar elements.
Detailed Description
The present application is described in further detail below with reference to the attached drawing figures.
In a typical configuration of the present application, the terminal, the devices serving the network each include one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
The memory may include forms of volatile memory in a computer readable medium, random Access Memory (RAM) and/or non-volatile memory, such as Read Only Memory (ROM) or flash memory (flash RAM). Memory is an example of a computer-readable medium.
Computer-readable media, which include both non-transitory and non-transitory, removable and non-removable media, may implement the information storage by any method or technology. The information may be computer readable instructions, data structures, program means, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static Random Access Memory (SRAM), dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), read Only Memory (ROM), electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), digital Versatile Disks (DVD) or other optical storage, magnetic cassettes, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other non-transmission medium which can be used to store information and which can be accessed by a computing device.
The embodiment of the application provides an information processing method based on distributed locks, which is based on whether a session in a statistical window is expired and the number of distributed locks associated with the session as core indexes, and limits that the expiration event of each session only affects one statistical window, so that the service quality of the distributed locks can be accurately reflected.
In an actual scenario, the method may be implemented at a client of the distributed lock service, or at a server of the distributed lock service. The device for carrying out the method can be a user device, a network device or a device formed by integrating the user device and the network device through a network. The user equipment includes but is not limited to various terminal devices such as a personal computer, a smart phone, a tablet computer, and the like, and the network device includes but is not limited to implementations such as a network host, a single network server, multiple network server sets, or a computer set based on cloud computing.
Fig. 2 shows a processing flow chart of an information processing method based on a distributed lock according to an embodiment of the present application, where the method may include the following steps:
step S201, determining an active session in a statistical window and a first session in the active session that is not expired in the statistical window. The statistical window is a time window set according to the requirements of an actual scene, and may be set to 5min, 10min, 30min, 60min, or the like, for example, so that the result of the determined distributed lock service quality is the distributed lock service quality in one statistical window.
The active session refers to a session existing in any time period in a statistical window, and may include, for example, a session that has been established at the start of the statistical window and has not expired yet at the end of the statistical window, a session that has been established at the start of the statistical window and has expired yet at a certain time in the statistical window, a session that has been established at a certain time in the statistical window and has not expired yet at a certain time in the statistical window, or a session that has been established at a certain time in the statistical window and has expired later at a certain time in the statistical window. As shown in fig. 3, t1 to t2 are the start time and the end time of the statistical window w1, respectively, in the time window, sessions 1 to 4 are active sessions within the statistical window w1, respectively, and sessions 5 to 6 do not belong to active sessions within the statistical window w 1.
The first session that is not expired in the statistical window in the active sessions refers to a session expiration event that does not occur before the statistical window is terminated in all active sessions of the current statistical window, and a session with a valid lease is still maintained, for example, in four active sessions 1 to 4 of the statistical window w1, the first session is session 2 and session 3, and session 1 and session 4 do not belong to the first session because they have expired before the termination time of the statistical window.
In some embodiments of the present application, when determining an active session within a statistical window and a first session of the active session that is not expired in the statistical window, the active session within the statistical window may be determined first, and then it may be determined whether a session expiration event occurs in the statistical window for the active session. Based on the heartbeat keep-alive principle shown in fig. 1, for the client of the distributed lock service, the corresponding session expiration event is that the response of the heartbeat request is not received before the time point of lease expiration, and for the server of the distributed lock service, the heartbeat request sent by the client is not received before the time point of lease expiration. After determining whether a session expiration event occurs for the active session, an active session for which no session expiration event occurs within the statistical window may be determined as the first session.
In some embodiments of the present application, for each active session in each statistical period, a corresponding state value may be recorded, and if it is determined that a session expiration event does not occur in a statistical window for an active session, the state value may be set to a first state value, whereas if it is determined that a session expiration event occurs in the statistical window for an active session, the state value may be set to a second state value. For example, for 4 active sessions 1 to 4 in the statistical window w1, if the first state value is 1 and the second state value is 0, the state values of these active sessions can be shown in the following table.
Figure BDA0002223860290000051
Figure BDA0002223860290000061
Thus, the first session of the active sessions, i.e. session 2 and session 3, which is not expired in the statistical window, can be determined according to the state value of the active sessions.
Step S202, according to the number of distributed locks associated with the active session, determining a first number of distributed locks associated with the active session and a second number of distributed locks associated with the first session in the statistical window.
A lease active session may not have distributed locks associated with it, or may have one or more distributed locks associated with it, which in an actual scenario may also correspond to actual business resources. Therefore, the lost locks caused by the expiration of different sessions have different influence degrees on the service, and further, users have different perceptions about the service quality of the distributed locks. Still taking the statistical window w1 as an example, if the four corresponding sessions 1 to 4 are respectively associated with 30, 40, 70 and 50 distributed lock resources, it may be calculated that the first number of distributed locks associated with active sessions in the statistical window is 30+40+70+50=190, and the second number of distributed locks associated with the first session is 40+70=110.
Step S203 determines the distributed lock service quality of the statistical window according to the first number and the second number, for example, a ratio of the first number and the second number may be used as an index value of the distributed lock service quality of the statistical window. Thus, for the above-mentioned statistical window w1, the distributed lock quality of service is 110/190 ≈ 0.58.
If the state of the active session is marked by the state value in the embodiment of the present application, so as to distinguish whether the active session is expired, a ratio between the second number of the distributed locks associated with the first session in the statistical window and the first number of the distributed locks associated with the active session in the statistical window may be determined as the distributed lock service quality of the statistical window. In an actual scenario, the distributed lock service quality of the statistical window may be calculated according to the following formula:
Figure BDA0002223860290000062
wherein, SLA i Distributed Lock quality of service, N, representing statistical Window i i Representing the number of active sessions, L, within a statistical window i j Represents the number of distributed locks, S, associated with the jth active session within the statistical window j A state value representing the jth active session, the first state value being 1 and the second state value being 0. For the aforementioned statistical window w1, the calculation process by the above formula is as follows:
Figure BDA0002223860290000071
in some embodiments of the present application, if a device executing the method can acquire whether each distributed lock is occupied, the distributed lock service quality of the statistical window may be determined more accurately. In the method provided in this embodiment, an available duration ratio of the distributed lock associated with the active session in the statistical window may also be determined, where the available duration is a duration that the distributed lock is occupied in the statistical window, and the available duration ratio is a ratio of the available duration to the entire statistical window.
For a distributed lock, the distributed lock is released when a session established between a client and a server associated with the distributed lock service expires, and other clients contend for the distributed lock again to obtain operation rights on the service resource corresponding to the distributed lock. Therefore, if the device executing the method can acquire whether each distributed lock is occupied, the acquired whether the distributed lock is occupied can be used to determine the duration of all distributed locks associated with the active session that are occupied in the statistical window. For example, for a server of the distributed lock service, information that the distributed lock is released and occupied can be directly obtained. When the clients are implemented, the information of release and occupation of the distributed lock can be interacted among the clients in a specific mode, so that the available duration proportion of the distributed lock is determined, for example, a uniform processing node is set to summarize the information of release and occupation of the distributed lock on each client, and then the information is sent to each client.
Therefore, when the service quality of the distributed locks of the statistical window is determined, the index capable of more accurately reflecting the actual service quality of the distributed locks can be obtained according to the first quantity and the second quantity and by combining the available duration proportion of each distributed lock associated with the active session.
In some embodiments of the present application, when determining the distributed lock quality of service for the statistical window based on the first number and the second number in combination with an available duration fraction of each distributed lock associated with the active session, a weighted score for each distributed lock or for the active session may be determined based on the available duration fractions of the distributed locks in the active session.
For example, if the available duration of one distributed lock L1 is 0.8, the weighted score thereof may also be determined as 0.8, so that the weighted score of each distributed lock in the active sessions is calculated one by one, and the calculation is performed in combination with the number of sessions to obtain the quality of service of the distributed locks. Alternatively, after determining the weighted score for each distributed lock, a weighted score for each active session is calculated based on these weighted scores, e.g., for Session 1 in the aforementioned statistical window w1, if it contains 30 distributed locks, the weighted score of which is A k Where k is 1 to 30, identifying the 1 st to 30 th distributed locks, respectively, and then calculating the weighted score B for this active session 1 based on the following formula 1
Figure BDA0002223860290000081
Wherein alpha is k A coefficient representing each distributed lock may be associated with a traffic resource associated with the distributed lock, e.g., a higher coefficient may be set for resources that have a greater impact on traffic, and a lower coefficient may be set for resources that have a lesser impact on traffic. Combining the weighted score with the formula for calculating the distributed lock service quality of the statistical window, the following formula can be obtained:
Figure BDA0002223860290000082
therefore, the index capable of more accurately reflecting the service quality of the actual distributed lock can be obtained by combining the weighted score of the active session on the original scheme.
FIG. 4 illustrates a business scenario of a distributed lock service, in which an App Master (management node) schedules multiple App Workers to load different Partitions to cooperatively provide concurrent data access services. The App Master checks the App Worker to which the target Partition is scheduled for the received service access request from the service client, then informs the specific App Worker address to which the service client should access, and transfers the service access request to the specific App Workers for processing, thereby improving the concurrent service capability of the whole system.
In order to avoid data collision caused by the fact that a plurality of App Workers simultaneously load one Partition to provide service, when an App Master dispatches a certain App Worker to serve a certain Partition, the App Worker must contend for distributed lock ownership corresponding to the Partition, and can load the Partition to provide read-write access service. As shown in FIG. 4, the App Master schedules the Partition A and the Partition B to the App Worker 1, the App Worker 1 needs to contend for distributed lock ownership corresponding to the Partition A and the Partition B, and then the distributed lock can globally and uniquely provide read and write access services of the Partition A and the Partition B. In this scenario, the App Workers are clients of the distributed lock service, and the distributed consistent System service node systems are servers of the distributed lock service.
For the service scenario, when the scheme provided by the embodiment of the present application is used to determine the quality of service of the distributed lock, the method specifically includes the following processing steps:
step 1, confirming the number of active sessions in the current statistical window i. The session that expires before the start of the statistical window i does not participate in the statistics, and this value is denoted as N i
Step 2, for a specific session j (j is more than or equal to 1 and less than or equal to N i ) Confirming whether a session expiration event occurs in the statistical window, and recording the state value as S j (a session expired record is 0; a session unexpired record is 1).
Step 3, aiming at a specific session j (j is more than or equal to 1 and less than or equal to N) i ) Identifying the total number of its associated distributed locks within the statistical window, which is recorded as L j
Step 4, calculating an index value (namely an SLA value) of the distributed lock service quality of the current statistical window i in the following way:
Figure BDA0002223860290000091
FIG. 5 shows an example of computing the quality of service for a distributed lock, with sessions 1, 2, 3, 4, associated with 30, 40, 70, 50 distributed lock resources, respectively, at the initial time. For the 5 statistical windows in fig. 5: window 2, session 1 expired; window 3, session 2 expired; window 4, session 4 expired; the 5 th window, session 3, expires. For this scenario, according to the foregoing scheme, the SLA values of the distributed lock service in 5 statistical windows are 1.00,0.84,0.75, 0.58, and 0.00, respectively.
In the foregoing service scenario, the calculation of the service quality of the distributed lock may be implemented at a client (i.e., APP Worker), or may be implemented at a server (i.e., system). The service node of the distributed consistency system can conveniently acquire the time interval that one distributed lock is released by one App Worker and another App Worker rescues again, and the time interval is the available duration of the distributed lock, so that the influence of a lock losing event on the service can be reflected more accurately. Therefore, when the scheme is applied to a server, the available time length of each distributed lock can be counted in each counting window, and the service quality of the distributed lock can be more accurately determined by combining the information.
In an actual scenario, the scheme provided by the embodiment of the application can be provided to a user as an optional mode for detecting the SLA index of the distributed lock service, so that the user can select the SLA index. For example, in the user-oriented interactive interface, selectable options including multiple SLA index detection modes may be provided, where the detection modes may include the detection mode provided by the embodiment of the present application, and a mode of detecting an SLA index based on a failed heartbeat per unit time to a total heartbeat, and the like. Therefore, the user can select the detection mode according to actual requirements. In addition, the scheme can also be opened to a provider or a user of the cloud computing product as a product or a service, and the scheme is packaged into a program which can execute corresponding processing and detect the SLA index of the distributed lock service in the cloud computing product, so that the service quality of the distributed lock service is detected through the program.
Based on the same inventive concept, the embodiment of the application also provides an information processing device based on the distributed lock, the corresponding method of the device is the information processing method based on the distributed lock in the previous embodiment, and the principle of solving the problem is similar to the method.
According to the information processing device based on the distributed locks, whether the session is expired in the statistical window and the number of the distributed locks associated with the session can be used as core indexes, and the condition that only one statistical window is influenced by the expiration event of each session is limited, so that the service quality of the distributed locks can be accurately reflected.
In an actual scenario, the scheme may be implemented at a client of the distributed lock service, and may also be implemented at a server of the distributed lock service. The information processing device based on the distributed lock can be a user device, a network device or a device formed by integrating the user device and the network device through a network. The user equipment includes but is not limited to various terminal devices such as a personal computer, a smart phone, a tablet computer, and the like, and the network device includes but is not limited to an implementation such as a network host, a single network server, multiple network server sets, or a cloud computing-based computer set.
Fig. 6 shows a structure of an information processing apparatus based on a distributed lock according to an embodiment of the present application, including a session calculation module 610, a lock calculation module 620, and a quality of service calculation module 630. The session calculation module 610 is configured to determine active sessions within a statistical window and a first session of the active sessions that is not expired within the statistical window. The statistical window is a time window set according to the requirements of an actual scene, and may be set to, for example, 5min, 10min, 30min, 60min, and the like, and the result of the determined distributed lock service quality is the distributed lock service quality in one statistical window.
The active session refers to a session existing in any time period in a statistical window, and may include, for example, a session that has been established at the start of the statistical window and has not expired yet at the end of the statistical window, a session that has been established at the start of the statistical window and has expired yet at a certain time in the statistical window, a session that has been established at a certain time in the statistical window and has not expired yet at a certain time in the statistical window, or a session that has been established at a certain time in the statistical window and has expired later at a certain time in the statistical window. As shown in fig. 3, t1 to t2 are the start time and the end time of the statistical window w1, respectively, in the time window, sessions 1 to 4 are active sessions within the statistical window w1, respectively, and sessions 5 to 6 do not belong to active sessions within the statistical window w 1.
The first session that is not expired in the statistical window in the active sessions refers to a session expiration event that does not occur before the statistical window is terminated in all active sessions of the current statistical window, and a session with a valid lease is still maintained, for example, in four active sessions 1 to 4 of the statistical window w1, the first session is session 2 and session 3, and session 1 and session 4 do not belong to the first session because they have expired before the termination time of the statistical window.
In some embodiments of the present application, when determining an active session within a statistical window and a first session of the active sessions that is not expired in the statistical window, the session calculation module may first determine the active session within the statistical window, and then determine whether a session expiration event occurs in the active session within the statistical window. Based on the heartbeat keep-alive principle shown in fig. 1, for the client of the distributed lock service, the corresponding session expiration event is that the response of the heartbeat request is not received before the time point of lease expiration, and for the server of the distributed lock service, the heartbeat request sent by the client is not received before the time point of lease expiration. After determining whether a session expiration event occurs for the active session, an active session for which no session expiration event occurs within the statistical window may be determined as the first session.
In some embodiments of the present application, for each active session in each statistical period, a corresponding state value may be recorded, and if it is determined that a session expiration event does not occur in a statistical window for an active session, the state value may be set to a first state value, whereas if it is determined that a session expiration event occurs in the statistical window for an active session, the state value may be set to a second state value. For example, for 4 active sessions 1 to 4 in the statistical window w1, if the first state value is 1 and the second state value is 0, the state values of these active sessions can be shown in the following table.
Conversation 1 2 3 4
Status value 0 1 1 0
Thus, the first sessions of the active sessions, i.e. session 2 and session 3, which are not expired in the statistical window may be determined according to the state values of the active sessions.
The lock calculation module 620 is configured to determine, according to the number of distributed locks associated with the active session, a first number of distributed locks associated with the active session and a second number of distributed locks associated with the first session within the statistical window. A session with a valid lease may not have a distributed lock associated with it, or may have one or more distributed locks associated with it, and in an actual scenario, these distributed locks may also correspond to actual business resources. Therefore, the lost lock caused by the expiration of different sessions has different influence degrees on the service, and further, users have different perceptions on the service quality of the distributed lock. Still taking the statistical window w1 as an example, if the four corresponding sessions 1 to 4 are respectively associated with 30, 40, 70 and 50 distributed lock resources, it may be calculated that the first number of distributed locks associated with active sessions in the statistical window is 30+40+70+50=190, and the second number of distributed locks associated with the first session is 40+70=110.
The quality of service calculation module 630 is configured to determine the distributed lock quality of service of the statistical window according to the first quantity and the second quantity. For example, a ratio of the first number and the second number may be used as an index value of the distributed lock service quality of the statistical window. Thus, for the above-mentioned statistical window w1, the distributed lock quality of service is 110/190 ≈ 0.58.
If the state of the active session is marked by the state value in the embodiment of the present application, so as to distinguish whether the active session is expired, a ratio between the second number of the distributed locks associated with the first session in the statistical window and the first number of the distributed locks associated with the active session in the statistical window may be determined as the distributed lock service quality of the statistical window. In an actual scenario, the distributed lock service quality of the statistical window may be calculated according to the following formula:
Figure BDA0002223860290000121
wherein, SLA i Distributed Lock quality of service, N, representing statistical Window i i Representing the number of active sessions, L, within a statistical window i j Represents the number of distributed locks associated with the jth active session within the statistical window, S j A state value representing the jth active session, the first state value being 1 and the second state value being 0. For the aforementioned statistical window w1, the calculation process by the above formula is as follows:
Figure BDA0002223860290000122
in some embodiments of the present application, if a device executing the method can acquire whether each distributed lock is occupied, the service quality calculation module may determine the distributed lock service quality of the statistical window more accurately. In the method provided in this embodiment, the lock calculation module may further determine an available duration proportion of the distributed lock associated with the active session in the statistical window, where the available duration proportion is a duration that the distributed lock is occupied in the statistical window, and the available duration proportion is a proportion of the available duration in the entire statistical window.
For a distributed lock, the distributed lock is released when a session established between a client and a server associated with the distributed lock service expires, and other clients contend for the distributed lock again to obtain operation rights on the service resource corresponding to the distributed lock. Therefore, if the device executing the method can acquire whether each distributed lock is occupied, the acquired whether the distributed lock is occupied can be used to determine the duration of time that all distributed locks associated with the active session are occupied in the statistical window. For example, for a server of the distributed lock service, information that the distributed lock is released and occupied can be directly obtained. When the clients are implemented, the information of release and occupation of the distributed lock can be interacted among the clients in a specific mode, so that the available duration proportion of the distributed lock is determined, for example, a uniform processing node is set to summarize the information of release and occupation of the distributed lock on each client, and then the information is sent to each client.
Therefore, when the service quality of the distributed locks of the statistical window is determined, the service quality calculation module can obtain an index capable of more accurately reflecting the service quality of the actual distributed locks according to the first quantity and the second quantity and by combining the available duration proportion of each distributed lock associated with the active session.
In some embodiments of the application, when determining the distributed lock quality of service of the statistical window according to the first number and the second number and in combination with the available duration fraction of each distributed lock associated with the active session, a weighted score may be determined for each distributed lock or for the active session based on the available duration fractions of the distributed locks in the active session.
For example, if the available duration of one distributed lock L1 is 0.8, the weighted score thereof may also be determined as 0.8, so that the weighted score of each distributed lock in the active sessions is calculated one by one, and the calculation is performed in combination with the number of sessions to obtain the quality of service of the distributed locks. Alternatively, after determining the weighted score for each distributed lock, a weighted score for each active session is calculated based on these weighted scores, e.g., for Session 1 in the aforementioned statistical window w1, if it contains 30 distributed locks, the weighted score of which is A k Where k is 1 to 30, identifying the 1 st to 30 th distributed locks, respectively, and then calculating the weighted score B for this active session 1 based on the following formula 1
Figure BDA0002223860290000131
Wherein alpha is k A coefficient representing each distributed lock may be associated with a traffic resource with which the distributed lock is associated, e.g., a higher coefficient may be set for resources that have a greater impact on traffic and a lower coefficient may be set for resources that have a lesser impact on traffic. Combining the weighted score with the formula for calculating the distributed lock service quality of the statistical window, the following formula can be obtained:
Figure BDA0002223860290000141
therefore, the index capable of more accurately reflecting the service quality of the actual distributed lock can be obtained by combining the weighted score of the active session on the original scheme.
In addition, some of the present application may be implemented as a computer program product, such as computer program instructions, which when executed by a computer, may invoke or provide methods and/or techniques in accordance with the present application through the operation of the computer. Program instructions which invoke the methods of the present application may be stored on a fixed or removable recording medium and/or transmitted via a data stream on a broadcast or other signal bearing medium and/or stored in a working memory of a computer device operating in accordance with the program instructions. Some embodiments according to the present application include a computing device as shown in fig. 7, which includes one or more memories 710 storing computer-readable instructions and a processor 720 for executing the computer-readable instructions, wherein when the computer-readable instructions are executed by the processor, the device is caused to perform the method and/or the technical solution according to the embodiments of the present application.
Furthermore, some embodiments of the present application also provide a computer readable medium, on which computer program instructions are stored, the computer readable instructions being executable by a processor to implement the methods and/or aspects of the foregoing embodiments of the present application.
It should be noted that the present application may be implemented in software and/or a combination of software and hardware, for example, implemented using Application Specific Integrated Circuits (ASICs), general purpose computers or any other similar hardware devices. In some embodiments, the software programs of the present application may be executed by a processor to implement the above steps or functions. Likewise, the software programs (including associated data structures) of the present application may be stored in a computer readable recording medium, such as RAM memory, magnetic or optical drive or diskette and the like. Further, some of the steps or functions of the present application may be implemented in hardware, for example, as circuitry that cooperates with the processor to perform various steps or functions.
It will be evident to those skilled in the art that the present application is not limited to the details of the foregoing illustrative embodiments, and that the present application may be embodied in other specific forms without departing from the spirit or essential attributes thereof. The present embodiments are therefore to be considered in all respects as illustrative and not restrictive, the scope of the application being indicated by the appended claims rather than by the foregoing description, and all changes which come within the meaning and range of equivalency of the claims are therefore intended to be embraced therein. Any reference sign in a claim should not be construed as limiting the claim concerned. Furthermore, it is obvious that the word "comprising" does not exclude other elements or steps, and the singular does not exclude the plural. A plurality of units or means recited in the apparatus claims may also be implemented by one unit or means in software or hardware. The terms first, second, etc. are used to denote names, but not to denote any particular order.

Claims (14)

1. An information processing method based on distributed locks comprises the following steps:
determining active sessions within a statistical window and a first session of the active sessions that is not expired within the statistical window;
determining a first number of distributed locks associated with the active session and a second number of distributed locks associated with the first session in the statistical window according to the number of distributed locks associated with the active session;
and determining the distributed lock service quality of the statistical window according to the first quantity and the second quantity.
2. The method of claim 1, wherein determining an active session within a statistical window and a first session of the active sessions that is not expired within the statistical window comprises:
determining active sessions within a statistical window;
judging whether a session expiration event occurs in the active session in the statistical window;
and determining the active session without the session expiration event in the statistical window as the first session.
3. The method of claim 2, wherein determining an active session for which no session expiration event has occurred within the statistical window as the first session comprises:
recording the state value of the active session, wherein the state value corresponding to the session expiration event which does not occur in the statistical window is a first state value, and the state value corresponding to the session expiration event which occurs in the statistical window is a second state value;
and determining a first session which is not expired in the statistical window in the active sessions according to the state value.
4. The method of claim 3, wherein determining the distributed lock quality of service for the statistical window from the first number and the second number comprises:
determining a ratio between a second number of distributed locks associated with a first session within the statistics window and a first number of distributed locks associated with active sessions within the statistics window as a distributed lock quality of service for the statistics window.
5. The method of any of claims 1 to 4, wherein the method further comprises:
determining an available duration of a distributed lock associated with the active session in the statistical window, wherein the available duration is the duration of the distributed lock occupied in the statistical window;
determining the distributed lock quality of service of the statistical window according to the first quantity and the second quantity, including:
and determining the service quality of the distributed locks of the statistical window according to the first quantity and the second quantity and by combining the available duration ratio of each distributed lock associated with the active session.
6. The method of claim 5, wherein determining the distributed lock quality of service for the statistical window based on the first number and the second number in combination with an available duration fraction of each distributed lock associated with an active session comprises:
calculating the weighted score of the active session according to the available duration proportion of each distributed lock associated with the active session;
and calculating the distributed lock service quality of the statistical window according to the first quantity, the second quantity and the weighted score of the active session.
7. An information processing apparatus based on a distributed lock, comprising:
the session calculation module is used for determining an active session in a statistical window and a first session which is not expired in the statistical window in the active session;
a lock calculation module, configured to determine, according to the number of distributed locks associated with the active session, a first number of distributed locks associated with the active session in the statistics window and a second number of distributed locks associated with the first session;
and the service quality calculation module is used for determining the service quality of the distributed locks of the statistical windows according to the first quantity and the second quantity.
8. The device of claim 7, wherein the session calculation module is to determine active sessions within a statistical window; judging whether a session expiration event occurs in the active session in the statistical window; and determining the active session without the session expiration event in the statistical window as the first session.
9. The device according to claim 8, wherein the session calculation module is configured to record a state value of the active session, where a state value corresponding to no occurrence of a session expiration event in the statistical window is a first state value, and a state value corresponding to occurrence of a session expiration event in the statistical window is a second state value; and determining a first session which is not expired in the statistical window in the active sessions according to the state value.
10. The device of claim 9, wherein the quality of service calculation module is configured to determine a ratio between the second number of distributed locks associated with the first session within the statistical window and the first number of distributed locks associated with the active sessions within the statistical window as the distributed lock quality of service for the statistical window.
11. The device of any one of claims 7 to 10, wherein the lock calculation module is further configured to determine an available duration of the distributed lock associated with the active session within the statistical window as a ratio, wherein the available duration is a duration of the distributed lock that is occupied within the statistical window;
and the service quality calculation module is used for determining the service quality of the distributed locks of the statistical window according to the first quantity and the second quantity and by combining the available duration ratio of each distributed lock associated with the active session.
12. The device of claim 11, wherein the lock computation module is configured to compute a weighted score for the active session based on a ratio of available durations for each distributed lock associated with the active session; and calculating the distributed lock service quality of the statistical window according to the first quantity, the second quantity and the weighted score of the active session.
13. A computing device, wherein the device comprises a memory for storing computer program instructions and a processor for executing the computer program instructions, wherein the computer program instructions, when executed by the processor, trigger the device to perform the method of any of claims 1 to 6.
14. A computer readable medium having stored thereon computer program instructions executable by a processor to implement the method of any one of claims 1 to 6.
CN201910944837.4A 2019-09-30 2019-09-30 Information processing method and device based on distributed lock and computer readable medium Active CN112583626B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910944837.4A CN112583626B (en) 2019-09-30 2019-09-30 Information processing method and device based on distributed lock and computer readable medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910944837.4A CN112583626B (en) 2019-09-30 2019-09-30 Information processing method and device based on distributed lock and computer readable medium

Publications (2)

Publication Number Publication Date
CN112583626A CN112583626A (en) 2021-03-30
CN112583626B true CN112583626B (en) 2023-02-28

Family

ID=75116626

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910944837.4A Active CN112583626B (en) 2019-09-30 2019-09-30 Information processing method and device based on distributed lock and computer readable medium

Country Status (1)

Country Link
CN (1) CN112583626B (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101252603A (en) * 2008-04-11 2008-08-27 清华大学 Cluster distributed type lock management method based on storage area network SAN
CN105703940A (en) * 2015-12-10 2016-06-22 中国电力科学研究院 Multistage dispatching distributed parallel computing-oriented monitoring system and monitoring method
CN109660633A (en) * 2019-01-30 2019-04-19 北京云端智度科技有限公司 A kind of cluster system based on distributed scheduling scheme
CN110266731A (en) * 2013-10-24 2019-09-20 微软技术许可有限责任公司 For the system and method for the service strategy of communication session

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7028300B2 (en) * 2001-11-13 2006-04-11 Microsoft Corporation Method and system for managing resources in a distributed environment that has an associated object

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101252603A (en) * 2008-04-11 2008-08-27 清华大学 Cluster distributed type lock management method based on storage area network SAN
CN110266731A (en) * 2013-10-24 2019-09-20 微软技术许可有限责任公司 For the system and method for the service strategy of communication session
CN105703940A (en) * 2015-12-10 2016-06-22 中国电力科学研究院 Multistage dispatching distributed parallel computing-oriented monitoring system and monitoring method
CN109660633A (en) * 2019-01-30 2019-04-19 北京云端智度科技有限公司 A kind of cluster system based on distributed scheduling scheme

Also Published As

Publication number Publication date
CN112583626A (en) 2021-03-30

Similar Documents

Publication Publication Date Title
US10838777B2 (en) Distributed resource allocation method, allocation node, and access node
US11288253B2 (en) Allocation method and device for a distributed lock
WO2021143350A1 (en) Data processing method and live broadcast system
CN107783842B (en) Distributed lock implementation method, device and storage device
US6035418A (en) System and method for improving resource utilization in a TCP/IP connection management system
CN110162270B (en) Data storage method, storage node and medium based on distributed storage system
CN111259030A (en) Thread execution method and device based on distributed lock and storage medium
CN110458681B (en) Data reconciliation decision method, device, server and storage medium
CN106686104B (en) Method and equipment for operation and maintenance of target server
CN109246182B (en) Distributed lock manager and implementation method thereof
CN109951374B (en) Virtual resource object allocation method and equipment
CN112995046A (en) Content distribution network traffic management method and equipment
CN108965054A (en) A kind of client and service end data rapid interactive method
CN108241535B (en) Resource management method and device and server equipment
CN110928489B (en) Data writing method and device and storage node
CN112583626B (en) Information processing method and device based on distributed lock and computer readable medium
CN109428682A (en) A kind of Message Processing confirmation method and device
CN113312391A (en) Method and equipment for cache asynchronous delay refreshing
CN106909436A (en) Produce the method and system of the dependency relation of virtual machine message queue application program
US7747755B2 (en) Method and apparatus for session management in an enterprise java bean session bean
CN113438250A (en) Abnormal event processing method and equipment
CN110363482A (en) Method of counting, device, server and storage medium
US11061602B2 (en) System and method for event based storage management
CN107395745A (en) A kind of distributed memory system data disperse Realization of Storing
CN111161019B (en) Data processing system and method

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