A data storage and index calculation method, device, medium and product
By storing and computing discrete data using the first TreeMap and the second TreeMap, the problems of large resource occupancy and low computing efficiency in traditional methods are solved, and efficient data storage and indicator calculation are achieved.
Patent Information
- Application Number
- CN202411978163.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-31
- Publication Date
- 2025-05-13
- Estimated Expiration
- 2044-12-31
AI Technical Summary
Traditional data storage and index calculation methods have large resource occupancy and low computing efficiency, making it difficult to effectively handle the hashing degree of data volume and interface response time in big data traffic systems.
By acquiring discrete data, the data is stored using the first TreeMap and the second TreeMap. The key value information of the first TreeMap is the index and the number of times the data appears, and the key value information of the second TreeMap is the maximum value of the index and data, and the index data is then obtained and its discrete data value is calculated.
It reduces the space consumption of data storage, reduces the amount of data calculation, improves the calculation efficiency, and can efficiently calculate the specific data values of the required data indicators.
Smart Images

Figure CN119377449B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a data storage and index calculation method, device, medium and product. Background Art
[0002] In recent years, with the rapid development of Internet technology, the amount of data has increased dramatically, which has brought tremendous pressure on data storage and data processing. For the scenario of large data traffic system, the amount of data and the degree of hashing of interface response time are unknown, but the TP value needs to be calculated. The traditional method is to store all the interface response times within a certain period of time in order from large to small. For more convenient and accurate calculation of TP value, such as TP99, the value corresponding to 99% of the total can be used as indicator data. However, this method has the problem of huge resource consumption and low calculation efficiency. Summary of the invention
[0003] One purpose of the present application is to provide a data storage and index calculation method, device, medium and product, at least to solve the problems of large resource usage and low data calculation efficiency. The present application obtains discrete data; uses the first TreeMap and the second TreeMap to store the discrete data; wherein the key value information of the first TreeMap is the index and the number of occurrences of the discrete data of the index, and the key value information of the second TreeMap is the index and the maximum value of the discrete data of the index; obtains the index data; identifies the corresponding index of the index data according to the first TreeMap, and calculates the discrete data value of the index data according to the second TreeMap. By adopting this scheme, the first TreeMap and the second TreeMap are used to store the data, and the specific data value of the required data index can be efficiently calculated based on the stored data, which reduces the space consumption caused by data storage, reduces the amount of data calculation, and improves the calculation efficiency.
[0004] To achieve the above objectives, some embodiments of the present application provide the following aspects:
[0005] In a first aspect, some embodiments of the present application further provide a method for storing data and calculating an index, including:
[0006] Get discrete data;
[0007] The discrete data is stored using a first TreeMap and a second TreeMap; wherein the key value information of the first TreeMap is the index and the number of occurrences of the discrete data of the index, and the key value information of the second TreeMap is the index and the maximum value of the discrete data of the index;
[0008] Get indicator data;
[0009] The corresponding index of the indicator data is identified according to the first TreeMap, and the discrete data value of the indicator data is calculated according to the second TreeMap.
[0010] In a second aspect, some embodiments of the present application further provide an electronic device, comprising: one or more processors; and a memory storing computer program instructions, wherein the computer program instructions, when executed, cause the processor to perform the steps of the method described above.
[0011] In a third aspect, some embodiments of the present application further provide a computer-readable medium having computer program instructions stored thereon, wherein the computer program instructions can be executed by a processor to implement the method as described above.
[0012] In a fourth aspect, some embodiments of the present application further provide a computer program product, comprising a computer program / instruction, which implements the steps of the method described above when executed by a processor.
[0013] Compared with the related art, in the solution provided by the embodiment of the present application, discrete data is obtained; the discrete data is stored using the first TreeMap and the second TreeMap; wherein the key value information of the first TreeMap is the index and the number of occurrences of the discrete data of the index, and the key value information of the second TreeMap is the index and the maximum value of the discrete data of the index; indicator data is obtained; the corresponding index of the indicator data is identified according to the first TreeMap, and the discrete data value of the indicator data is calculated according to the second TreeMap. By adopting this solution, the first TreeMap and the second TreeMap are used to store data, and the specific data values of the required data indicators can be efficiently calculated based on the stored data, which reduces the space consumption caused by data storage, reduces the amount of data calculation, and improves the calculation efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0014] One or more embodiments are exemplarily described by pictures in the corresponding drawings, and these exemplified descriptions do not constitute limitations on the embodiments. Elements with the same reference numerals in the drawings represent similar elements, and unless otherwise stated, the figures in the drawings do not constitute proportional limitations.
[0015] Figure 1 An exemplary flow chart of a data storage and index calculation method provided according to some embodiments of the present application;
[0016] Figure 2 A normal distribution diagram provided according to some embodiments of the present application;
[0017] Figure 3 A schematic diagram of the proportion of each interval under a standard normal distribution provided according to some embodiments of the present application;
[0018] Figure 4 Another schematic diagram of interval proportions under a standard normal distribution provided according to some embodiments of the present application;
[0019] Figure 5 A hash view of the index of the response time in base 2 and the number of index occurrences;
[0020] Figure 6 A hash view of the base 3 index of the response time and the number of index occurrences;
[0021] Figure 7 It is a trend chart of base size and TP indicator calculation accuracy;
[0022] Figure 8 It is a trend chart of the base size and the amount of data that can be carried;
[0023] Fig. 9 A hash view of the second TreeMap;
[0024] Fig.10 The hash view of the first TreeMap obtained by statistics;
[0025] Fig.11 The hash view of the second TreeMap obtained by statistics;
[0026] Fig.12 The hash view of the first TreeMap of the 2000 simulated interface response times;
[0027] Fig.13 The hash view of the second TreeMap for the simulated 2000 interface response times;
[0028] Fig.14 An exemplary structural diagram of the electronic device is disclosed. DETAILED DESCRIPTION
[0029] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application. Example
[0030] The first embodiment of the present application relates to a method for storing data and calculating indicators. Figure 1 As shown, the method is executed by a management tool, and the method may include the following steps:
[0031] Step S101, obtaining discrete data;
[0032] Discrete data can be any data that needs to be stored and calculated. These data are discrete, specifically, they can be some data generated during computer operation or network data transmission.
[0033] In one embodiment, the discrete data is an interface response time.
[0034] Interface response time refers to the time from when the client sends a request to when the server returns a response.
[0035] A short interface response time can make users feel that the system responds quickly and improve user satisfaction. If the response time is too long, users may feel impatient and even give up using the system. For applications with high real-time requirements, such as online games and financial transactions, response time is crucial, and too long response time may lead to serious consequences.
[0036] Interface response time is one of the important indicators for measuring system performance. By monitoring interface response time, you can understand the performance of the system under different loads, find performance bottlenecks in time and optimize them. It helps to evaluate the scalability and stability of the system. As the number of users and business volume increase, changes in response time can reflect whether the system can withstand greater pressure.
[0037] This solution adopts a new method to store and count interface response time, which can improve the storage and processing efficiency of interface response time and provide data support for a more comprehensive and detailed evaluation of interface response time.
[0038] Step S102, using the first TreeMap and the second TreeMap to store the discrete data; wherein the key value information of the first TreeMap is the index and the number of occurrences of the discrete data of the index, and the key value information of the second TreeMap is the index and the maximum value of the discrete data of the index;
[0039] This solution is to store the interface response time data in a low-cost manner, and can easily handle the calculation of interface call TP value indicators in different scenarios.
[0040] Assuming that the interface response time follows a normal distribution, the total number of calls within 5 minutes is 10W, the mean μ (average response time) is 500ms, and the standard deviation σ is 125, then Figure 2Normal distribution plot shown.
[0041] For this part of data, three solutions are used to store it, including:
[0042] Solution 1: Arrange and store all interface response times within a certain period of time in descending order.
[0043] Solution 2: Use the TreeMap data structure to store the interface response time within a certain period of time. Use the TreeMap data structure to store the interface response time within a certain period of time, with the interface response time as the key and the number of times the interface time is repeated as the value for full storage. Although this solution is an optimized version of Solution 1, for scenarios where the response time hash is too even (for example, one hundred requests, and the response times of these 100 times are 1, 2, 3...100ms respectively), the storage effect is the same as Solution 1, and there is still a risk of not being able to solve the serious resource occupation.
[0044] Solution 3: The technical solution provided in the embodiment of the present application.
[0045] Figure 3 Schematic diagram of the proportion of each interval under the standard normal distribution provided in some embodiments of the present application. Figure 3 As shown, it is assumed that the interface response time follows a normal distribution. , the total number of calls within 5 minutes is 10W, the mean μ (average response time) is 500ms, and the standard deviation σ is 125.
[0046] Figure 4 FIG. 2 is another schematic diagram of interval proportions under a standard normal distribution provided in some embodiments of the present application. Figure 4 As shown, the simulation extrapolates the number of response times in each interval:
[0047] 0~125 and 875~1000 range: 10W*0.1%*2≈200;
[0048] 125~250 and 750~875 range: 10W*2.1%*2≈4200;
[0049] 250~375 and 625~750 range: 10W*13.6%*2≈27200;
[0050] 375~500 and 500~625 intervals: 10W*34.1%*2≈68200;
[0051] The above data can be used to roughly estimate (calculated using a program to simulate random numbers) the storage data size / b of the three schemes, in bytes:
[0052] 0~125 and 875~1000 intervals, 200 response times;
[0053] The number of bytes occupied by solution 1 is ≈913b;
[0054] Solution 2 takes up ≈894 bytes;
[0055] The number of bytes occupied by this application solution is ≈90b;
[0056] 125~250 and 750~875 intervals, 4200 response times;
[0057] The number of bytes occupied by solution 1 is ≈ 21000b;
[0058] The number of bytes occupied by scheme 2 is ≈ 1997b;
[0059] The number of bytes occupied by this application solution is ≈44b;
[0060] 250~375 and 625~750 intervals, 27200 response times;
[0061] The number of bytes occupied by solution 1 is ≈ 136000b;
[0062] The number of bytes occupied by scheme 2 is ≈ 2205b;
[0063] The number of bytes occupied by this application solution is ≈50b;
[0064] 375~500 and 500~625 intervals, 68200 response times;
[0065] The number of bytes occupied by solution 1 is ≈ 341000b;
[0066] Solution 2 takes up ≈ 2250 bytes;
[0067] The number of bytes occupied by this application solution is ≈36b;
[0068] The statistical table is as follows: (the minimum value of the left interval of the LL normal distribution graph, the maximum value of the left interval of the LR normal distribution graph, the minimum value of the right interval of the RL normal distribution graph, and the maximum value of the right interval of the RR normal distribution graph)
[0069] Statistical scheme 1 result table
[0070]
[0071] Statistical Scheme 2 Result Table
[0072]
[0073] Statistics of the application results table
[0074]
[0075] Summarize the total bytes of the three schemes;
[0076] Total number of bytes for scheme 1: 913+21000+136000+341000=498913b;
[0077] Total bytes of scheme 2: 894+1997+2205+2250=7346b;
[0078] The total number of bytes of this application scheme: 90+44+50+36=220b;
[0079] Judging from the simulated normal distribution data, Solution 1 obviously has a serious problem of resource occupation. Just 100,000 interface calls require 400+kb, which is much higher than Solution 2 and the solution of this application.
[0080] This application scheme and Scheme 2 are both schemes for optimizing resource occupancy, but the resource occupancy of this application scheme is obviously more advantageous.
[0081] Although Solution 2 works well under ideal conditions, in actual scenarios, there may be more extreme scenarios. If the API call time is too sparsely hashed, the storage resources required may be less than Solution 1, or even higher.
[0082] This application designs an efficient storage and calculation method. The innovation of this application is that: the strategy for storing TP indicator data can be specified according to the frequency of interface calls in actual scenarios; and the approximate value of TP indicator can be efficiently calculated.
[0083] In terms of data storage, two TreeMaps are used to store data.
[0084] The first TreeMap, the key stores the interface response time formula The calculated "index" value, where value is the number of times the "index" value appears.
[0085] The second TreeMap, the key stores the interface response time formula The calculated "index" value, value is the maximum interface response time of the "index" value.
[0086] In this solution, specifically, the discrete data is stored using the first TreeMap and the second TreeMap, including:
[0087] Calculate the discrete data using the logarithmic value and round it down to obtain the indexes of the first TreeMap and the second TreeMap;
[0088] Accumulate each index to get the number of discrete data occurrences of each index.
[0089] For the design of the first TreeMap, the TreeMap data structure can be used for storage.
[0090] The key is The logarithmic result value of , referred to as the index.
[0091] The base x is a natural number not less than 2. The base directly affects the hash density of the actual stored data. Figure 5 A hash view of the index of the response time in base 2 and the number of index occurrences; Figure 6 A hash view of the base-3 index of the response time and the number of index occurrences.
[0092] In this solution, specifically, the method further includes:
[0093] The value of the base of the logarithm is determined based on the amount of discrete data and the calculation accuracy requirements of the indicator data.
[0094] The smaller the x value is, the smaller the amount of data that can be carried is, but the accuracy of the calculated TP index approximation is higher. Figure 7 This is a trend chart of the base size and the calculation accuracy of the TP indicator.
[0095] The larger the x value is, the larger the amount of data that can be carried is, but the accuracy of the calculated TP index approximation is relatively low. Figure 8 This is a trend chart of the base size and the amount of data that can be carried.
[0096] Note: By The calculated logarithm, or index, follows the "round down" principle. The following is an example of finding an index with base 2.
[0097] Round down: ≈2.32193=2;
[0098] ≈3.16993=3;
[0099] ≈6.16993=6;
[0100] And so on.
[0101] y: actual response time of the interface, in ms.
[0102] value is the number of times the index corresponding to the response time appears. The default value is 0 and it is accumulated as the number of times the index appears increases.
[0103] For the design of the second TreeMap:
[0104] Use TreeMap data structure for storage.
[0105] The key is the same as the concept in the first TreeMap, meaning index. The value is the maximum response time that appears in the index. Fig. 9 A hash view of the second TreeMap.
[0106] Calculate the TP value with base 2 (interface response time data generated within one minute): 1, 3, 7, 15, 29, 30, 32, 48, 56, 64, 77, 88, 99, 100, 120, 130;
[0108] Index value of 1: =0;
[0109] Index value of 3: ≈1.58496=1;
[0110] Index value of 7: ≈2.80735=2;
[0111] Index value of 15: ≈3.90689=3;
[0112] Index value of 29: ≈4.85798=4;
[0113] …
[0114] Index value of 130: ≈7.02237=7;
[0115] Fig.10 The hash view of the first TreeMap obtained by statistics is stored as: {0:1, 1:1, 2:1, 3:1, 4:2, 5:3, 6:6, 7:1};
[0116] Fig.11 The hash view of the second TreeMap obtained by statistics is stored as: {0:1, 1:3, 2:7, 3:15, 4:30, 5:56, 6:120, 7:130}.
[0117] It can be seen that this solution can greatly reduce the space for data storage through such a setting.
[0118] Step S103, obtaining indicator data;
[0119] The indicator data may be TP99, TP999, etc., wherein TP99 is the value of 99% of the discrete data from small to large in the discrete data, and TP999 is the value of 99.9% of the discrete data from small to large in the discrete data.
[0120] Step S104: identifying the corresponding index of the indicator data according to the first TreeMap, and calculating the discrete data value of the indicator data according to the second TreeMap.
[0121] In this solution, the discrete data values corresponding to the indicator data can be calculated based on the data recorded in the first TreeMap and the second TreeMap.
[0122] The solution provided in the embodiment of the present application is to obtain discrete data; use the first TreeMap and the second TreeMap to store the discrete data; wherein the key value information of the first TreeMap is the index and the number of occurrences of the discrete data of the index, and the key value information of the second TreeMap is the index and the maximum value of the discrete data of the index; obtain indicator data; identify the corresponding index of the indicator data according to the first TreeMap, and calculate the discrete data value of the indicator data according to the second TreeMap. By adopting this solution, the first TreeMap and the second TreeMap are used to store data, and the specific data values of the required data indicators can be efficiently calculated based on the stored data, which reduces the space consumption caused by data storage, reduces the amount of data calculation, and improves the calculation efficiency.
[0123] In one embodiment, optionally, identifying a corresponding index of the indicator data according to the first TreeMap includes:
[0124] Determining a target order value of the indicator data according to the quantity of the discrete data and the indicator data;
[0125] The corresponding index of the target order value is determined according to the number of occurrences of discrete data of each index in the first TreeMap.
[0126] The target order value of the indicator data may be the value of the position after being arranged from small to large. For example, among 2000 data, TP99 is the 1980th discrete data after being arranged from small to large.
[0127] After determining the target order value, the index in which the discrete data value corresponding to the indicator data is located can be determined according to the number of each index, and used as the corresponding index.
[0128] In one embodiment, optionally, calculating the discrete data value of the indicator data according to the second TreeMap includes:
[0129] Calculate the left critical value of the corresponding index of the target order value;
[0130] The discrete data value of the index data is calculated according to the left critical value and the maximum value of the discrete data of the corresponding index recorded in the second TreeMap.
[0131] After the corresponding index is determined, the discrete data value of the indicator data may be calculated according to the left critical value of the corresponding index and the maximum value of the discrete data of the corresponding index recorded in the second TreeMap.
[0132] For example, if there are 4 discrete data in the target index, the left critical value is 8, and the maximum value is 11, then the discrete data value corresponding to the indicator data can be estimated based on these two values. For example, if the indicator data is the third value in this index, then it can be determined that the discrete data value of the indicator data is 10.
[0133] In one embodiment, optionally, calculating the discrete data value of the indicator data according to the left critical value and the maximum value of the discrete data of the corresponding index recorded in the second TreeMap includes:
[0134] Assume that in the corresponding index, the discrete data are evenly distributed between the left critical value and the maximum value of the discrete data of the corresponding index;
[0135] The discrete data value of the indicator data is calculated according to the order of the indicator data in the corresponding index.
[0136] In this solution, when calculating the discrete data value, it is necessary to assume that in the corresponding index, each discrete data is evenly distributed between the left critical value and the maximum value of the discrete data of the corresponding index.
[0137] The following is an introduction to TP value calculation based on a practical scenario:
[0138] Fig.12 This is the hash view of the first TreeMap of the simulated 2000 interface response times. The data is stored as: {0:100, 1:550, 2:450, 3:600, 4:100, 5:80, 6:60, 7:45, 8:15};
[0139] Fig.13This is the hash view of the second TreeMap of the simulated 2000 interface response times. The data is stored as: {0:1, 1:3, 2:7, 3:14, 4:30, 5:62, 6:126, 7:238, 8:509}.
[0140] TP99 calculation:
[0141] Formula calculation variable definition:
[0142] Total number of calls: X, in the given example there are 2000 calls, that is, X=2000;
[0143] TP index component: B = 0.99 (TP99, B is 0.99; TP999, B is 0.999);
[0144] The position of the TP index value in the X response time: V=Math.floor(X*B); Note: Math.floor is a function that rounds down, such as: Math.floor(1.9)=1, Math.floor(21.2)=21, Math.floor(100.98)=100...;
[0145] The index value of the TP indicator value (the key value in the first TreeMap and the second TreeMap): N;
[0146] The index position of TP index value in N: P;
[0147] The number of response times of TP indicator values in N: C;
[0148] The maximum response time of the second TreeMap in N: M;
[0149] The left critical response time of the second TreeMap in N: Z= ;
[0150] The final evaluation calculates the TP indicator value: R;
[0151] Formula definition:
[0152] V = Math.floor(X*B);
[0153] Substituting into the formula, we can get V:
[0154] V=Math.floor(2000*0.99)=1980;
[0155] V = 1980;
[0156] Combination Fig.12 The first TreeMap in is available;
[0157] N=7;
[0158] R=Z+(MZ)*P / C;
[0159] Depend on Fig.12 , Fig.13 Substituting the data into the formula, we can get the variable value:
[0160] Z= = =128;
[0161] M = 238;
[0162] P = 40;
[0163] C = 45;
[0164] R=128+(238-128)*40 / 45=225.7777ms;
[0165] TP999 calculation:
[0166] Formula calculation variable definition:
[0167] Total number of calls: X, in the given example there are 2000 calls, that is, X=2000;
[0168] TP indicator component: B = 0.999 (TP99, B is 0.99; TP999, B is 0.999);
[0169] The position of the TP index value in the X response time: V=Math.floor(X*B); Note: Math.floor is a function that rounds down, such as: Math.floor(1.9)=1, Math.floor(21.2)=21, Math.floor(100.98)=100...;
[0170] Index value of TP indicator: N;
[0171] The index position of TP index value in N: P;
[0172] The number of response times of TP indicator value in N: C;
[0173] The maximum response time of the second TreeMap in N: M;
[0174] The left critical response time of the second TreeMap in N: Z= ;
[0175] TP index value: R;
[0176] Formula definition:
[0177] V = Math.floor(X*B);
[0178] Substituting into the formula, we can get V:
[0179] V=Math.floor(2000*0.999)=1998, that is, V=1998,
[0180] Combination Fig.12 The first TreeMap in
[0181] TP indicator index value: N=8;
[0182] R=Z+(MZ)*P / C;
[0183] Depend on Fig.12 , 13 Substituting the data into the formula can get the variable value;
[0184] Z= = =256;
[0185] M = 509;
[0186] P = 12;
[0187] C = 15;
[0188] R=256+(509-256)*12 / 15≈202.4ms;
[0189] This application can cope with the calculation of interface TP indicators in different pressure scenarios of different enterprises by providing a calculation formula for the TP indicator and a designed TP indicator storage structure.
[0190] This application can freely specify the base number that meets the requirements according to the enterprise's interface level, thereby minimizing the storage cost brought by TP data, and also greatly improving the calculation performance of TP indicator values.
[0191] This application can greatly improve the business personnel's ability to quickly integrate TP indicator calculations and significantly improve the development efficiency of this business.
[0192] In addition, some embodiments of the present application also provide an electronic device. The electronic device may be a digital computer in various forms, such as a laptop computer, a desktop computer, a workbench, a personal digital assistant, a server, a blade server, a mainframe computer, etc. The electronic device may also be a mobile device in various forms, such as a personal digital assistant, a cellular phone, a smart phone, a wearable device, and other similar computing devices.
[0193] The electronic device includes: one or more processors; and a memory storing computer program instructions, wherein when the computer program instructions are executed, the processor executes the steps of the method provided in any one or more of the above embodiments. Fig.14 An exemplary structural diagram of the electronic device is disclosed. Fig.14 As shown, the electronic device includes: one or more processors 1401, a memory 1402, and interfaces for connecting various components, including high-speed interfaces and low-speed interfaces. The various components are connected to each other using different buses and can be installed on a common mainboard or installed in other ways as needed. The processor can process instructions executed in the electronic device, including instructions stored in or on the memory to display graphical information of the GUI on an external input / output device (such as a display device coupled to the interface). In some other embodiments, if necessary, multiple processors and / or multiple buses can be used with multiple memories and multiple memories. Similarly, multiple electronic devices can be connected, and each device provides some necessary operations (for example, as a server array, a group of blade servers, or a multi-processor system). Among them, the components shown in this article, their connections and relationships, and their functions are only used as examples, and are not intended to limit the implementation of the present application described and / or required herein.
[0194] The electronic device may further include: an input device 1403 and an output device 1404. The processor 1401, the memory 1402, the input device 1403 and the output device 1404 may be connected via a bus or other means. Fig.14 The example of connecting through bus is taken in the following.
[0195] The input device 1403 can receive input digital or character information, and generate key signal input related to the user settings and function control of the electronic device, such as a touch screen, a keypad, a mouse, a track pad, a touch pad, an indicator rod, one or more mouse buttons, a trackball, a joystick and other input devices. The output device 1404 may include a display device, an auxiliary lighting device (e.g., LED) and a tactile feedback device (e.g., a vibration motor), etc. The display device may include, but is not limited to, a liquid crystal display (LCD), a light emitting diode (LED) display and a plasma display. In some embodiments, the display device may be a touch screen.
[0196] In order to provide interaction with the user, the electronic device may be a computer. The computer has: a display device (e.g., a cathode ray tube (CRT) or an LCD monitor) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or a trackball), through which the user can provide input to the computer. Other types of devices may also be used to provide interaction with the user; for example, the feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and the input from the user may be received in any form (including acoustic input, voice input, or tactile input).
[0197] In the embodiments of the present application, a computer program / instruction is stored on a computer-readable medium, and when the computer program / instruction is executed by a processor, the steps of the method provided by any one or more of the above embodiments are implemented. The computer-readable medium may be included in the electronic device described in the above embodiments; or it may exist independently without being assembled into the device. The above computer-readable medium carries one or more computer-readable instructions.
[0198] The memory 1402 can be used as a non-transient computer-readable storage medium, which can be used to store non-transient software programs, non-transient computer executable programs and modules. The processor 1401 executes various functional applications and data processing of the server by running the non-transient software programs, instructions and modules stored in the memory 1402, so as to implement the program instructions / modules corresponding to the method provided by any one or more of the above embodiments in the embodiments of the present application.
[0199] The memory 1402 may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function; the data storage area may store data created according to the use of the electronic device, etc. In addition, the memory 1402 may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage devices. In some embodiments, the memory 1402 may optionally include a memory remotely arranged relative to the processor 1401, and these remote memories may be connected to the electronic device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0200] It should be noted that the computer-readable medium described in the present application may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM, Erasable Programmable Read - Only Memory or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM, Compact Disc Read - Only Memory), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present application, a computer-readable medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device.
[0201] Computer readable media include permanent and non-permanent, removable and non-removable media, and can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, read-only compact disk (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape disk storage or other magnetic storage devices or any other non-transmission medium that can be used to store information that can be accessed by a computing device.
[0202] Computer program code for performing the operations of the present application may be written in one or more programming languages or a combination thereof, including object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0203] In the above embodiments, all or part of the embodiments may be implemented by software, hardware, firmware or any combination thereof. For example, an application-specific integrated circuit (ASIC), a general-purpose computer or any other similar hardware device may be used for implementation. In some embodiments, the software program of the present application may be executed by a processor to implement the above steps or functions. Similarly, the software program of the present application (including related data structures) may be stored in a computer-readable recording medium, such as a RAM memory, a magnetic or optical drive or a floppy disk and the like. In addition, some steps or functions of the present application may be implemented by hardware, for example, as a circuit that cooperates with a processor to perform various steps or functions.
[0204] The computer program product provided in the embodiment of the present application includes one or more computer programs / instructions, which, when executed by the processor, generate in whole or in part the process or function described in the embodiment of the present application. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions may be transmitted from a website site, computer, server or data center to another website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL, Digital Subscriber Line) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium may be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrated therein. The available medium may be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid state drive, SSD, solid statedisk), etc.
[0205] The flow chart or block diagram in the accompanying drawings shows the possible architecture, function and operation of the equipment, method and computer program product according to various embodiments of the present application. In this regard, each box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flow chart, and the combination of the boxes in the block diagram and / or flow chart can be implemented with a dedicated system for hardware that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0206] The scope of the present application is defined by the appended claims rather than the above description, and it is intended that all changes that fall within the meaning and scope of the equivalent elements of the claims are included in the present application. Any figure mark in the claims should not be regarded as limiting the claims involved. In addition, it is clear that the word "comprising" does not exclude other units or steps, and the singular does not exclude the plural. Multiple units or devices stated in the device claim may also be implemented by one unit or device through software or hardware. The words "first", "second", etc. are only used to distinguish the description, and do not indicate any particular order, nor can they be understood as indicating or implying relative importance.
[0207] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art can easily mention changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims, and the above embodiments should be regarded as exemplary and non-restrictive.
Claims
1. A method for storing data and calculating indicators, characterized in that: The method comprises: Get discrete data; The discrete data is stored using a first TreeMap and a second TreeMap; wherein the key value information of the first TreeMap is the index and the number of occurrences of the discrete data of the index, and the key value information of the second TreeMap is the index and the maximum value of the discrete data of the index; Get indicator data; Identify the corresponding index of the indicator data according to the first TreeMap, and calculate the discrete data value of the indicator data according to the second TreeMap, Wherein, identifying the corresponding index of the indicator data according to the first TreeMap includes: determining the target order value of the indicator data according to the number of the discrete data and the indicator data; determining the corresponding index of the target order value according to the number of occurrences of the discrete data of each index in the first TreeMap; Calculating the discrete data value of the indicator data according to the second TreeMap includes: calculating the left critical value of the corresponding index of the target order value; calculating the discrete data value of the indicator data according to the left critical value and the maximum value of the discrete data of the corresponding index recorded in the second TreeMap.
2. The method according to claim 1, characterized in that Using the first TreeMap and the second TreeMap to store the discrete data includes: Calculate the discrete data using the logarithmic value and round it down to obtain the indexes of the first TreeMap and the second TreeMap; Accumulate each index to get the number of discrete data occurrences of each index.
3. The method according to claim 2, characterized in that The method further comprises: The value of the base of the logarithm is determined based on the amount of discrete data and the calculation accuracy requirements of the indicator data.
4. The method according to claim 1, characterized in that Calculating the discrete data value of the index data according to the left critical value and the maximum value of the discrete data of the corresponding index recorded in the second TreeMap includes: Assume that in the corresponding index, the discrete data are evenly distributed between the left critical value and the maximum value of the discrete data of the corresponding index; The discrete data value of the indicator data is calculated according to the order of the indicator data in the corresponding index.
5. The method according to any one of claims 1 to 4, characterized in that: The discrete data is the interface response time.
6. An electronic device, characterized in that: The electronic device comprises: one or more processors; and A memory storing computer program instructions, which, when executed, cause the processor to perform the steps of the method as claimed in any one of claims 1 to 5.
7. A computer readable medium having a computer program / instruction stored thereon, characterized in that: When the computer program / instructions are executed by a processor, the steps of the method according to any one of claims 1 to 5 are implemented.
8. A computer program product comprising a computer program / instructions, characterized in that When the computer program / instructions are executed by a processor, the steps of the method described in any one of claims 1 to 5 are implemented.
Citation Information
Patent Citations
Lottery data processing method and device
CN116664187A
Data storage method and device, storage medium and electronic equipment
CN118069024A