Implementation Method and Device for Unique Marking of Distributed System
The sliding window algorithm and time series model combined with the Redis self-increment algorithm generate unique tags for distributed system, which solves the problem of too long ID bits in the existing technology, and realizes efficient and flexible ID generation to adapt to different business needs.
Patent Information
- Application Number
- CN202510437360.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-09
- Publication Date
- 2025-07-29
- Estimated Expiration
- 2045-04-09
AI Technical Summary
Among the unique marking methods of existing distributed systems, the number of ID bits generated by the UUID and snowflake algorithms is too long, resulting in a large amount of storage and transmission resources, and it is difficult to manage flexibly, and cannot meet efficient and flexible business needs.
The historical business data characteristics are extracted through the sliding window algorithm, combined with the time series model to predict the concurrency amount, generate business time encoding, mark encoding and sequence encoding, dynamically adjust the ID generation strategy, and use the concurrent prediction model and Redis self-increase algorithm to generate the distributed system unique mark.
It improves the efficiency and flexibility of unique tags in distributed systems, reduces storage and transmission overhead, avoids ID conflicts in high concurrency scenarios, and supports flexible adjustments in different business scenarios.
Smart Images

Figure CN119961358B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of data processing, and specifically relates to a method and device for implementing unique identifiers in a distributed system. Background Art
[0002] Currently, the mainstream unique identifiers in distributed systems are implemented through IDs generated by the Snowflake algorithm or UUID. The ID generated by the Snowflake algorithm is a 64-bit integer of the Long type, while the ID generated by UUID is a 128-bit String type. These two technologies have been widely used in software development projects and are quite mature. However, they also have certain limitations.
[0003] In some business scenarios, such a long number of digits may not be required to represent a unique identifier. Although the IDs generated by the Snowflake algorithm and UUID are unique, the excessive number of digits will occupy more resources during storage and transmission, which may become a disadvantage for some distributed systems with high performance requirements. In addition, with the development of business and the increase in data volume, how to more effectively manage these unique identifiers has also become a problem that needs to be solved.
[0004] To solve these problems, there is an urgent need for a more flexible and efficient method for implementing data unique identifiers to meet the requirements of different business scenarios. Summary of the Invention
[0005] In view of the problems in the prior art, this application provides a method and device for implementing unique identifiers in a distributed system, which can improve the usage efficiency and flexibility of unique identifiers in the distributed system.
[0006] To solve at least one of the above problems, this application provides the following technical solutions:
[0007] In a first aspect, this application provides a method for implementing unique identifiers in a distributed system, including:
[0008] Collect historical business data, perform feature extraction operations on the historical business data within a preset time step according to the sliding window algorithm, determine the corresponding time features and concurrency features, perform feature matrix and target variable construction operations according to the time features and the concurrency features, determine the corresponding historical business features, input the historical business features into a preset time series model for model training, determine the corresponding concurrency prediction model, and predict the preset business nature according to the concurrency prediction model to determine the corresponding real-time business concurrency, where the historical business data includes timestamps, business types, and concurrency.
[0009] Perform a time analysis operation on the nature of the service, determine the corresponding service time span and service time granularity, perform a time coding generation operation according to the service time span and the service time granularity, determine the corresponding service time code, perform a type quantity analysis operation on the nature of the service, number the services according to the number of service types obtained after the type quantity analysis operation, determine the corresponding service mark code, and determine the corresponding service sequence code according to the real-time service concurrency and a preset global auto-increment algorithm, where the service time code includes a time series or a timestamp;
[0010] Perform a string splicing operation according to the service time code, the service mark code, and the service sequence code to determine the corresponding unique mark of the distributed system.
[0011] Further, before performing the feature extraction operation on the historical service data within a preset time step according to the sliding window algorithm to determine the corresponding time feature and concurrency feature, it includes:
[0012] Perform a time granularity unification operation on the timestamps in the historical service data to determine the corresponding time data of the same magnitude, and perform a normalization operation on the concurrency in the historical service data to determine the corresponding unified concurrency data;
[0013] Perform a standardization operation on the historical service data according to the time data of the same magnitude and the unified concurrency data to determine the corresponding standardized historical service data.
[0014] Further, the performing the feature extraction operation on the historical service data within a preset time step according to the sliding window algorithm to determine the corresponding time feature and concurrency feature includes:
[0015] Classify and count the concurrency in the historical service data according to a preset service type, and respectively determine the service concurrency data corresponding to the service type;
[0016] Perform a feature extraction operation on the service concurrency data within a preset time step according to the sliding window algorithm to determine the corresponding time feature and concurrency feature.
[0017] Further, the performing the time coding generation operation according to the service time span and the service time granularity to determine the corresponding service time code includes:
[0018] Perform a time series generation operation according to the service time span and the service time granularity to determine the corresponding time series, and perform a timestamp conversion operation according to the time series to determine the corresponding timestamp;
[0019] Perform an encoding judgment operation based on the time series and the time stamp to determine the corresponding service time code.
[0020] Further, the performing an encoding judgment operation based on the time series and the time stamp to determine the corresponding service time code includes:
[0021] Judge whether the occupied number of bits of the time series is shorter than the occupied number of bits of the time code;
[0022] If it is shorter, determine the corresponding service time code according to the time series; if it is longer, determine the corresponding service time code according to the time stamp.
[0023] Further, the determining the corresponding service sequence code according to the real-time service concurrency and the preset global increment algorithm includes:
[0024] Determine the corresponding globally unique serial number according to the preset global increment algorithm;
[0025] Perform a remainder evaluation operation on the real-time service concurrency according to the globally unique serial number to determine the corresponding service sequence code.
[0026] Further, the performing a string concatenation operation according to the service time code, the service mark code, and the service sequence code to determine the corresponding unique mark of the distributed system includes:
[0027] Perform a string concatenation operation according to the service time code, the service mark code, and the service sequence code to determine the corresponding numeric string;
[0028] Determine the corresponding unique mark of the distributed system according to the string length, where the unique mark of the distributed system is an integer type or a long integer type.
[0029] In a second aspect, the present application provides an implementation device for a unique mark of a distributed system, including:
[0030] A concurrency prediction model construction module, configured to perform a feature extraction operation on the historical service data within a preset time step according to a sliding window algorithm to determine the corresponding time feature and concurrency feature, perform a feature matrix and target variable construction operation according to the time feature and the concurrency feature to determine the corresponding historical service feature, input the historical service feature into a preset time series model for model training to determine the corresponding concurrency prediction model, and predict a preset service property according to the concurrency prediction model to determine the corresponding real-time service concurrency, where the historical service data includes a time stamp, a service type, and a concurrency.
[0031] A service code determination module, configured to perform a time analysis operation on the service nature, determine a corresponding service time span and service time granularity, perform a time coding generation operation according to the service time span and the service time granularity, determine a corresponding service time code, perform a type quantity analysis operation on the service nature, number the services according to the service type quantity obtained after the type quantity analysis operation, determine a corresponding service mark code, and determine a corresponding service sequence code according to the real-time service concurrency and a preset global auto-increment algorithm, wherein the service time code includes a time series or a timestamp;
[0032] A unique mark generation module, configured to perform a string splicing operation according to the service time code, the service mark code, and the service sequence code, and determine a corresponding unique mark of the distributed system.
[0033] In a third aspect, the present application provides an electronic device, including a memory, a processor, and a computer program stored on the memory and executable on the processor. When the processor executes the program, the steps of the implementation method of the unique mark of the distributed system are implemented.
[0034] In a fourth aspect, the present application provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the implementation method of the unique mark of the distributed system are implemented.
[0035] In a fifth aspect, the present application provides a computer program product, including a computer program / instructions. When the computer program / instructions are executed by a processor, the steps of the implementation method of the unique mark of the distributed system are implemented.
[0036] As can be seen from the above technical solutions, the present application provides an implementation method and device for a unique mark of a distributed system. By performing a feature extraction operation on historical service data within a preset time step according to a sliding window algorithm, historical service features are obtained. The historical service features are input into a preset time series model for model training to obtain a concurrency prediction model. The service nature is predicted according to the concurrency prediction model to obtain the real-time service concurrency. The time span and service time granularity of the service nature are analyzed to generate a service time code, the type quantity of the service nature is analyzed to generate a service mark code, the service sequence code is obtained according to the real-time service concurrency and a preset global auto-increment algorithm, and a string splicing operation is performed according to the service time code, the service mark code, and the service sequence code to determine the unique mark of the distributed system, thereby improving the usage efficiency and flexibility of the unique mark of the distributed system. Description of the Drawings
[0037] To more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the accompanying drawings required for the description of the embodiments or the prior art. Obviously, the accompanying drawings in the following description are some embodiments of the present application. For those of ordinary skill in the art, without creative efforts, other accompanying drawings can also be obtained based on these drawings.
[0038] Figure 1 One of the flow diagrams of the implementation method of the unique identifier for the distributed system in the embodiments of the present application;
[0039] Figure 2 Another flow diagram of the implementation method of the unique identifier for the distributed system in the embodiments of the present application;
[0040] Figure 3 Another flow diagram of the implementation method of the unique identifier for the distributed system in the embodiments of the present application;
[0041] Figure 4 Another flow diagram of the implementation method of the unique identifier for the distributed system in the embodiments of the present application;
[0042] Figure 5 Another flow diagram of the implementation method of the unique identifier for the distributed system in the embodiments of the present application;
[0043] Figure 6 Another flow diagram of the implementation method of the unique identifier for the distributed system in the embodiments of the present application;
[0044] Figure 7 Another flow diagram of the implementation method of the unique identifier for the distributed system in the embodiments of the present application;
[0045] Figure 8 The structural diagram of the implementation device of the unique identifier for the distributed system in the embodiments of the present application;
[0046] Figure 9 The structural diagram of the electronic device in the embodiments of the present application.
[0047] Reference numerals:
[0048] Electronic device 9600, central processing unit 9100, memory 9140, communication module 9110, input unit 9120, audio processor 9130, display 9160, power supply 9170, buffer memory 9141, application / function storage unit 9142, data storage unit 9143, driver program storage unit 9144, antenna 9111, speaker 9131, microphone 9132. Detailed implementation manners
[0049] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions in the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings in the embodiments of this application. Obviously, the described embodiments are some, but not all, of the embodiments of this application. All other embodiments obtained by those of ordinary skill in the art based on the embodiments in this application without creative efforts shall fall within the scope of protection of this application.
[0050] In the technical solutions of this application, the acquisition, storage, use, processing, etc. of data all comply with the relevant provisions of national laws and regulations.
[0051] Considering the problem that the unique identifier of the current mainstream distributed system is too long in bits and will occupy more resources during storage and transmission, affecting the performance of the distributed system. This application provides a method and device for implementing a unique identifier of a distributed system. By performing feature extraction operations on historical service data within a preset time step according to the sliding window algorithm, historical service features are obtained. The historical service features are input into a preset time series model for model training to obtain a concurrency prediction model. The nature of the service is predicted according to the concurrency prediction model to obtain the real-time service concurrency. The time span and service time granularity of the service nature are analyzed to generate a service time code, the number of types of the service nature is analyzed to generate a service mark code, the service sequence code is obtained according to the real-time service concurrency and a preset global auto-increment algorithm, and a string splicing operation is performed according to the service time code, the service mark code, and the service sequence code to determine the unique identifier of the distributed system, thereby improving the usage efficiency and flexibility of the unique identifier of the distributed system.
[0052] To improve the usage efficiency and flexibility of the unique identifier of the distributed system, this application provides an embodiment of a method for implementing a unique identifier of a distributed system. Refer to Figure 1 , the method for implementing the unique identifier of the distributed system specifically includes the following content:
[0053] Step S101: Collect historical service data, perform feature extraction operations on the historical service data within a preset time step according to the sliding window algorithm to determine the corresponding time features and concurrency features, perform feature matrix and target variable construction operations according to the time features and the concurrency features to determine the corresponding historical service features, input the historical service features into a preset time series model for model training to determine the corresponding concurrency prediction model, and predict a preset service nature according to the concurrency prediction model to determine the corresponding real-time service concurrency, where the historical service data includes timestamps, service types, and concurrency.
[0054] Optionally, in this embodiment, the unique identifier of the current mainstream distributed system is implemented by the ID (unique identifier) generated by the Snowflake algorithm or UUID. However, the ID generated by UUID is a 128-bit string, while the Snowflake algorithm generates a 64-bit long integer. In some business scenarios, these IDs may be too long and consume too many distributed system resources. This implementation method generates a unique identifier by predicting the business concurrency quantity in real time through a concurrency prediction model, dynamically adjusting the serial number generation rule of the Redis auto-increment sequence, and combining time encoding, business tag encoding, and auto-increment sequence encoding.
[0055] Optionally, in this embodiment, the definition of the preposed element:
[0056] Time series: The string form of the normal time value, such as: "2024-09-30 11:15:00";
[0057] Timestamp: The integer number corresponding to the time series, divided into hour level, second level, and millisecond level;
[0058] Redis auto-increment sequence: The global persistent auto-increment sequence based on Redis, which is convenient for use in the distributed system;
[0059] Business tag field: The integer field used to mark the types of each business in the system;
[0060] Concurrency prediction model: The machine learning model based on historical concurrency data, used to predict the future concurrency volume.
[0061] Optionally, in this embodiment, this step is the process of training the concurrency prediction model and predicting the real-time concurrency volume.
[0062] Specifically, in the model training process, first, in the data preprocessing stage, collect the historical business data within the past six months from the system, including information such as timestamps, business types, and concurrency volumes, to ensure that the model can capture features such as seasonality and trends, where:
[0063] Timestamp: Record the time of each request (accurate to seconds or milliseconds).
[0064] Business type: Mark different business types (such as orders, payments, logs, etc.).
[0065] Concurrency volume: Record the number of concurrent requests at each time point.
[0066] Next, convert the timestamp to a Unix timestamp to enable the model to process time data. If the data granularity is inconsistent (some data is in seconds and some is in milliseconds), unify it to the same granularity. Normalize the concurrency volume and scale it to a fixed range (such as between 0 and 1) for better model learning. For missing values in the data, use linear interpolation or filling methods to handle them.
[0067] Secondly, in the feature extraction stage, classify the business data by type, perform one-hot encoding on all business types, classify and separately count the concurrency volume for each business type, and obtain the concurrency volume data for each business type respectively.
[0068] Extract useful time features from the timestamps of the business data. For example:
[0069] Hour: The number of hours in a day (0 - 23);
[0070] Day of the week: The day of the week (0 - 6);
[0071] Month: The number of the month in a year (1 - 12);
[0072] Is holiday: Mark whether it is a holiday.
[0073] Then, based on the sliding window technique, extract the concurrency volume of the same business type in the past period (such as the past 1 hour, the past 24 hours) as features and construct the corresponding feature matrix.
[0074] The following uses simple concurrency volume data as an example. Suppose there is the following historical concurrency data:
[0075]
[0076] Use the data of the past 5 minutes as the time step to predict the concurrency volume in the next 1 minute, and use the sliding window technique to construct the feature matrix.
[0077] Sliding window example:
[0078] Window size: 5 minutes (time step);
[0079] Sliding step: 1 minute;
[0080] Prediction target: The concurrency volume in the next 1 minute.
[0081] The first window (timestamp 00:00 - 00:04), feature matrix:
[0083] [00:00, 10, 0, 0], # Timestamp 00:00, Concurrency 10, Hours 0, Minutes 0
[0084] [00:01, 15, 0, 1], # Timestamp 00:01, Concurrency 15, Hours 0, Minutes 1
[0085] [00:02, 20, 0, 2], # Timestamp 00:02, Concurrency 20, Hours 0, Minutes 2
[0086] [00:03, 25, 0, 3], # Timestamp 00:03, Concurrency 25, Hours 0, Minutes 3
[0087] [00:04, 30, 0, 4] # Timestamp 00:04, Concurrency 30, Hours 0, Minutes 4
[0089] Target variable: 35 (Concurrency at timestamp 00:05).
[0090] Second window (timestamp 00:01 - 00:05), Feature matrix:
[0092] [00:01, 15, 0, 1], # Timestamp 00:01, Concurrency 15, Hours 0, Minutes 1
[0093] [00:02, 20, 0, 2], # Timestamp 00:02, Concurrency 20, Hours 0, Minutes 2
[0094] [00:03, 25, 0, 3], # Timestamp 00:03, Concurrency 25, Hours 0, Minutes 3
[0095] [00:04, 30, 0, 4], # Timestamp 00:04, Concurrency 30, Hours 0, Minutes 4
[0096] [00:05, 35, 0, 5] # Timestamp 00:05, Concurrency 35, Hours 0, Minutes 5
[0098] Target variable: 40 (Concurrency at timestamp 00:06)
[0099] Third window (timestamp 00:02 - 00:06), Feature matrix:
[0101] [00:02, 20, 0, 2], # Timestamp 00:02, Concurrency 20, Hour 0, Minute 2
[0102] [00:03, 25, 0, 3], # Timestamp 00:03, Concurrency 25, Hour 0, Minute 3
[0103] [00:04, 30, 0, 4], # Timestamp 00:04, Concurrency 30, Hour 0, Minute 4
[0104] [00:05, 35, 0, 5], # Timestamp 00:05, Concurrency 35, Hour 0, Minute 5
[0105] [00:06, 40, 0, 6] # Timestamp 00:06, Concurrency 40, Hour 0, Minute 6
[0107] Target variable: 45 (Concurrency at timestamp 00:07)
[0108] It can be understood that the above is a simple process of constructing a concurrent data set based on the sliding window technique. In actual operation, considering different business scenarios, the construction of the data set can be adjusted based on the understanding of the business scenario by R & D personnel. In this embodiment, through the sliding window technique, time series data is converted into a feature matrix and a target variable, and a data set suitable for model training is constructed, which can be applied to various concurrency prediction tasks.
[0109] Finally, in the model training stage, a long short-term memory network is selected to capture long-term dependencies in the time series. The constructed data set is input into the initial long short-term memory network model, which includes multiple LSTM layers and fully connected layers. The mean squared error (MSE) is used as the loss function, and Adam is used as the optimizer for training. The performance of the model is evaluated using a validation set to ensure that the model is not overfitted. A trained concurrency prediction model is obtained, and the model is integrated into a distributed system to regularly call the model for concurrency prediction.
[0110] Through the above steps, the concurrency prediction model can accurately predict future concurrency, thereby dynamically adjusting the serial number generation strategy, improving the flexibility of the system, effectively avoiding serial number conflicts in high-concurrency scenarios, and optimizing resource utilization.
[0111] Step S102: Perform a time analysis operation on the business nature to determine the corresponding business time span and business time granularity. Perform a time coding generation operation based on the business time span and the business time granularity to determine the corresponding business time code. Perform a type quantity analysis operation on the business nature, number the business according to the business type quantity obtained after the type quantity analysis operation, and determine the corresponding business mark code. Determine the corresponding business sequence code according to the real-time business concurrency and the preset global auto-increment algorithm, where the business time code includes a time series or a timestamp.
[0112] Optionally, in this embodiment, this step is the way to determine the composition structure of the unique mark.
[0113] Specifically, in this solution, the unique mark of the distributed system consists of a time code, a business mark code, and a business sequence code. The following are the meaning explanations of the three components:
[0114] Time code: Time series / timestamp, representing the time when the ID is generated, which can be a timestamp or a time series at the hour level, second level, and millisecond level.
[0115] Business mark code: Used to distinguish different business types, such as orders, users, etc.
[0116] Business sequence code: Used to ensure that the generated ID is unique under the same timestamp and business mark.
[0117] In this way, the generated ID not only ensures uniqueness but also can be flexibly adjusted in length and format according to business requirements.
[0118] The following are the generation schemes for the three components:
[0119] First, analyze the nature of the business to obtain the time span, time granularity, and concurrency situation.
[0120] The time span refers to the duration between the start time point and the end time point.
[0121] The time granularity, also called the time resolution, refers to the size of the time interval used when processing time-related data. For example, when counting data by year, year is a time granularity; when counting by quarter, quarter is the time granularity; when counting by month, day, hour, etc., month, day, and hour are also different time granularities respectively. The time granularity reflects the degree of subdivision of time, and different time granularities are suitable for different analysis scenarios and requirements.
[0122] The concurrency situation, also called the concurrency, is the number of requests sent to the server simultaneously per unit time.
[0123] Example 1: The running time is up to 2099, at the hour level, with no more than 30 concurrent requests per hour.
[0124] Example 2: The running time is up to 2099, at the second level, with no more than 10 concurrent requests per second.
[0125] Based on the above analysis of the nature of the business, optionally, time encoding generation:
[0126] Generate time encoding through time span and time granularity. Taking Example 2 as an example:
[0127] Time span: 2099, time granularity: second level.
[0128] Represented by a time series as "20991231235959"; the time stamp corresponding to this time series is 4102331039. At this time, the number of bits occupied by the time stamp is short, so the second-level time stamp is taken.
[0129] It can be understood that a shorter ID can reduce the storage and transmission overhead.
[0130] Optionally, business mark encoding generation:
[0131] Consider the types of businesses covered by this system, such as 10 or less, 100 or less, 1000 or less, etc. Taking 10 or less as an example, 1 bit (0 - 9) can be used for placeholder.
[0132] Optionally, business sequence encoding generation:
[0133] Determine the serial number of the data according to the predicted concurrent situation. Here, the serial number refers to the order in the concurrent situation. Taking the real-time concurrent data of 5 per second as a simple example, use the global auto-incrementing redis sequence to take the remainder of 5 (global is to handle data consistency in a distributed system).
[0134] For example:
[0135] Example 1: Assume the concurrency is 5 per second, that is, at most 5 orders are generated per second. Use the auto-incrementing sequence of Redis to generate a globally unique serial number. For example, if the serial number generated by Redis is 11, then take the remainder of 5, getting 1, and its business sequence encoding is 1. This ensures that the serial numbers of the 5 orders generated within one second are all unique. When the concurrent volume per second increases or decreases, take the remainder and evaluate according to the increased or decreased value to ensure the correct sequence encoding.
[0136] Example 2: Suppose there is a large social platform that needs to generate 1000 message IDs per second. Through the global auto-increment sequence of Redis, the system can generate a unique serial number (such as 1 to 1000) for each of the 1000 messages within 1 second, and take the remainder of 1000 (0 - 999) to ensure that the 1000 IDs generated within each second are unique. Even if the system is deployed on multiple distributed nodes, the global auto-increment sequence of Redis can guarantee the uniqueness of the IDs.
[0137] Through the auto-increment sequence of Redis, this solution can ensure the uniqueness of IDs in a distributed system and avoid ID conflicts even in high-concurrency scenarios.
[0138] Taking the above situation as an overall example, assume that the determined time code is the timestamp 4102331039, the determined business tag code is 1, and the determined business sequence code is 1. Then, the timestamp, business tag, and auto-increment sequence are concatenated together to form a numeric string: "410233103911". This string can be converted into a long integer as the unique ID of the order.
[0139] The IDs generated in this way not only ensure uniqueness but also can be flexibly adjusted in length and format according to business requirements. For example, if there are more business types, we can increase the number of digits of the business tag; if the time span is longer or the time granularity is finer, we can increase the number of digits of the time code. This method is more flexible than UUID and Snowflake algorithms and can better adapt to different business scenarios.
[0140] In addition, based on the introduction of the concurrency prediction model in step S101, in a specific business scenario, the system concurrency is not constant. After training the concurrency model through step S101, the model is deployed in the distributed system, and the time series prediction model is called regularly to predict the concurrency in the next period of time. According to the prediction results, the generation strategy of the serial number is dynamically adjusted.
[0141] Specifically, on the one hand, the way to utilize the concurrency prediction result is that the auto-increment sequence increased by the global auto-increment algorithm takes the remainder of the predicted concurrency value to obtain the unique ID under the current timestamp and current concurrency. Even in a distributed system, the global auto-increment algorithm first ensures the uniqueness of the auto-increment sequence within the system. Secondly, by taking the remainder for the evaluation of the concurrency of each distributed node, the uniqueness of the business sequence code of each distributed node is also ensured.
[0142] On the other hand, for the concurrency prediction results, the step size of the Redis auto-increment sequence can also be dynamically adjusted based on the predicted concurrency. For example, if a high concurrency is predicted for a certain future time period, the step size can be increased to reduce the probability of sequence number conflicts. If a low concurrency is predicted, the step size can be decreased to save resources.
[0143] Step S103: Perform a string concatenation operation based on the service time encoding, the service tag encoding, and the service sequence encoding to determine the corresponding unique tag of the distributed system.
[0144] Optionally, in this embodiment, this step is the combination process of the unique tag.
[0145] Specifically, assume that the determined time encoding is the timestamp 4102331039, the determined service tag encoding is 1, and the determined service sequence encoding is 1. Then, the timestamp, the service tag, and the auto-increment sequence are concatenated together to form a numeric string: "410233103911". This string can be converted into a long integer as the unique ID of the order.
[0146] It can be understood that in terms of resource utilization, the IDs generated by traditional UUID and Snowflake algorithms have a fixed length (128 bits for UUID and 64 bits for Snowflake algorithm), while the present solution can flexibly adjust the length of the ID according to business requirements. For example, when the business time span is short and the number of business types is small, a shorter ID can be generated to reduce the storage and transmission overhead.
[0147] In terms of ensuring the uniqueness and consistency of the ID, through the concurrency prediction model combined with the auto-increment sequence of Redis, the present solution can predict the future concurrency value, ensure that the ID is not repeated based on this concurrency within a fixed time, guarantee the uniqueness of the ID in the distributed system, and avoid the problem of multiple nodes generating duplicate IDs. Even in a high-concurrency scenario, ID conflicts can be avoided.
[0148] In terms of system management, by introducing a service tag field in the present solution, different ID prefixes can be generated for different business types, which is convenient for the system to distinguish and manage data of different businesses. At the same time, the timestamp is embedded in the ID, so the time information can be directly extracted from the ID, which is convenient for querying data according to the time range and also supports the natural sorting of data.
[0149] Through technical effects such as flexibly configuring the ID length, supporting high concurrency, distinguishing multiple business types, embedding the timestamp, ensuring distributed consistency, and efficiently generating the ID, the present solution solves the limitations of traditional UUID and Snowflake algorithms in some business scenarios. It is not only applicable to small systems but also can meet the high-concurrency and high-consistency requirements of large distributed systems.
[0150] This example demonstrates how the present embodiment flexibly adjusts the service time encoding, service tag encoding, and service sequence encoding of the unique tag according to business requirements by combining the concurrency model and the auto-increment algorithm, so as to generate a unique tag for the distributed system with high flexibility and high usage efficiency.
[0151] As can be seen from the above description, the implementation method of the unique tag for the distributed system provided by the embodiments of the present application can perform feature extraction operations on historical service data within a preset time step according to the sliding window algorithm to obtain historical service features, input the historical service features into a preset time series model for model training to obtain a concurrency prediction model, predict the business nature according to the concurrency prediction model to obtain the real-time service concurrency, analyze the time span and service time granularity of the business nature to generate the service time encoding, analyze the number of types of the business nature to generate the service tag encoding, obtain the service sequence encoding according to the real-time service concurrency and the preset global auto-increment algorithm, and perform string splicing operations according to the service time encoding, service tag encoding, and service sequence encoding to determine the unique tag for the distributed system, thereby improving the usage efficiency and flexibility of the unique tag for the distributed system.
[0152] In an embodiment of the implementation method of the unique tag for the distributed system of the present application, referring to Figure 2 , it may specifically include the following content:
[0153] Step S201: Perform a unified operation on the time granularity of the timestamps in the historical service data to determine the corresponding time data of the same magnitude, and perform a normalization operation on the concurrency in the historical service data to determine the corresponding unified concurrency data;
[0154] Step S202: Perform a standardization operation on the historical service data according to the time data of the same magnitude and the unified concurrency data to determine the corresponding standardized historical service data.
[0155] Optionally, in this embodiment, the timestamp is converted to a Unix timestamp so that the model can process time data. If the data granularities are inconsistent (some data is in seconds and some is in milliseconds), they are unified to the same granularity. The concurrency is normalized and scaled to a fixed range (such as between 0 and 1) for better model learning. For missing values in the data, linear interpolation or filling methods are used for processing.
[0156] Through step S202, this embodiment obtains the historical service data after standardization processing, laying a solid data support foundation for subsequent model training.
[0157] In an embodiment of the implementation method of the unique tag for the distributed system of the present application, referring to Figure 3 , it may specifically include the following content:
[0158] Step S301: Classify and count the concurrency in the historical service data according to the preset service type, and respectively determine the service concurrency data corresponding to the service type.
[0159] Step S302: Perform feature extraction operations on the service concurrency data within a preset time step according to the sliding window algorithm, and determine the corresponding time features and concurrency features.
[0160] Optionally, in this embodiment, this step is performed in the feature extraction stage.
[0161] Specifically, classify the service data by type, perform one-hot encoding on all service types, classify and separately count the concurrency of each service type, and respectively obtain the concurrency data of each service type.
[0162] Extract useful time features from the timestamps of the service data. For example:
[0163] Hour: The number of hours in a day (0 - 23);
[0164] Day of the week: The day of the week (0 - 6);
[0165] Month: The number of the month in a year (1 - 12);
[0166] Whether it is a holiday: Mark whether it is a holiday.
[0167] Then, based on the sliding window technology, extract the concurrency of the same service type in the past period (such as the past 1 hour, the past 24 hours) as features, and construct the corresponding feature matrix.
[0168] The following uses simple concurrency data as an example. Suppose there is the following historical concurrency data:
[0169]
[0170] Use the data in the past 5 minutes as the time step to predict the concurrency in the next 1 minute, and use the sliding window technology to construct the feature matrix.
[0171] Sliding window example:
[0172] Window size: 5 minutes (time step);
[0173] Sliding step: 1 minute;
[0174] Prediction target: The concurrency in the next 1 minute.
[0175] The first window (timestamp 00:00 - 00:04), feature matrix:
[0177] [00:00, 10, 0, 0], # Timestamp 00:00, Concurrency 10, Hours 0, Minutes 0
[0178] [00:01, 15, 0, 1], # Timestamp 00:01, Concurrency 15, Hours 0, Minutes 1
[0179] [00:02, 20, 0, 2], # Timestamp 00:02, Concurrency 20, Hours 0, Minutes 2
[0180] [00:03, 25, 0, 3], # Timestamp 00:03, Concurrency 25, Hours 0, Minutes 3
[0181] [00:04, 30, 0, 4] # Timestamp 00:04, Concurrency 30, Hours 0, Minutes 4
[0183] Target variable: 35 (Concurrency at timestamp 00:05).
[0184] Second window (timestamp 00:01 - 00:05), Feature matrix:
[0186] [00:01, 15, 0, 1], # Timestamp 00:01, Concurrency 15, Hours 0, Minutes 1
[0187] [00:02, 20, 0, 2], # Timestamp 00:02, Concurrency 20, Hours 0, Minutes 2
[0188] [00:03, 25, 0, 3], # Timestamp 00:03, Concurrency 25, Hours 0, Minutes 3
[0189] [00:04, 30, 0, 4], # Timestamp 00:04, Concurrency 30, Hours 0, Minutes 4
[0190] [00:05, 35, 0, 5] # Timestamp 00:05, Concurrency 35, Hours 0, Minutes 5
[0192] Target variable: 40 (Concurrency at timestamp 00:06)
[0193] Third window (timestamp 00:02 - 00:06), Feature matrix:
[0195] [00:02, 20, 0, 2], # Timestamp 00:02, concurrency 20, hour 0, minute 2
[0196] [00:03, 25, 0, 3], # Timestamp 00:03, concurrency 25, hour 0, minute 3
[0197] [00:04, 30, 0, 4], # Timestamp 00:04, concurrency 30, hour 0, minute 4
[0198] [00:05, 35, 0, 5], # Timestamp 00:05, concurrency 35, hour 0, minute 5
[0199] [00:06, 40, 0, 6] # Timestamp 00:06, concurrency 40, hour 0, minute 6
[0201] Target variable: 45 (concurrency at timestamp 00:07)
[0202] It can be understood that the above is a simple process of constructing a concurrent data set based on the sliding window technology. In actual operation, considering different business scenarios, the construction of the data set can be adjusted based on the understanding of the business scenario by R & D personnel. In this embodiment, through the sliding window technology, time series data is converted into a feature matrix and a target variable, and a data set suitable for model training is constructed, which can be applied to various concurrency prediction tasks.
[0203] Through step S302, this embodiment realizes feature extraction based on the sliding window, laying a solid data foundation for the subsequent training of the concurrency model.
[0204] In an embodiment of the implementation method of the unique identifier of the distributed system in this application, see Figure 4 , and it may specifically include the following content:
[0205] Step S401: Perform a time series generation operation according to the business time span and the business time granularity to determine the corresponding time series, and perform a timestamp conversion operation according to the time series to determine the corresponding timestamp;
[0206] Step S402: Perform an encoding judgment operation according to the time series and the timestamp to determine the corresponding business time encoding.
[0207] Optionally, in this embodiment, this step is a time encoding generation process.
[0208] Specifically, the time encoding includes a time series or a time stamp.
[0209] By performing a time analysis on the nature of the service, the time span and time granularity of the service are obtained. Taking "running time until 2099, second level, no more than 10 concurrent requests per second." as an example:
[0210] Time span: 2099, time granularity: second level, concurrent volume: 10 requests.
[0211] Represented by a time series, it is "20991231235959"; the time stamp corresponding to this time series is 4102331039. At this time, the number of encoding bits occupied by the time series and the number of encoding bits occupied by the time stamp are judged, and the one with the shorter encoding bits is used as the time encoding, so as to ensure that the encoding resources occupied by the time encoding are small and the storage and transmission overheads are reduced.
[0212] Through step S402, in this embodiment, the time encoding is successfully obtained by comparing the number of encoding bits of the time series and the time stamp, laying a foundation for generating a unique identifier subsequently.
[0213] In an embodiment of the method for implementing a unique identifier in the distributed system of the present application, referring to Figure 5 it may further specifically include the following content:
[0214] Step S501: Judge whether the number of bits occupied by the time series is shorter than the number of bits occupied by the time encoding;
[0215] Step S502: If it is shorter, determine the corresponding service time encoding according to the time series; if it is longer, determine the corresponding service time encoding according to the time stamp.
[0216] Optionally, in this embodiment, this step is a process of comparing the number of encoding bits of the time series and the number of encoding bits of the time stamp.
[0217] If the proportion of the number of encoding bits of the time series is short, use the time series as the time encoding;
[0218] If the proportion of the number of encoding bits of the time stamp is short, use the time stamp as the time encoding.
[0219] It can be understood that a shorter ID can reduce the storage and transmission overheads.
[0220] Through step S502, in this embodiment, the time encoding is successfully determined, laying a foundation for generating a unique identifier subsequently.
[0221] In an embodiment of the method for implementing a unique identifier in the distributed system of the present application, referring to Figure 6 it may further specifically include the following content:
[0222] Step S601: Determine the corresponding globally unique serial number according to the preset global increment algorithm;
[0223] Step S602: Perform a remainder operation on the real-time service concurrency volume according to the globally unique serial number to determine the corresponding service sequence code.
[0224] Optionally, the generation process of the service sequence code in this step is a combination of the global increment algorithm and the predicted service concurrency volume.
[0225] Specifically, the global increment algorithm Redis itself provides an increment atomic command, which can ensure the uniqueness and orderliness of the generated ID. At the same time, because it is a global increment, it can also ensure the orderliness and uniqueness of the increment when applied to a distributed system.
[0226] Specifically, the real-time service concurrency volume is the service concurrency volume predicted according to the concurrency prediction model. The concurrency prediction model can effectively predict the service concurrency volume in the future for a period of time under the current time period. Determine the serial number of the data according to the predicted concurrency situation. The serial number here refers to the order in the concurrency situation.
[0227] Illustrate with examples:
[0228] Example 1: Assume that the concurrency is 5 per second, that is, at most 5 orders are generated per second. Use the increment sequence of Redis to generate a globally unique serial number. For example, the serial number generated by Redis is 11, then take the remainder of 5, and get 1, and its service sequence code is 1. This ensures that the serial numbers of the 5 orders generated within one second are all unique. When the concurrency per second increases or decreases, take the remainder according to the increased or decreased value to ensure the correct sequence code.
[0229] Example 2: Assume there is a large social platform that needs to generate 1000 message IDs per second. Through the global increment sequence of Redis, the system can generate a unique serial number (such as 1 to 1000) for each of the 1000 messages within 1 second, and take the remainder of 1000 (0 - 999) to ensure that the 1000 IDs generated within each second are all unique. Even if the system is deployed on multiple distributed nodes, the global increment sequence of Redis can ensure the uniqueness of the ID.
[0230] Through the increment sequence of Redis, this solution can ensure the uniqueness of the ID in a distributed system, and can avoid ID conflicts even in high-concurrency scenarios.
[0231] Through step S602, this embodiment successfully generates the service sequence code based on the real-time concurrency volume and the global increment algorithm, laying a foundation for subsequent unique marking.
[0232] In an embodiment of the method for implementing the unique identifier of the distributed system in the present application, refer to Figure 7 and may specifically include the following content:
[0233] Step S701: Perform a string concatenation operation according to the service time code, the service identifier code, and the service sequence code to determine the corresponding numeric string;
[0234] Step S702: Determine the corresponding unique identifier of the distributed system according to the length of the string, where the unique identifier of the distributed system is an integer type or a long integer type.
[0235] Optionally, the time code, service identifier code, and service sequence code generated according to the above steps are concatenated into a numeric string according to the rules we agreed upon, such as: "410233103911", and then converted into the corresponding integer type or long integer type according to the length.
[0236] Among them, the integer type is used to represent integers within a certain range and occupies relatively less memory space.
[0237] The long integer type can represent a larger range of integers than the integer type and is used to process larger integers that exceed the representation range of the integer type. However, it usually occupies more memory than the integer type.
[0238] Through step S702, this embodiment successfully generates the unique identifier of the distributed system according to the time code, service identifier code, and service sequence code. On the one hand, the length of the unique identifier can be flexibly adjusted according to business requirements, improving flexibility. On the other hand, based on concurrent prediction and global auto-increment, the accuracy of the unique identifier of the distributed system is ensured. At the same time, by introducing the service identifier field and time information, it is convenient for data management, solving the limitations of traditional UUID and Snowflake algorithms in some business scenarios.
[0239] To improve the usage efficiency and flexibility of the unique identifier of the distributed system, the present application provides an embodiment of an apparatus for implementing the unique identifier of the distributed system, which implements all or part of the content of the method, refer to Figure 8 and the apparatus for implementing the unique identifier of the distributed system specifically includes the following content:
[0240] The concurrent prediction model construction module 10 is used to collect historical business data, perform feature extraction operations on the historical business data within a preset time step according to the sliding window algorithm, determine corresponding time features and concurrency volume features, perform feature matrix and target variable construction operations according to the time features and the concurrency volume features, determine corresponding historical business features, input the historical business features into a preset time series model for model training, determine a corresponding concurrent prediction model, and predict a preset business nature according to the concurrent prediction model to determine a corresponding real-time business concurrency volume. Among them, the historical business data includes a timestamp, a business type, and a concurrency volume;
[0241] The business code determination module 20 is used to perform time analysis operations on the business nature, determine corresponding business time spans and business time granularities, perform time code generation operations according to the business time spans and the business time granularities, determine corresponding business time codes, perform type quantity analysis operations on the business nature, number the business according to the number of business types obtained after the type quantity analysis operation, determine corresponding business mark codes, and determine corresponding business sequence codes according to the real-time business concurrency volume and a preset global increment algorithm. Among them, the business time code includes a time series or a timestamp;
[0242] The unique mark generation module 30 is used to perform string splicing operations according to the business time code, the business mark code, and the business sequence code to determine a corresponding unique mark for the distributed system.
[0243] As can be seen from the above description, the implementation device for the unique mark of the distributed system provided by the embodiment of the present application can perform feature extraction operations on historical business data within a preset time step according to the sliding window algorithm to obtain historical business features, input the historical business features into a preset time series model for model training to obtain a concurrent prediction model, predict the business nature according to the concurrent prediction model to obtain the real-time business concurrency volume, analyze the time span and business time granularity of the business nature to generate a business time code, analyze the number of types of the business nature to generate a business mark code, obtain a business sequence code according to the real-time business concurrency volume and a preset global increment algorithm, and perform string splicing operations according to the business time code, the business mark code, and the business sequence code to determine the unique mark of the distributed system, thereby improving the usage efficiency and flexibility of the unique mark of the distributed system.
[0244] From a hardware perspective, in order to improve the usage efficiency and flexibility of the unique mark of the distributed system, the embodiment of the present application provides an electronic device for implementing all or part of the content in the implementation method of the unique mark of the distributed system. The electronic device specifically includes the following content:
[0245] A processor, a memory, a communications interface, and a bus; wherein, the processor, the memory, and the communications interface complete communication with each other through the bus; the communications interface is used to implement information transmission between the implementation method of the unique identifier of the distributed system and related devices such as the core business system, the user terminal, and the relevant database, etc.; the logic controller can be a desktop computer, a tablet computer, a mobile terminal, etc., and this embodiment is not limited thereto. In this embodiment, the logic controller can be implemented with reference to the embodiments of the implementation method of the unique identifier of the distributed system, and the embodiments of the implementation method of the unique identifier of the distributed system, and its content is incorporated herein, and the repeated parts will not be elaborated.
[0246] It can be understood that the user terminal may include a smart phone, a tablet electronic device, a network set-top box, a portable computer, a desktop computer, a personal digital assistant (PDA), a vehicle-mounted device, a smart wearable device, etc. Among them, the smart wearable device may include smart glasses, a smart watch, a smart bracelet, etc.
[0247] In practical applications, part of the implementation method of the unique identifier of the distributed system can be executed on the electronic device side as described above, or all operations can be completed in the client device. Specifically, it can be selected according to the processing capacity of the client device and the limitations of the user usage scenario, etc. This application does not make any limitations in this regard. If all operations are completed in the client device, the client device may further include a processor.
[0248] The above-mentioned client device may have a communication module (i.e., a communication unit), and can be communicatively connected to a remote server to achieve data transmission with the server. The server may include a server on the task scheduling center side, and in other implementation scenarios, it may also include a server on an intermediate platform, such as a server on a third-party server platform communicatively linked to the task scheduling center server. The server may include a single computer device, or may include a server cluster composed of multiple servers, or a server structure of a distributed device.
[0249] Figure 9 This is a schematic block diagram of the system composition of the electronic device 9600 according to the embodiment of the present application. As Figure 9 shown, the electronic device 9600 may include a central processing unit 9100 and a memory 9140; the memory 9140 is coupled to the central processing unit 9100. It should be noted that this Figure 9 is exemplary; other types of structures can also be used to supplement or replace this structure to implement telecommunication functions or other functions.
[0250] In one embodiment, the function of the implementation method of the unique identifier of the distributed system can be integrated into the central processing unit 9100. Among them, the central processing unit 9100 can be configured to perform the following controls:
[0251] Step S101: Collect historical service data, perform feature extraction operations on the historical service data within a preset time step according to the sliding window algorithm, determine the corresponding time features and concurrency volume features, perform feature matrix and target variable construction operations according to the time features and the concurrency volume features, determine the corresponding historical service features, input the historical service features into a preset time series model for model training, determine the corresponding concurrency prediction model, and predict the preset service nature according to the concurrency prediction model to determine the corresponding real-time service concurrency volume. Among them, the historical service data includes time stamps, service types, and concurrency volumes;
[0252] Step S102: Perform time analysis operations on the service nature to determine the corresponding service time span and service time granularity, perform time encoding generation operations according to the service time span and the service time granularity to determine the corresponding service time encoding, perform type quantity analysis operations on the service nature, number the services according to the service type quantity obtained after the type quantity analysis operation to determine the corresponding service mark encoding, and determine the corresponding service sequence encoding according to the real-time service concurrency volume and the preset global auto-increment algorithm. Among them, the service time encoding includes time series or time stamps;
[0253] Step S103: Perform string concatenation operations according to the service time encoding, the service mark encoding, and the service sequence encoding to determine the unique identifier of the distributed system.
[0254] As can be seen from the above description, the electronic device provided by the embodiment of the present application obtains historical service features by performing feature extraction operations on historical service data within a preset time step according to the sliding window algorithm, inputs the historical service features into a preset time series model for model training to obtain a concurrency prediction model, predicts the service nature according to the concurrency prediction model to obtain the real-time service concurrency volume, analyzes the time span and service time granularity of the service nature to generate the service time encoding, analyzes the type quantity of the service nature to generate the service mark encoding, obtains the service sequence encoding according to the real-time service concurrency volume and the preset global auto-increment algorithm, and performs string concatenation operations according to the service time encoding, the service mark encoding, and the service sequence encoding to determine the unique identifier of the distributed system, thereby improving the usage efficiency and flexibility of the unique identifier of the distributed system.
[0255] In another embodiment, the implementation method of the unique tag of the distributed system can be separately configured from the central processing unit 9100. For example, the implementation method of the unique tag of the distributed system can be configured as a chip connected to the central processing unit 9100, and the function of the implementation method of the unique tag of the distributed system is realized through the control of the central processing unit.
[0256] As Figure 9 shown, the electronic device 9600 may further include: a communication module 9110, an input unit 9120, an audio processor 9130, a display 9160, and a power supply 9170. It should be noted that the electronic device 9600 does not necessarily have to include Figure 9 all the components shown in Figure 9 ; in addition, the electronic device 9600 may further include
[0257] As Figure 9 shown, the central processing unit 9100 is sometimes also referred to as a controller or an operation control, and may include a microprocessor or other processor devices and / or logic devices. The central processing unit 9100 receives inputs and controls the operations of the various components of the electronic device 9600.
[0258] Among them, the memory 9140 can be, for example, one or more of a buffer, a flash memory, a hard drive, a removable medium, a volatile memory, a non-volatile memory, or other suitable devices. The above information related to failures can be stored, and in addition, programs for executing relevant information can also be stored. And the central processing unit 9100 can execute the program stored in the memory 9140 to implement information storage or processing, etc.
[0259] The input unit 9120 provides inputs to the central processing unit 9100. The input unit 9120 is, for example, a key or a touch input device. The power supply 9170 is used to supply power to the electronic device 9600. The display 9160 is used to display display objects such as images and texts. The display can be, for example, an LCD display, but is not limited thereto.
[0260] The memory 9140 can be a solid-state memory. For example, a read-only memory (ROM), a random access memory (RAM), a SIM card, etc. It can also be such a memory that stores information even when powered off, can be selectively erased and has more data. Examples of such a memory are sometimes referred to as EPROMs, etc. The memory 9140 can also be some other type of device. The memory 9140 includes a buffer memory 9141 (sometimes referred to as a buffer). The memory 9140 may include an application / function storage section 9142, and the application / function storage section 9142 is used to store application programs and function programs or the processes for operating the electronic device 9600 through the central processing unit 9100.
[0261] The memory 9140 may further include a data storage unit 9143 for storing data such as contacts, digital data, pictures, sounds, and / or any other data used by the electronic device. The driver storage unit 9144 of the memory 9140 may include various drivers of the electronic device for communication functions and / or for performing other functions of the electronic device (such as a messaging application, an address book application, etc.).
[0262] The communication module 9110 is a transmitter / receiver that transmits and receives signals via the antenna 9111. The communication module 9110 is coupled to the central processor 9100 to provide input signals and receive output signals, which may be the same as in the case of a conventional mobile communication terminal.
[0263] Based on different communication technologies, multiple communication modules 9110 may be provided in the same electronic device, such as a cellular network module, a Bluetooth module, and / or a wireless local area network module, etc. The communication module 9110 is also coupled to the speaker 9131 and the microphone 9132 via the audio processor 9130 to provide an audio output via the speaker 9131 and receive an audio input from the microphone 9132, thereby implementing normal telecommunication functions. The audio processor 9130 may include any suitable buffers, decoders, amplifiers, etc. In addition, the audio processor 9130 is also coupled to the central processor 9100, so that recording can be performed on the local machine through the microphone 9132, and the sound stored on the local machine can be played through the speaker 9131.
[0264] Embodiments of the present application also provide a computer-readable storage medium capable of implementing all steps in the implementation method of the unique identifier of a distributed system where the execution subject in the above embodiments is a server or a client. A computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, all steps in the implementation method of the unique identifier of a distributed system where the execution subject in the above embodiments is a server or a client are implemented. For example, when the processor executes the computer program, the following steps are implemented:
[0265] Step S101: Collect historical service data, perform a feature extraction operation on the historical service data within a preset time step according to the sliding window algorithm, determine corresponding time features and concurrency features, perform a feature matrix and target variable construction operation according to the time features and the concurrency features, determine corresponding historical service features, input the historical service features into a preset time series model for model training, determine a corresponding concurrency prediction model, and predict a preset service property according to the concurrency prediction model to determine a corresponding real-time service concurrency, where the historical service data includes a time stamp, a service type, and a concurrency.
[0266] Step S102: Perform a time analysis operation on the business nature to determine the corresponding business time span and business time granularity. Perform a time encoding generation operation according to the business time span and the business time granularity to determine the corresponding business time encoding. Perform a type quantity analysis operation on the business nature, number the business according to the number of business types obtained after the type quantity analysis operation to determine the corresponding business mark encoding, and determine the corresponding business sequence encoding according to the real-time business concurrency and a preset global auto-increment algorithm, where the business time encoding includes a time series or a timestamp;
[0267] Step S103: Perform a string splicing operation according to the business time encoding, the business mark encoding, and the business sequence encoding to determine the corresponding unique mark of the distributed system.
[0268] As can be seen from the above description, the computer-readable storage medium provided by the embodiment of the present application extracts features from historical business data within a preset time step according to the sliding window algorithm to obtain historical business features, inputs the historical business features into a preset time series model for model training to obtain a concurrency prediction model, predicts the business nature according to the concurrency prediction model to obtain the real-time business concurrency, analyzes the time span and business time granularity of the business nature to generate a business time encoding, analyzes the number of business types of the business nature to generate a business mark encoding, obtains a business sequence encoding according to the real-time business concurrency and a preset global auto-increment algorithm, and performs a string splicing operation according to the business time encoding, the business mark encoding, and the business sequence encoding to determine the unique mark of the distributed system, thereby improving the usage efficiency and flexibility of the unique mark of the distributed system.
[0269] The embodiment of the present application further provides a computer program product capable of implementing all the steps in the method for implementing the unique mark of the distributed system whose execution subject is a server or a client in the above embodiment. When the computer program / instructions are executed by a processor, the steps of the method for implementing the unique mark of the distributed system are implemented. For example, the computer program / instructions implement the following steps:
[0270] Step S101: Collect historical business data, extract features from the historical business data within a preset time step according to the sliding window algorithm to determine the corresponding time features and concurrency features, perform a feature matrix and target variable construction operation according to the time features and the concurrency features to determine the corresponding historical business features, input the historical business features into a preset time series model for model training to determine the corresponding concurrency prediction model, and predict a preset business nature according to the concurrency prediction model to determine the corresponding real-time business concurrency, where the historical business data includes a timestamp, a business type, and a concurrency;
[0271] Step S102: Perform a time analysis operation on the service nature to determine the corresponding service time span and service time granularity. Perform a time encoding generation operation according to the service time span and the service time granularity to determine the corresponding service time encoding. Perform a type quantity analysis operation on the service nature, number the services according to the number of service types obtained after the type quantity analysis operation to determine the corresponding service mark encoding, and determine the corresponding service sequence encoding according to the real-time service concurrency and a preset global auto-increment algorithm, where the service time encoding includes a time series or a timestamp;
[0272] Step S103: Perform a string splicing operation according to the service time encoding, the service mark encoding, and the service sequence encoding to determine the unique mark of the distributed system.
[0273] As can be seen from the above description, the computer program product provided by the embodiment of the present application extracts historical service features by performing a feature extraction operation on historical service data within a preset time step according to the sliding window algorithm, inputs the historical service features into a preset time series model for model training to obtain a concurrency prediction model, predicts the service nature according to the concurrency prediction model to obtain the real-time service concurrency, analyzes the time span and service time granularity of the service nature to generate a service time encoding, analyzes the number of service types of the service nature to generate a service mark encoding, obtains a service sequence encoding according to the real-time service concurrency and a preset global auto-increment algorithm, and performs a string splicing operation according to the service time encoding, the service mark encoding, and the service sequence encoding to determine the unique mark of the distributed system, thereby improving the usage efficiency and flexibility of the unique mark of the distributed system.
[0274] Those skilled in the art should understand that the embodiments of the present invention can be provided as a method, a device, or a computer program product. Therefore, the present invention can adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present invention can adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0275] The present invention is described with reference to the flowcharts and / or block diagrams of methods, apparatuses (devices), and computer program products according to embodiments of the present invention. It should be understood that each flow and / or block in the flowcharts and / or block diagrams, as well as the combination of flows and / or blocks in the flowcharts and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to the processors of general-purpose computers, special-purpose computers, embedded processors, or other programmable data processing devices to generate a machine, such that the instructions executed by the processors of the computer or other programmable data processing devices generate means for implementing the functions specified in one flow Figure 1 one flow or multiple flows and / or blocks Figure 1 or means for implementing the functions specified in one block or multiple blocks.
[0276] These computer program instructions can also be stored in a computer-readable memory that can direct a computer or other programmable data processing device to work in a specific manner, such that the instructions stored in the computer-readable memory generate a manufactured article including instruction means that implement the functions specified in one flow Figure 1 one flow or multiple flows and / or blocks Figure 1 or means for implementing the functions specified in one block or multiple blocks.
[0277] These computer program instructions can also be loaded onto a computer or other programmable data processing device, such that a series of operation steps are executed on the computer or other programmable device to generate a computer-implemented process, so that the instructions executed on the computer or other programmable device provide steps for implementing the functions specified in one flow Figure 1 one flow or multiple flows and / or blocks Figure 1 or means for implementing the functions specified in one block or multiple blocks.
[0278] Specific embodiments are applied in the present invention to elaborate on the principles and implementation manners of the present invention. The description of the above embodiments is only used to help understand the method and its core idea of the present invention; at the same time, for those of ordinary skill in the art, according to the idea of the present invention, there will be changes in the specific implementation manners and application scopes. In summary, the content of this specification should not be construed as a limitation on the present invention.
Claims
1. A method for implementing a unique identifier of a distributed system, characterized in that, The method includes: Collecting historical business data, performing feature extraction operations on the historical business data within a preset time step according to the sliding window algorithm, determining corresponding time features and concurrency volume features, performing feature matrix and target variable construction operations according to the time features and the concurrency volume features, determining corresponding historical business features, inputting the historical business features into a preset time series model for model training, determining a corresponding concurrency prediction model, predicting a preset business nature according to the concurrency prediction model, and determining a corresponding real-time business concurrency volume, where the historical business data includes timestamps, business types, and concurrency volumes; Performing time analysis operations on the business nature, determining corresponding business time spans and business time granularities, performing time series generation operations according to the business time spans and the business time granularities, determining corresponding time series, performing timestamp conversion operations according to the time series, and determining corresponding timestamps; judging whether the occupied bits of the time series are shorter than the occupied bits of the time encoding; if so, determining a corresponding business time encoding according to the time series, if not, determining a corresponding business time encoding according to the timestamp, performing category quantity analysis operations on the business nature, numbering the business according to the number of business categories obtained after the category quantity analysis operations, determining a corresponding business mark encoding, and determining a corresponding business sequence encoding according to the real-time business concurrency volume and a preset global auto-increment algorithm, where the business time encoding includes a time series or a timestamp; Performing string splicing operations according to the business time encoding, the business mark encoding, and the business sequence encoding, and determining a corresponding unique mark for the distributed system.
2. The implementation method of the unique identifier of the distributed system according to claim 1, characterized in that Before performing the feature extraction operations on the historical business data within a preset time step according to the sliding window algorithm and determining corresponding time features and concurrency volume features, it includes: Performing time granularity unification operations on the timestamps in the historical business data, determining corresponding same-order magnitude time data, and performing normalization operations on the concurrency volumes in the historical business data, determining corresponding unified concurrency volume data; Performing standardization operations on the historical business data according to the same-order magnitude time data and the unified concurrency volume data, and determining corresponding standardized historical business data.
3. The implementation method of the unique identifier for the distributed system according to claim 1, wherein The feature extraction operations on the historical business data within a preset time step according to the sliding window algorithm and determining corresponding time features and concurrency volume features include: Classifying and counting the concurrency volumes in the historical business data according to a preset business type, and respectively determining business concurrency volume data corresponding to the business type; Performing feature extraction operations on the business concurrency volume data within a preset time step according to the sliding window algorithm, and determining corresponding time features and concurrency volume features.
4. The implementation method of the unique identifier of the distributed system according to claim 1, wherein The determining of the corresponding business sequence encoding according to the real-time business concurrency volume and the preset global auto-increment algorithm includes: Determining a corresponding globally unique serial number according to the preset global auto-increment algorithm; Perform a modulo operation on the real-time service concurrency based on the globally unique serial number to determine the corresponding service sequence code.
5. The implementation method of the unique identifier for the distributed system according to claim 1, characterized in that The string concatenation operation according to the service time code, the service marker code, and the service sequence code to determine the corresponding unique marker of the distributed system includes: Perform a string concatenation operation according to the service time code, the service marker code, and the service sequence code to determine the corresponding numeric string; Determine the corresponding unique marker of the distributed system according to the string length, where the unique marker of the distributed system is an integer type or a long integer type.
6. An implementation device for the unique marking of a distributed system, characterized in that, The device includes: A concurrent prediction model construction module, configured to collect historical service data, perform feature extraction operations on the historical service data within a preset time step according to the sliding window algorithm to determine the corresponding time features and concurrency features, perform feature matrix and target variable construction operations according to the time features and the concurrency features to determine the corresponding historical service features, input the historical service features into a preset time series model for model training to determine the corresponding concurrent prediction model, and predict the preset service nature according to the concurrent prediction model to determine the corresponding real-time service concurrency, where the historical service data includes time stamps, service types, and concurrency; A service code determination module, configured to perform a time analysis operation on the service nature to determine the corresponding service time span and service time granularity, perform a time series generation operation according to the service time span and the service time granularity to determine the corresponding time series, perform a time stamp conversion operation according to the time series to determine the corresponding time stamp; determine whether the occupied bits of the time series are shorter than the occupied bits of the time code; if so, determine the corresponding service time code according to the time series, if not, determine the corresponding service time code according to the time stamp, perform a type quantity analysis operation on the service nature, number the services according to the service type quantity obtained after the type quantity analysis operation to determine the corresponding service marker code, and determine the corresponding service sequence code according to the real-time service concurrency and a preset global increment algorithm, where the service time code includes a time series or a time stamp; A unique marker generation module, configured to perform a string concatenation operation according to the service time code, the service marker code, and the service sequence code to determine the corresponding unique marker of the distributed system.
7. An electronic device, comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the steps of the method for implementing the unique marker of the distributed system according to any one of claims 1 to 5.
8. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the steps of the method for implementing the unique marker of the distributed system according to any one of claims 1 to 5.
Citation Information
Patent Citations
Global ID (Identity) generation method and system based on business
CN107038188A
Distributed global ID generation method, device and equipment, and storage medium
CN108959386A