Search

CN-122019637-A - Service dependency relationship efficient management and query method based on dynamic bitmask

CN122019637ACN 122019637 ACN122019637 ACN 122019637ACN-122019637-A

Abstract

The invention provides a service dependency relationship efficient management and query method based on a dynamic bit mask, which is characterized in that a unique service bit identifier is allocated to each service, and the mapping relation between the service and the service bit identifier is recorded to a service bit mapping table, wherein the service bit identifier is increased according to the registration sequence of the service, the service bit identifier of the service on which the current service depends is called from the service bit mapping table, bit operation is carried out based on the service bit identifier of the service on which the current service depends to obtain a dependency relationship variable, and the dependency relationship variable is stored in a dependency relationship field of the current service, so that the method has the advantages of high storage space efficiency, convenience for complex query and low overall complexity.

Inventors

  • LI SIYU
  • ZHANG BIAO
  • YANG XIANG

Assignees

  • 杭州视洞科技有限公司

Dates

Publication Date
20260512
Application Date
20260206

Claims (10)

  1. 1. A service dependency management method based on dynamic bitmasks, comprising the steps of: allocating a unique service bit identifier to each service, and recording the mapping relation between the service and the service bit identifier to a service bit mapping table, wherein the service bit identifier is increased according to the registration sequence of the service; and retrieving the service bit identification of the service on which the current service depends from the service bit mapping table, performing bit operation based on the service bit identification of the relied service to obtain a dependency variable, and storing the dependency variable into a dependency field of the current service.
  2. 2. The service dependency relationship management method based on dynamic bit mask according to claim 1, wherein if the dependency relationship of the current service requires a new service, the service bit identifier of the new service is called from the service bit mapping table, the dependency relationship variable of the current service is called, bit operation is performed on the service bit identifier of the new service to obtain the new mask, bit OR operation is performed on the basis of the dependency relationship variable and the new mask to obtain a new dependency relationship variable, and the new dependency relationship variable is updated into the dependency relationship field of the current service; And if the dependency relationship of the current service needs to be deleted, calling the dependency relationship variable of the current service, carrying out bit operation on the service bit identifier of the deleted service to obtain a deletion mask, carrying out bit-wise AND operation on the dependency relationship variable and the deletion mask to obtain a new dependency relationship variable, and updating the new dependency relationship variable into the dependency relationship field of the current service.
  3. 3. The method for managing service dependency relationship based on dynamic bit mask according to claim 2, wherein if the dependency relationship of the current service requires a new service, firstly judging whether the new service has a service bit identifier, if the new service does not have a service bit identifier, assigning a unique service bit identifier to each service, updating the mapping relationship between the service and the service bit identifier to a service bit mapping table, then retrieving the service bit identifier of the new service from the service bit mapping table, if the dependency relationship of the current service requires a deletion of the service, retrieving the dependency relationship variable of the current service to judge whether the current service has a service which needs to be deleted currently, and if not, alarming.
  4. 4. The service dependency relationship management method based on dynamic bit mask according to claim 1, wherein the value range of the service bit identifier is a continuous integer ranging from 0 to 2047, and when the value of the service bit identifier exceeds the single word length coverage range, a plurality of dependency relationship variables are designed for the current service packet.
  5. 5. The service dependency relationship management method as claimed in claim 1, wherein for each service bit identifier of the dependent service, a left shift operation is performed to convert the service bit identifier of the dependent service into a binary identifier having a position of 1 corresponding to the service bit identifier and the rest of positions of 0, and if there is only one dependent service, converting the binary identifier into an integer dependent relationship variable, and if there are a plurality of dependent services, merging the plurality of binary identifiers into an integer as a dependent relationship variable by bit or operation.
  6. 6. A service dependency query method based on dynamic bitmasks, comprising: allocating a unique service bit identifier to each service, and recording the mapping relation between the service and the service bit identifier to a service bit mapping table, wherein the service bit identifier is increased according to the registration sequence of the service; Retrieving service bit identifiers of services on which the current service depends from the service bit mapping table, performing bit operation based on the service bit identifiers of the relied services to obtain dependency relationship variables, and storing the dependency relationship variables into dependency relationship fields of the current service; constructing a dependency relation query statement based on the query content, wherein the query content records a target service and a query mode; And querying the dependency fields of all services based on the dependency query statement to obtain a query result.
  7. 7. The service dependency relationship query method based on dynamic bit mask according to claim 6, wherein when the query mode is single-dependency query, the service bit identifier of the target service is converted into a query bit identifier, a dependency relationship query statement is constructed based on the query bit identifier and the dependency relationship field, the corresponding dependency relationship query statement performs bitwise and operation based on the query bit identifier and the dependency relationship field of all services, and the service with the operation result of 1 by bitwise and operation is taken as the query result.
  8. 8. The service dependency relationship query method based on dynamic bit masks according to claim 6, wherein when the query mode is multi-dependency joint query, the service bit identifier of each target service is converted into a query bit identifier, then the target bit mask is obtained through bitwise OR operation, a dependency relationship query statement is constructed based on the target bit mask and the dependency relationship fields, the corresponding dependency relationship query statement performs bitwise AND operation based on the target bit mask and the dependency relationship fields of all the services, and the service with the bitwise AND operation result identical to the target bit mask is taken as the query result.
  9. 9. The service dependency relationship query method based on dynamic bit mask according to claim 6, wherein when the query mode is any query with multiple dependencies, the service bit identifier of each target service is converted into the query bit identifier, then the target bit mask is obtained through bitwise OR operation, a dependency relationship query statement is constructed based on the target bit mask and the dependency relationship field, the corresponding dependency relationship query statement performs bitwise AND operation based on the target bit mask and the dependency relationship field of all services, and the service with bitwise AND operation result not being 0 is taken as the query result.
  10. 10. An electronic device comprising a memory and a processor, wherein the memory has stored therein a computer program, the processor being arranged to run the computer program to perform the dynamic bit mask based service dependency management method of any one of claims 1 to 5 or the dynamic bit mask based service dependency querying method of any one of claims 6 to 9.

Description

Service dependency relationship efficient management and query method based on dynamic bitmask Technical Field The application relates to the field of data, in particular to a service dependency relationship efficient management and query method based on a dynamic bit mask. Background Under the large-scale application of the service and the cloud primary architecture, the number of the services in the distributed system is increased in a bursting manner, and complex and dynamically-changed dependent networks are formed among the services through various modes such as synchronous calling, asynchronous information, data dependence and the like. For example, the order placing process of one e-commerce platform may involve collaborative invocation of tens of services such as order service, payment service, inventory service, user service, logistics service, etc., and each service may rely on basic support services such as caching service, database service, configuration center, etc. The multi-dimensional and multi-level dependency relationship network is a core for guaranteeing the complete realization of the system function, and has extremely high requirements on the management of the dependency relationship. Clearly, accurately, and efficiently managing these dependencies (e.g., knowing explicitly that "service a invoked service B, C, D") is critical to system stability assurance, fault quick localization, change impact analysis, capacity planning, and other operation and maintenance governance activities. At present, the main stream method for managing service dependency relationship in industry has the following defects: The method comprises the following steps of: The implementation mode is to create a service dependency relationship table which comprises two fields of a main service ID and a dependent service ID, wherein each pair of the dependency relationship is stored as a record, for example, a service A depends on a service B and a service C, two records (A, B and A and C) are generated in the table, and query of the dependency relationship is realized through grammars such as JOIN, IN, INTERSECT of SQL. This approach has the disadvantage of 1. Inefficient storage and I/O.A service that relies on N services produces N records, which for large systems (hundreds of thousands of services) increases in the order of O (N 2) with high I/O load for full or associative queries, taking up a lot of storage. 2. Complex query performance is poor, when multi-condition combined query such as 'query while all main services depending on a certain specific service' is needed, complex SQL JOIN and INTERSECT operations are needed, response is slow under large data volume, and real-time operation and maintenance analysis requirements are difficult to meet. 3. The maintenance cost is high, each time the dependency relation is changed (added and deleted) corresponds to the INSERT or DELETE operation of the database, and continuous pressure is caused to the database in a high-frequency release scene. The method based on the graph database comprises the following steps: The realization mode is that the service is regarded as a node, the dependency relationship is regarded as an edge, and the graph database is utilized for storage and traversal inquiry. The node attribute comprises a service ID, a service name, a state and the like, the side attribute comprises a dependency type, creation time, interaction frequency and the like, and the query of the dependency relationship is realized through a graph traversal algorithm. The method has the defects that an additional technical stack is introduced by adopting a graph traversal mode, higher operation and maintenance complexity, learning cost and migration cost are brought, and the performance and stability of the graph database are possibly inferior to those of a mature relational database scheme on high concurrency point query (such as rapid filtering according to service bit identification) of large-scale side relations. In summary, in the prior art, when managing the dependency relationship of mass services, it is difficult to achieve a good balance among storage space efficiency, complex query performance (especially multi-condition combined query), overall complexity of the system and operation and maintenance cost, so as to restrict operation and maintenance efficiency and intelligent management level of the large-scale distributed system. Disclosure of Invention The embodiment of the application provides a service dependency relationship efficient management and query method based on a dynamic bit mask, which has the advantages of high storage space efficiency, convenience for complex query and low overall complexity. In a first aspect, an embodiment of the present application provides a service dependency management method based on a dynamic bitmask, including the following steps: allocating a unique service bit identifier to each service, and recording the mapping rel