WO2021217916A1 - Time series data segmentation construction method and apparatus, computer device, and storage medium - Google Patents

Time series data segmentation construction method and apparatus, computer device, and storage medium Download PDF

Info

Publication number
WO2021217916A1
WO2021217916A1 PCT/CN2020/103947 CN2020103947W WO2021217916A1 WO 2021217916 A1 WO2021217916 A1 WO 2021217916A1 CN 2020103947 W CN2020103947 W CN 2020103947W WO 2021217916 A1 WO2021217916 A1 WO 2021217916A1
Authority
WO
WIPO (PCT)
Prior art keywords
data
request
data read
current
read request
Prior art date
Application number
PCT/CN2020/103947
Other languages
French (fr)
Chinese (zh)
Inventor
陆文博
Original Assignee
深圳壹账通智能科技有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 深圳壹账通智能科技有限公司 filed Critical 深圳壹账通智能科技有限公司
Publication of WO2021217916A1 publication Critical patent/WO2021217916A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5011Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals
    • G06F9/5016Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals the resource being the memory
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5011Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals
    • G06F9/5022Mechanisms to release resources
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5027Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/1001Protocols in which an application is distributed across nodes in the network for accessing one among a plurality of replicated servers
    • H04L67/1004Server selection for load balancing
    • H04L67/1008Server selection for load balancing based on parameters of servers, e.g. available memory or workload
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2209/00Indexing scheme relating to G06F9/00
    • G06F2209/50Indexing scheme relating to G06F9/50
    • G06F2209/5013Request control
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2209/00Indexing scheme relating to G06F9/00
    • G06F2209/50Indexing scheme relating to G06F9/50
    • G06F2209/5018Thread allocation

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Hardware Design (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
  • Computer And Data Communications (AREA)

Abstract

The present application relates to the field of big data. Disclosed is a time series data segmentation construction method. The method comprises: after multiple concurrent data reading requests arrive at a server, performing ascending sorting by the server according to receiving time corresponding to the data reading requests; obtaining data request volumes of the data reading requests in sequence; calculating the sum of accumulated data request volumes corresponding to the previous data reading request to obtain the current accumulated data request volume till the current accumulated data request volume exceeds the current available memory value of the server, and obtaining the currently obtained data reading requests and the total number of corresponding first requests; and then estimating memory allocation values of the current serviceable data reading requests respectively corresponding to the total number of the first requests. According to the method, when a large number of concurrent requests are received in the server, the problem that the server is unavailable due to memory overflow would not occur, and the stability of the server is improved. The present application also relates to a blockchain technology, and the data request volume is stored in the blockchain.

Description

时间序列数据分段构建方法、装置、计算机设备及存储介质Time series data segmentation construction method, device, computer equipment and storage medium
本申请要求于2020年04月28日提交中国专利局、申请号为202010351304.8,发明名称为“时间序列数据分段构建方法、装置及计算机设备”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims the priority of a Chinese patent application filed with the Chinese Patent Office on April 28, 2020, the application number is 202010351304.8, and the invention title is "time series data segmentation construction method, device and computer equipment", the entire content of which is incorporated by reference Incorporated in this application.
技术领域Technical field
本申请涉及大数据技术领域,尤其涉及一种时间序列数据分段构建方法、装置、计算机设备及存储介质。This application relates to the field of big data technology, and in particular to a method, device, computer equipment, and storage medium for constructing time series data segments.
背景技术Background technique
时间序列数据在大数据领域中十分常见,如股票的每日价格序列,房价的每日成交量、成交价,或者是服务器性能的每分钟监控数据。研究人员通过研究长期的某类时间序列数据,可以判断该类数据的长期走势或者是某种稳定性,也可以同时研究多类数据一段时间范围内的时间序列,量化其相关性,将高度相关的数据类别进行分门别类。Time series data is very common in the field of big data, such as the daily price series of stocks, the daily transaction volume and transaction price of house prices, or the monitoring data of server performance every minute. Researchers can judge the long-term trend or certain stability of this type of data by studying long-term certain type of time series data. They can also study the time series of multiple types of data over a period of time at the same time, quantify their correlation, and make highly correlated. The data categories are divided into categories.
工程实践中,数据量较大的时间序列通常保存在持久化的数据库里(例如该持久化的数据库存储在磁盘中),供客户端按需调用和读取。当客户端读取持久化的数据库中的数据时,数据的输出方向是数据库(磁盘)->服务器(内存)->网络->客户端(内存)->交互界面。In engineering practice, a time series with a large amount of data is usually stored in a persistent database (for example, the persistent database is stored in a disk) for the client to call and read on demand. When the client reads the data in the persistent database, the output direction of the data is database (disk) -> server (memory) -> network -> client (memory) -> interactive interface.
发明人发现当存在多个客户端对服务器中的大量数据进行并发请求的情况下,多个客户端发起的数据读取请求是存储在服务器中的线程池中。例如服务器中的内存大小为A1,服务器中的线程池的大小为A2(线程池所占用的空间也在服务器的内存中,即A2<A1),若此时有N1个客户端向服务器发起数据读取请求,这N1个数据读取请求几乎是同时去占用服务器的内存去并发读取数据库中的数据,若这N1个数据读取请求对服务器内存的占用空间是大于A1-A2,则会导致服务器内存溢出的性能问题,导致并发请求条件下几乎无法对客户端的数据请求进行稳定的响应。The inventor found that when there are multiple clients making concurrent requests for a large amount of data in the server, the data read requests initiated by the multiple clients are stored in the thread pool in the server. For example, the size of the memory in the server is A1, and the size of the thread pool in the server is A2 (the space occupied by the thread pool is also in the memory of the server, that is, A2<A1), if there are N1 clients sending data to the server at this time Read requests, these N1 data read requests almost simultaneously occupy the memory of the server to concurrently read the data in the database. If these N1 data read requests occupy more than A1-A2 in the server memory, it will The performance problem that caused the server's memory overflow, resulting in the condition of concurrent request is almost unable to provide a stable response to the client's data request.
发明内容Summary of the invention
本申请实施例提供了一种时间序列数据分段构建方法、装置、计算机设备及存储介质,旨在解决现有技术中存在多个客户端对服务器中的大量数据进行并发请求的情况下会导致服务器内存溢出的性能问题,且并发请求条件下几乎无法对客户端的数据请求进行稳定的响应的问题。The embodiments of the present application provide a method, device, computer equipment, and storage medium for constructing time-series data segments, which are intended to solve the problem in the prior art when multiple clients make concurrent requests for a large amount of data in a server. The performance problem of server memory overflow, and the problem that it is almost impossible to provide a stable response to the client's data request under concurrent request conditions.
第一方面,本申请实施例提供了一种时间序列数据分段构建方法,其包括:In the first aspect, an embodiment of the present application provides a method for constructing time series data segments, which includes:
判断是否检测到用户端发送的数据读取请求;Determine whether the data read request sent by the client is detected;
若检测到用户端发送的数据读取请求,将各数据读取请求对应的线程加入线程池,获取数据读取请求对应的请求总个数以及各数据读取请求对应的数据请求量;If the data read request sent by the client is detected, the thread corresponding to each data read request is added to the thread pool, and the total number of requests corresponding to the data read request and the data request amount corresponding to each data read request are obtained;
按照各数据读取请求对应的接收时间进行升序排序,按升序顺序依序获取各数据读取请求的数据请求量并求和,直至累计数据请求量超出服务器的当前可用内存值,获取当前已获取的数据读取请求以及对应的第一请求总个数;其中,所述累计数据请求量的初始值为0;Sort in ascending order according to the receiving time corresponding to each data read request, and obtain the data request amount of each data read request in ascending order and sum them until the accumulated data request amount exceeds the current available memory value of the server, and obtain the current obtained The total number of data read requests and corresponding first requests; wherein the initial value of the cumulative data request amount is 0;
将所接收到用户端的数据读取请求的组合作为当前请求集合,由当前已获取的数据读取请求组成当前可服务数据读取请求集合,将所述当前请求集合中删除当前可服务数据读取请求集合以作为当前不可服务数据读取请求集合;其中,当前不可服务数据读取请求集合包括一条或者多条当前不可服务数据读取请求,当前可服务数据读取请求集合中包括一条或者多条当前可服务数据读取请求;The combination of data read requests received from the user side is taken as the current request set, the current serviceable data read request set is composed of the currently acquired data read requests, and the current serviceable data read is deleted from the current request set The request set is taken as the current unserviceable data read request set; among them, the current unserviceable data read request set includes one or more currently unserviceable data read requests, and the current serviceable data read request set includes one or more Current serviceable data read request;
生成与各当前不可服务数据读取请求对应的服务器响应数据,发送各服务器响应数据至与各当前不可服务数据读取请求分别与对应的客户端,将各当前不可服务数据读取请求对应的线程从线程池中释放;Generate server response data corresponding to each currently unserviceable data read request, send each server response data to the corresponding client with each currently unserviceable data read request, and transfer the thread corresponding to each currently unserviceable data read request Release from the thread pool;
获取各当前可服务数据读取请求对应的数据请求量,根据预先设置的内存空间分配策略 获取各当前可服务数据读取请求对应的内存分配值;Obtain the data request amount corresponding to each current serviceable data read request, and obtain the memory allocation value corresponding to each current serviceable data read request according to the preset memory space allocation strategy;
判断是否有当前可服务数据读取请求对应的内存分配值小于当前可服务数据读取请求对应的数据请求量;以及Determine whether the memory allocation value corresponding to the current serviceable data read request is less than the data request amount corresponding to the current serviceable data read request; and
若有当前可服务数据读取请求对应的内存分配值小于当前可服务数据读取请求对应的数据请求量,根据该当前可服务数据读取请求对应的内存分配值发送对应的服务器响应数据至对应的目标用户端。If the memory allocation value corresponding to the current serviceable data read request is less than the data request amount corresponding to the current serviceable data read request, the corresponding server response data is sent to the corresponding server according to the memory allocation value corresponding to the current serviceable data read request The target client.
第二方面,本申请实施例提供了一种时间序列数据分段构建装置,其包括:In the second aspect, an embodiment of the present application provides an apparatus for constructing time series data segments, which includes:
读取请求检测单元,用于判断是否检测到用户端发送的数据读取请求;The read request detection unit is used to determine whether the data read request sent by the client is detected;
请求参数获取单元,用于若检测到用户端发送的数据读取请求,将各数据读取请求对应的线程加入线程池,获取数据读取请求对应的请求总个数以及各数据读取请求对应的数据请求量;The request parameter obtaining unit is used to add the thread corresponding to each data reading request to the thread pool if the data reading request sent by the client is detected, and obtain the total number of requests corresponding to the data reading request and the corresponding data reading request Of data requests;
请求筛选单元,用于按照各数据读取请求对应的接收时间进行升序排序,按升序顺序依序获取各数据读取请求的数据请求量并求和,直至累计数据请求量超出服务器的当前可用内存值,获取当前已获取的数据读取请求以及对应的第一请求总个数;其中,所述累计数据请求量的初始值为0;The request filtering unit is used to sort in ascending order according to the receiving time corresponding to each data read request, and obtain the data request amount of each data read request in ascending order and sum them until the accumulated data request amount exceeds the current available memory of the server Value, acquiring the total number of data read requests currently acquired and the corresponding first request; wherein, the initial value of the cumulative data request amount is 0;
集合分类单元,用于将所接收到用户端的数据读取请求的组合作为当前请求集合,由当前已获取的数据读取请求组成当前可服务数据读取请求集合,将所述当前请求集合中删除当前可服务数据读取请求集合以作为当前不可服务数据读取请求集合;其中,当前不可服务数据读取请求集合包括一条或者多条当前不可服务数据读取请求,当前可服务数据读取请求集合中包括一条或者多条当前可服务数据读取请求;The set classification unit is used to take the combination of data reading requests received from the user side as the current request set, the current serviceable data reading request set is composed of the currently obtained data reading requests, and the current request set is deleted The current serviceable data read request set is taken as the current unserviceable data read request set; wherein the current unserviceable data read request set includes one or more currently unserviceable data read requests, and the current serviceable data read request set Include one or more current serviceable data read requests;
响应数据生成单元,用于生成与各当前不可服务数据读取请求对应的服务器响应数据,发送各服务器响应数据至与各当前不可服务数据读取请求分别与对应的客户端,将各当前不可服务数据读取请求对应的线程从线程池中释放;The response data generating unit is used to generate server response data corresponding to each currently unserviceable data read request, and send each server response data to the corresponding client for each currently unserviceable data read request, and to compare each currently unserviceable data read request to the corresponding client. The thread corresponding to the data read request is released from the thread pool;
内存分配单元,用于获取各当前可服务数据读取请求对应的数据请求量,根据预先设置的内存空间分配策略获取各当前可服务数据读取请求对应的内存分配值;The memory allocation unit is used to obtain the data request amount corresponding to each current serviceable data read request, and obtain the memory allocation value corresponding to each current serviceable data read request according to a preset memory space allocation strategy;
内存判断单元,用于判断是否有当前可服务数据读取请求对应的内存分配值小于当前可服务数据读取请求对应的数据请求量;以及The memory judgment unit is used to judge whether the memory allocation value corresponding to the current serviceable data read request is less than the data request amount corresponding to the current serviceable data read request; and
第一响应数据发送单元,用于若有当前可服务数据读取请求对应的内存分配值小于当前可服务数据读取请求对应的数据请求量,根据该当前可服务数据读取请求对应的内存分配值发送对应的服务器响应数据至对应的目标用户端。The first response data sending unit is used to if the memory allocation value corresponding to the current serviceable data read request is less than the data request amount corresponding to the current serviceable data read request, according to the memory allocation corresponding to the current serviceable data read request Send the corresponding server response data to the corresponding target client.
第三方面,本申请实施例又提供了一种计算机设备,其包括存储器、处理器及存储在所述存储器上并可在所述处理器上运行的计算机程序,所述处理器执行所述计算机程序时实现上述第一方面所述的时间序列数据分段构建方法。In a third aspect, an embodiment of the present application provides a computer device, which includes a memory, a processor, and a computer program stored on the memory and running on the processor, and the processor executes the computer The program implements the time series data segmentation method described in the first aspect.
第四方面,本申请实施例还提供了一种计算机可读存储介质,其中所述计算机可读存储介质存储有计算机程序,所述计算机程序当被处理器执行时使所述处理器执行上述第一方面所述的时间序列数据分段构建方法。In a fourth aspect, an embodiment of the present application also provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the processor executes the above-mentioned first On the one hand, the time series data segmentation construction method.
本申请实施例提供了一种时间序列数据分段构建方法、装置、计算机设备及存储介质,包括判断是否检测到用户端发送的数据读取请求;若检测到用户端发送的数据读取请求,将各数据读取请求对应的线程加入线程池,获取数据读取请求对应的请求总个数以及各数据读取请求对应的数据请求量;按照各数据读取请求对应的接收时间进行升序排序,按升序顺序依序获取各数据读取请求的数据请求量并求和,直至累计数据请求量超出服务器的当前可用内存值,获取当前已获取的数据读取请求以及对应的第一请求总个数;其中,所述累计数据请求量的初始值为0;将所接收到用户端的数据读取请求的组合作为当前请求集合,由当前已获取的数据读取请求组成当前可服务数据读取请求集合,将所述当前请求集合中删除当前可服务数据读取请求集合以作为当前不可服务数据读取请求集合;其中,当前不可服务数据读取请求集合包括一条或者多条当前不可服务数据读取请求,当前可服务数据读取请求集合 中包括一条或者多条当前可服务数据读取请求;生成与各当前不可服务数据读取请求对应的服务器响应数据,发送各服务器响应数据至与各当前不可服务数据读取请求分别与对应的客户端,将各当前不可服务数据读取请求对应的线程从线程池中释放;获取各当前可服务数据读取请求对应的数据请求量,根据预先设置的内存空间分配策略获取各当前可服务数据读取请求对应的内存分配值;判断是否有当前可服务数据读取请求对应的内存分配值小于当前可服务数据读取请求对应的数据请求量;以及若有当前可服务数据读取请求对应的内存分配值小于当前可服务数据读取请求对应的数据请求量,根据该当前可服务数据读取请求对应的内存分配值发送对应的服务器响应数据至对应的目标用户端。该方法实现了当服务器中接收了大量并发请求时,服务器不会出现内存溢出导致不可用的问题,而且能稳定响应请求,提高了服务器的稳定性。The embodiments of the present application provide a method, device, computer equipment and storage medium for constructing time series data segments, including determining whether a data read request sent by a user terminal is detected; if a data read request sent by a user terminal is detected, Add the thread corresponding to each data read request to the thread pool to obtain the total number of requests corresponding to the data read request and the amount of data request corresponding to each data read request; sort in ascending order according to the receiving time corresponding to each data read request, Obtain the data request amount of each data read request in ascending order and sum them until the accumulated data request amount exceeds the current available memory value of the server, and obtain the currently acquired data read request and the total number of corresponding first requests ; Wherein, the initial value of the cumulative amount of data requests is 0; the combination of data read requests received from the client is used as the current request set, and the current serviceable data read request set is composed of the currently acquired data read requests , Delete the current serviceable data read request set from the current request set as the current unserviceable data read request set; wherein the current unserviceable data read request set includes one or more currently unserviceable data read requests , The current serviceable data read request set includes one or more current serviceable data read requests; generate server response data corresponding to each current unserviceable data read request, and send each server response data to each current unserviceable data read request The data read request is respectively with the corresponding client, and the thread corresponding to each current unserviceable data read request is released from the thread pool; the data request amount corresponding to each current serviceable data read request is obtained according to the preset memory space The allocation strategy obtains the memory allocation value corresponding to each current serviceable data read request; determines whether the memory allocation value corresponding to the current serviceable data read request is less than the data request volume corresponding to the current serviceable data read request; and if there is a current serviceable data read request, The memory allocation value corresponding to the serviceable data read request is less than the data request amount corresponding to the current serviceable data read request, and the corresponding server response data is sent to the corresponding target user according to the memory allocation value corresponding to the current serviceable data read request end. The method realizes that when a large number of concurrent requests are received in the server, the server will not have the problem of unavailability caused by memory overflow, and can respond to requests stably, which improves the stability of the server.
附图说明Description of the drawings
为了更清楚地说明本申请实施例技术方案,下面将对实施例描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to explain the technical solutions of the embodiments of the present application more clearly, the following will briefly introduce the drawings used in the description of the embodiments. Obviously, the drawings in the following description are some embodiments of the present application. Ordinary technicians can obtain other drawings based on these drawings without creative work.
图1为本申请实施例提供的时间序列数据分段构建方法的应用场景示意图;FIG. 1 is a schematic diagram of an application scenario of a method for constructing time series data segments provided by an embodiment of the application;
图2为本申请实施例提供的时间序列数据分段构建方法的流程示意图;2 is a schematic flowchart of a method for constructing time series data segments provided by an embodiment of the application;
图3为本申请实施例提供的时间序列数据分段构建装置的示意性框图;FIG. 3 is a schematic block diagram of an apparatus for constructing time series data segments according to an embodiment of the application;
图4为本申请实施例提供的计算机设备的示意性框图。Fig. 4 is a schematic block diagram of a computer device provided by an embodiment of the application.
具体实施方式Detailed ways
下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。The technical solutions in the embodiments of the present application will be described clearly and completely in conjunction with the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, rather than all of them. Based on the embodiments in this application, all other embodiments obtained by those of ordinary skill in the art without creative work shall fall within the protection scope of this application.
应当理解,当在本说明书和所附权利要求书中使用时,术语“包括”和“包含”指示所描述特征、整体、步骤、操作、元素和/或组件的存在,但并不排除一个或多个其它特征、整体、步骤、操作、元素、组件和/或其集合的存在或添加。It should be understood that when used in this specification and appended claims, the terms "including" and "including" indicate the existence of the described features, wholes, steps, operations, elements and/or components, but do not exclude one or The existence or addition of multiple other features, wholes, steps, operations, elements, components, and/or collections thereof.
还应当理解,在此本申请说明书中所使用的术语仅仅是出于描述特定实施例的目的而并不意在限制本申请。如在本申请说明书和所附权利要求书中所使用的那样,除非上下文清楚地指明其它情况,否则单数形式的“一”、“一个”及“该”意在包括复数形式。It should also be understood that the terms used in the specification of this application are only for the purpose of describing specific embodiments and are not intended to limit the application. As used in the specification of this application and the appended claims, unless the context clearly indicates other circumstances, the singular forms "a", "an" and "the" are intended to include plural forms.
还应当进一步理解,在本申请说明书和所附权利要求书中使用的术语“和/或”是指相关联列出的项中的一个或多个的任何组合以及所有可能组合,并且包括这些组合。It should be further understood that the term "and/or" used in the specification and appended claims of this application refers to any combination and all possible combinations of one or more of the associated listed items, and includes these combinations .
请参阅图1和图2,图1为本申请实施例提供的时间序列数据分段构建方法的应用场景示意图;图2为本申请实施例提供的时间序列数据分段构建方法的流程示意图,该时间序列数据分段构建方法应用于本地终端机中,该方法通过安装于本地终端机中的应用软件进行执行。Please refer to FIGS. 1 and 2. FIG. 1 is a schematic diagram of an application scenario of a method for constructing time series data segments provided by an embodiment of this application; FIG. 2 is a schematic flowchart of a method for constructing time series data segments provided by an embodiment of this application. The time series data segmentation construction method is applied to a local terminal, and the method is executed by application software installed in the local terminal.
如图2所示,该方法包括步骤S110~S180。As shown in Figure 2, the method includes steps S110 to S180.
S110、判断是否检测到用户端发送的数据读取请求。S110: Determine whether a data read request sent by the user terminal is detected.
在本实施例中,当多个用户分别通过各自的用户端向服务器发送大量数据读取请求时,服务器需根据这些数据读取请求分别进行响应,从而实现数据并发处理。In this embodiment, when multiple users send a large amount of data reading requests to the server through their respective user terminals, the server needs to respond separately according to these data reading requests, thereby realizing concurrent data processing.
S120、若检测到用户端发送的数据读取请求,将各数据读取请求对应的线程加入线程池,获取数据读取请求对应的请求总个数以及各数据读取请求对应的数据请求量。S120: If a data reading request sent by the user terminal is detected, the thread corresponding to each data reading request is added to the thread pool, and the total number of requests corresponding to the data reading request and the data request amount corresponding to each data reading request are obtained.
在本实施例中,数据库是位于服务器这一端的,数据库中的数据是在服务器中的磁盘进行存储,用户端可以与服务器端建立连接以发起数据读取请求。例如,数据库中存储了一个集合S,由N(N>0)个数据类型组成。对每一类属于S的数据类型D,对应有二元时间队列[(t0,v0),(t1,v1),..,(tm,vm)],(t0,v0)表示数据D在t0时刻值为v0。本申请是在服务器端的角度 进行技术方案的描述,即当用户端与服务器建立连接后,由用户端向服务器发起数据读取请求。当数据库接收到至少一个用户端的数据读取请求后,会解析该数据读取请求对应的请求参数。In this embodiment, the database is located on the server side, the data in the database is stored on the disk in the server, and the user side can establish a connection with the server side to initiate a data reading request. For example, a set S is stored in the database, which is composed of N (N>0) data types. For each data type D belonging to S, there is a binary time queue [(t0,v0),(t1,v1),..,(tm,vm)], (t0,v0) indicates that the data D is at t0 The time value is v0. This application describes the technical solution from the perspective of the server side, that is, after the user side establishes a connection with the server, the user side initiates a data read request to the server. After the database receives at least one data read request from the client, it will parse the request parameters corresponding to the data read request.
具体的,请求参数的格式如下:{请求次数,请求数据类型列表,数据时间范围}。例如客户端1向服务器发送的数据读取请求对应的请求参数为{1,[A B C],[20170101,20171231]},表示客户端1第一次发送请求参数并需要从服务器中读取A、B、C三种数据类型的数据且A、B、C三种数据类型的读取时间范围是2017年1月1日-2017年12月31日。在某一时间段(如2018年1月1日上午的9:00-9:01),当多个客户端均向服务器发送数据读取请求时,服务器并不是立即去磁盘中提取数据,而是依序获取数据读取请求对应的请求参数。对多个客户端的请求参数进行综合分析后,做一个数据处理量的预估,根据该数据处理量分配好针对各客户端的数据读取请求分别分配的内存空间。如果此时数据处理量的预估是超出服务器的内存大小,可能会只选定上述多个数据读取请求中的其中几个进行响应,释放掉其余未响应的数据读取请求以通知其在随机等待时间结束后再次连接服务器发送请求。Specifically, the format of the request parameters is as follows: {number of requests, list of requested data types, data time range}. For example, the request parameters corresponding to the data read request sent by client 1 to the server are {1, [A B C], [20170101, 20171231]}, which means that client 1 sends request parameters for the first time and needs to be read from the server The data of the three data types A, B, and C, and the reading time range of the three data types A, B, and C is from January 1, 2017 to December 31, 2017. In a certain period of time (such as 9:00-9:01 in the morning of January 1, 2018), when multiple clients send data read requests to the server, the server does not immediately go to the disk to fetch the data, but It is to obtain the request parameters corresponding to the data read request in sequence. After comprehensively analyzing the request parameters of multiple clients, an estimate of the data processing volume is made, and the memory space allocated for each client's data read request is allocated according to the data processing volume. If the estimated data processing volume at this time exceeds the memory size of the server, only a few of the above multiple data read requests may be selected to respond, and the remaining unresponsive data read requests are released to notify them of the After the random waiting time is over, connect to the server again to send the request.
服务器对数据处理量的预估与现有技术相比是不同的,现有的当有多个客户端请求从服务器中读取数据时,即当未超过服务器的连接上限的客户端请求由服务器接收时,服务器一般是不考虑这些客户端请求对服务器内存的总占用情况,即使这些客户端请求对服务器内存的总占用大小超出了服务器的内存大小而导致内存溢出,服务器也是会继续对客户端反馈数据,这样就会降低响应的稳定性。The server’s estimate of the amount of data processing is different from the prior art. When there are multiple clients requesting to read data from the server, the server’s connection limit is not exceeded. When receiving, the server generally does not consider the total occupancy of the server memory by these client requests. Even if the total occupancy of the server memory by these client requests exceeds the memory size of the server and the memory overflows, the server will continue to take the client's memory. Feedback data, which will reduce the stability of the response.
在一实施例中,步骤S120包括:In an embodiment, step S120 includes:
将各用户端的数据读取请求根据请求接收时间依序存储于线程池中;其中,每一数据读取请求对应启动一个线程;The data read requests of each client are sequentially stored in the thread pool according to the request receiving time; among them, each data read request starts a thread correspondingly;
根据线程池中存储的数据读取请求,解析获取数据读取请求对应的请求总个数,以及解析获取各数据读取请求对应的数据请求量;其中,所述数据请求量为数据待占用内存的空间值;所述数据读取请求中包括请求次数、请求数据类型列表、及数据时间范围。需要强调的是,为进一步保证上述数据请求量的私密和安全性,上述数据请求量还可以存储于一区块链的节点中。According to the data read request stored in the thread pool, analyze the total number of requests corresponding to the data read request, and analyze the data request amount corresponding to each data read request; wherein the data request amount is the memory to be occupied by the data The spatial value of; the data read request includes the number of requests, the list of requested data types, and the data time range. It should be emphasized that, in order to further ensure the privacy and security of the above data request amount, the above data request amount may also be stored in a node of a blockchain.
在本实施例中,当服务器此时接收到多个客户端的并发请求时,由于每一个客户端的数据读取请求被服务器接收的时间先后不同(时差很小,但是各数据读取请求并未完全同时被服务器接收的),此时可以按照先进先出的原则将各用户端的数据读取请求存储在线程池中,该线程池是占用了一定的服务器的内存的存储空间。In this embodiment, when the server receives concurrent requests from multiple clients at this time, the time when each client's data read request is received by the server is different (the time difference is small, but each data read request is not complete. Received by the server at the same time), at this time, the data read request of each client can be stored in the thread pool according to the first-in first-out principle, and the thread pool is the storage space that occupies a certain server memory.
由于各数据读取请求对应的请求参数的格式均如下:{请求次数,请求数据类型列表,数据时间范围},此时在服务器可以统计出数据读取请求对应的请求总个数,而且可以根据请求参数中请求数据类型列表和数据时间范围计算出每个数据读取请求对应的数据请求量。例如客户端1对应的请求数据类型列表对应A类数据,数据时间范围是2017年1月1日-2017年12月31日,若A类数据对应表示以日为维度的数据,则可以获知最终可查询到365条A类数据,由于每一条A类数据的数据大小是事先已知的,此时由A类数据单条数据大小*365即可得到该条数据读取请求对应的数据请求量。例如A类数据单条数据大小为1M,则客户端1对应的请求获取的A类数据的大小为365M。Since the format of the request parameters corresponding to each data read request is as follows: {number of requests, request data type list, data time range}, at this time, the server can count the total number of requests corresponding to the data read request, and it can be based on The request data type list and data time range in the request parameters calculate the data request volume corresponding to each data read request. For example, the request data type list corresponding to client 1 corresponds to type A data, and the data time range is from January 1, 2017 to December 31, 2017. If type A data corresponds to data with a day as the dimension, you can know the final 365 pieces of type A data can be queried. Since the data size of each piece of type A data is known in advance, the data request amount corresponding to the piece of data read request can be obtained from the single data size of type A data *365. For example, the size of a single piece of type A data is 1M, and the size of the type A data obtained by the request corresponding to the client 1 is 365M.
在一实施例中,所述解析获取数据读取请求对应的请求总个数,以及解析获取各数据读取请求对应的数据请求量的步骤,包括:In an embodiment, the step of analyzing and obtaining the total number of requests corresponding to the data reading request and analyzing and obtaining the data request amount corresponding to each data reading request includes:
获取预先存储的哈希表;其中,所述哈希表中存储有多种数据类别,和与多种数据类别中每一数据类别一一对应的单条数据大小值;Obtain a pre-stored hash table; wherein multiple data categories are stored in the hash table, and a single data size value corresponding to each data category of the multiple data categories one-to-one;
获取各数据读取请求分别对应的数据类别;Obtain the data category corresponding to each data read request;
在所述哈希表中查询获取各数据类别对应的单条数据大小值,以对应计算各数据读取请求对应的数据请求量。The hash table is queried to obtain the size value of a single piece of data corresponding to each data category, so as to correspondingly calculate the data request amount corresponding to each data reading request.
在本实施例中,哈希表是初始存储在服务器的磁盘中的数据库中,此时服务器的内存先 从磁盘中读取该哈希表;在该哈希表中存储有多种数据类别,如以日为维度的A类数据、以小时为维度的B类数据、以分钟为维度的C类数据等;而且每一类数据的单条数据对应的数据量大小是可以统计后求平均值而得到的。通过查询哈希表,能更准确的获取数据读取请求对应的请求总个数,以及数据请求量。In this embodiment, the hash table is initially stored in the database on the disk of the server. At this time, the memory of the server first reads the hash table from the disk; there are multiple types of data stored in the hash table. For example, type A data with the day as the dimension, type B data with the hour as the dimension, and type C data with the minute as the dimension, etc.; and the amount of data corresponding to a single piece of data of each type of data can be calculated and averaged. owned. By querying the hash table, the total number of requests corresponding to data read requests and the amount of data requests can be obtained more accurately.
例如,例如客户端1对应的请求数据类型列表对应A类数据,数据时间范围是2017年1月1日-2017年12月31日,若A类数据对应表示以日为维度的数据,A类数据单条数据大小为1M,则客户端1对应的请求获取的A类数据的大小为365M。For example, for example, the request data type list corresponding to client 1 corresponds to type A data, and the data time range is from January 1, 2017 to December 31, 2017. If type A data corresponds to data with a day as the dimension, type A The size of a single piece of data is 1M, and the size of the type A data obtained by the request corresponding to the client 1 is 365M.
S130、按照各数据读取请求对应的接收时间进行升序排序,按升序顺序依序获取各数据读取请求的数据请求量并求和,直至累计数据请求量超出服务器的当前可用内存值,获取当前已获取的数据读取请求以及对应的第一请求总个数;其中,所述累计数据请求量的初始值为0。S130. Sort in ascending order according to the receiving time corresponding to each data read request, obtain the data request amount of each data read request in ascending order and sum them, until the accumulated data request amount exceeds the current available memory value of the server, and obtain the current The total number of acquired data read requests and corresponding first requests; wherein the initial value of the cumulative data request amount is 0.
在本实施例中,服务器的线程池中的多个数据读取请求对应的线程是按照服务器接收到请求的接收时间的升序顺序排序,也即越先被服务器接收的数据读取请求对应的线程是排在线程池中越靠前的位置。In this embodiment, the threads corresponding to multiple data read requests in the thread pool of the server are sorted in ascending order of the time when the server receives the request, that is, the thread corresponding to the data read request received by the server first It is ranked higher in the thread pool.
服务器的最大允许并发查询的内存空间值记为Mmax(其中Mmax=Size*M,Size为数据库中单条数据的平均大小、M为最大并发查询的数据总条数),之前的多个历史数据读取请求对服务器已占用内存大小值为Running Data,则此时服务器的当前可用内存值记为Remain Space且Remain Space=Mmax-Running Data。The maximum allowable concurrent query memory space value of the server is recorded as Mmax (where Mmax=Size*M, Size is the average size of a single data in the database, and M is the total number of data for the largest concurrent query), and the previous multiple historical data reads Take the value of the memory size occupied by the request for the server as Running Data, then the current available memory value of the server at this time is recorded as Remain Space and Remain Space = Mmax-Running Data.
此时服务器是先按照线程池中线程进入线程池中的先后顺序依次去取出线程并同时获知了该线程对应的数据请求量,然后计算该线程的数据请求量与上一数据读取请求对应的累计数据请求量之和是否超出服务器的当前可用内存值;若未超出,则先是将该线程的数据请求量与上一数据读取请求对应的累计数据请求量求和得到的当前累计数据请求量,以当前累计数据请求量来更新累计数据请求量的最新取值,并且判断累计数据请求量是否超出服务器的当前可用内存值;若判断累计数据请求量未超出服务器的当前可用内存值,则在当前累计数据请求量的基础上继续叠加下一线程的数据请求量后再次判断更新后的当前累计数据请求量是否超出服务器的当前可用内存值,直到当前累计数据请求量超出服务器的当前可用内存值才停止上述迭代过程。At this time, the server first takes out the threads in the order in which the threads in the thread pool enter the thread pool and at the same time knows the amount of data requests corresponding to the thread, and then calculates the amount of data requests corresponding to the thread and the previous data read request. Whether the sum of accumulated data requests exceeds the current available memory value of the server; if it does not exceed, the current accumulated data request amount obtained by summing the data request amount of the thread and the accumulated data request amount corresponding to the last data read request , Update the latest value of the cumulative data request volume with the current cumulative data request volume, and determine whether the cumulative data request volume exceeds the current available memory value of the server; if it is determined that the cumulative data request volume does not exceed the current available memory value of the server, then On the basis of the current cumulative data request volume, continue to superimpose the data request volume of the next thread, and then judge again whether the updated current cumulative data request volume exceeds the current available memory value of the server until the current cumulative data request volume exceeds the current available memory value of the server Just stop the above iterative process.
此处需强调的是,当前累计数据请求量首次超出服务器的当前可用内存值才停止上述迭代过程。若从线程池中取完所有的线程并叠加求得的当前累计数据请求量仍未超出服务器的当前可用内存值,则直接针对各线程分配对应的内存空间以完成从服务器中的数据读取,数据读取的传输路径为数据库(磁盘)->服务器(内存)->网络->客户端(内存)->交互界面。由于本申请中考虑的是多个并发的数据读取请求一定会导致服务器的内存溢出的情况,这种从线程池中取完所有的线程并叠加求得的当前累计数据请求量仍未超出服务器的当前可用内存值是较小概率发生,一旦发生这种情况,按上述所说明的步骤执行即可。It should be emphasized here that the current cumulative data request volume exceeds the current available memory value of the server for the first time before stopping the above iterative process. If all threads are taken from the thread pool and the current cumulative data request amount obtained by superposition still does not exceed the current available memory value of the server, the corresponding memory space is directly allocated for each thread to complete the data reading from the server. The transmission path of data reading is database (disk) -> server (memory) -> network -> client (memory) -> interactive interface. As this application considers the situation that multiple concurrent data read requests will inevitably lead to the server's memory overflow, the current cumulative data request volume obtained by taking all threads from the thread pool and superimposing it still does not exceed the server The current available memory value of is less likely to occur. Once this happens, just follow the steps described above.
在一实施例中,步骤S130包括:In an embodiment, step S130 includes:
将累计数据请求量值的初始值置为0,将线程池中初始获被取的线程编号n的取值设置为1;Set the initial value of the cumulative data request value to 0, and set the value of the thread number n initially obtained in the thread pool to 1;
获取当前的线程池中排序号为n的线程对应的数据请求量,并获取上一数据读取请求对应的累计数据请求量;Obtain the data request amount corresponding to the thread with the sort number n in the current thread pool, and obtain the accumulated data request amount corresponding to the last data read request;
将线程池中排序号为n之后的并行线程进行阻塞;Block parallel threads in the thread pool after the sort number n;
将排序号为n的线程对应的数据请求量与上一数据读取请求对应的累计数据请求量求和,得到排序号为n的线程对应的当前累计数据请求量;Sum the data request volume corresponding to the thread with the sort number n and the cumulative data request volume corresponding to the last data read request to obtain the current cumulative data request volume corresponding to the thread with the sort number n;
以当前累计数据请求量对累计数据请求量进行更新,得到更新后的累计数据请求量;Update the cumulative data request amount with the current cumulative data request amount to obtain the updated cumulative data request amount;
判断排序号为n的线程对应的累计数据请求量是否超出服务器的当前可用内存值;Determine whether the cumulative data request volume corresponding to the thread with the sort number n exceeds the current available memory value of the server;
若排序号为n的线程对应的累计数据请求量未超出服务器的当前可用内存值,将排序号n的值加一,以得到更新后的排序号n,将线程池中所有线程解除阻塞,返回执行获取当前的 线程池中排序号为n的线程对应的数据请求量,并获取上一数据读取请求对应的累计数据请求量的步骤;If the cumulative data request volume corresponding to the thread with the sort number n does not exceed the current available memory value of the server, add one to the value of the sort number n to get the updated sort number n, unblock all threads in the thread pool, and return Perform the steps of obtaining the data request amount corresponding to the thread with the sort number n in the current thread pool, and obtaining the cumulative data request amount corresponding to the previous data read request;
若排序号为n的线程对应的当前累计数据请求量超出服务器的当前可用内存值,获取当前的排序号n以作为第一请求总个数,并获取当前已获取的数据读取请求对应的线程。If the current cumulative data request volume corresponding to the thread with the sort number n exceeds the current available memory value of the server, obtain the current sort number n as the total number of first requests, and obtain the thread corresponding to the currently acquired data read request .
在本实施例中,例如先取出线程池中排序第一的线程1,线程1的数据请求量例如为300M与上一数据读取请求对应的累计数据请求量值0M进行求和,得到当前累计数据请求量为300M,此时以当前累计数据请求量来更新累计数据请求量,以得到更新后的累计数据请求量(即300M)。In this embodiment, for example, the first thread 1 in the thread pool is taken out first, and the data request amount of thread 1 is, for example, 300M, and the cumulative data request value 0M corresponding to the previous data read request is summed to obtain the current cumulative The data request amount is 300M. At this time, the current accumulated data request amount is used to update the accumulated data request amount to obtain the updated accumulated data request amount (that is, 300M).
之后用累计数据请求量300M与服务器的当前可用内存值1G进行比较,判断结果为累计数据请求量为300M小于服务器的当前可用内存1G。此时再获取线程2的数据请求量例如为400M与上一数据读取请求对应的累计数据请求量值300M进行求和,得到当前累计数据请求量为700M,此时以当前累计数据请求量来更新累计数据请求量,以得到更新后的累计数据请求量(即700M)。After that, the cumulative data request amount of 300M is compared with the server's current available memory value of 1G, and the judgment result is that the cumulative data request amount of 300M is less than the server's current available memory 1G. At this time, the data request amount of thread 2 is obtained, for example, 400M, and the accumulated data request amount corresponding to the last data read request is 300M, and the current accumulated data request amount is 700M. At this time, the current accumulated data request amount is used as Update the cumulative data request amount to obtain the updated cumulative data request amount (ie 700M).
然后用累计数据请求量700M与服务器的当前可用内存值1G进行比较,判断结果为累计数据请求量为700M小于服务器的当前可用内存1G。此时再获取线程3的数据请求量例如为400M与上一数据读取请求对应的累计数据请求量值700M进行求和,得到当前累计数据请求量为1100M,此时以当前累计数据请求量来更新累计数据请求量,以得到更新后的累计数据请求量(即1100M)。更新后的累计数据请求量1100M是超出了服务器的当前可用内存值1G(1G=1024M),此时不再继续从线程池中继续取出下一排序位的线程。Then the accumulated data request amount of 700M is compared with the server's current available memory value of 1G, and the judgment result is that the accumulated data request amount of 700M is less than the server's current available memory 1G. At this time, the data request amount of thread 3 is obtained, for example, 400M and the accumulated data request amount corresponding to the previous data read request is 700M. The sum of the current accumulated data request amount is 1100M. At this time, the current accumulated data request amount is used as Update the cumulative data request amount to obtain the updated cumulative data request amount (that is, 1100M). The updated cumulative data request amount of 1100M exceeds the current available memory value of the server by 1G (1G=1024M). At this time, the thread with the next rank will not be taken out of the thread pool.
此时,当前已获取的数据读取请求具体为线程1对应的数据读取请求、线程2对应的数据读取请求、线程3对应的数据读取请求,且第一请求总个数为3。通过这一筛选方式,能有效避免内存溢出。At this time, the currently acquired data reading requests are specifically the data reading request corresponding to thread 1, the data reading request corresponding to thread 2, and the data reading request corresponding to thread 3, and the total number of first requests is 3. Through this screening method, memory overflow can be effectively avoided.
S140、将所接收到用户端的数据读取请求的组合作为当前请求集合,由当前已获取的数据读取请求组成当前可服务数据读取请求集合,将所述当前请求集合中删除当前可服务数据读取请求集合以作为当前不可服务数据读取请求集合;其中,当前不可服务数据读取请求集合包括一条或者多条当前不可服务数据读取请求,当前可服务数据读取请求集合中包括一条或者多条当前可服务数据读取请求。S140. Use the combination of received data read requests from the user side as the current request set, form the current serviceable data read request set from the currently acquired data read requests, and delete the current serviceable data from the current request set The read request set is taken as the current unserviceable data read request set; among them, the current unserviceable data read request set includes one or more currently unserviceable data read requests, and the current serviceable data read request set includes one or Multiple read requests for currently serviceable data.
在本实施例中,例如当前时间段(如2018年1月1日上午的9:00-9:01)加入服务器的线程池中的数据读取请求一共有10个,此时取出前3个线程计算当前累计数据请求量已经超出服务器的当前可用内存值,此时将前3个线程对应的数据读取请求组成当前可服务数据读取请求集合,将后面7个并发的线程对应的数据读取请求组成当前不可服务数据读取请求集合。In this embodiment, for example, there are a total of 10 data read requests added to the thread pool of the server in the current time period (such as 9:00-9:01 in the morning of January 1, 2018), and the first three are taken out at this time The thread calculates that the current cumulative data request volume has exceeded the current available memory value of the server. At this time, the data read requests corresponding to the first 3 threads form the current serviceable data read request set, and the data corresponding to the next 7 concurrent threads are read The fetch request constitutes the current unserviceable data read request set.
S150、生成与各当前不可服务数据读取请求对应的服务器响应数据,发送各服务器响应数据至与各当前不可服务数据读取请求分别与对应的客户端,将各当前不可服务数据读取请求对应的线程从线程池中释放。S150. Generate server response data corresponding to each current unserviceable data read request, send each server response data to the corresponding client for each current unserviceable data read request, and correspond each current unserviceable data read request The thread is released from the thread pool.
在本实施例中,例如各客户端向服务器发送的数据读取请求对应的请求参数之格式为{请求次数,请求数据类型列表,数据时间范围},则服务器根据该请求参数反馈的服务器响应数据格式为{时间序列片段,{请求次数,请求数据类型列表,数据时间范围,随机等待时间}}。其中,由于服务器此次未提供内存空间给各当前不可服务数据读取请求对应的线程来使用,此次服务器根据当前不可服务数据读取请求相应的时间序列片段为空值,随机等待时间则为服务器随机生成例如1-10秒。更具体的,随机等待时间=1秒*当前未能处理的线程数*(0到1之间的随机数),例如线程4-线程10对应的数据读取请求均是当前不可服务数据读取请求,此时将当前未能处理的线程数等于7,股根据上述公式可知服务器生产与各当前不可服务数据读取请求对应的服务器响应数据时其中的随机等待时间=7*(0到1之间的随机数)。In this embodiment, for example, the format of the request parameter corresponding to the data read request sent by each client to the server is {number of requests, request data type list, data time range}, and the server response data fed back by the server according to the request parameter The format is {time sequence fragment, {number of requests, list of requested data types, data time range, random waiting time}}. Among them, because the server did not provide memory space for the threads corresponding to each current unserviceable data read request this time, the server according to the current unserviceable data read request corresponding time series fragment is null, and the random waiting time is The server randomly generates, for example, 1-10 seconds. More specifically, the random waiting time = 1 second * the number of threads currently unprocessed * (a random number between 0 and 1), for example, the data read requests corresponding to thread 4-thread 10 are currently unserviceable data read At this time, the number of threads that cannot be processed at this time is equal to 7. According to the above formula, it can be known that when the server produces the server response data corresponding to each currently unserviceable data read request, the random waiting time=7*(between 0 and 1) Random number between).
由于此时服务器释放了各当前不可服务数据读取请求对应的线程,各当前不可服务数据读取请求对应的客户端则与服务器断开通讯连接,也就是这一随机等待时间内不会一直占用 服务器的线程池和内存资源,且客户端本地也是不用提供一定的系统资源来维持与服务器的连接,这就可以节约服务器和客户端这两端的系统资源。Because the server releases the thread corresponding to each current unserviceable data read request, the client corresponding to each current unserviceable data read request disconnects from the server, that is, this random waiting time will not be occupied forever The thread pool and memory resources of the server, and the client does not need to provide certain system resources locally to maintain the connection with the server, which can save the system resources of the server and the client.
各当前不可服务数据读取请求对应的客户端在接收到对应的服务器响应数据,可获知对应的随机等待时间,则在等待所述随机等待时间后,重新向服务器发送数据读取请求,此时此次数据读取请求对应的参数中,请求次数是在上一次的请求次数的基础上加1。The client corresponding to each current unserviceable data read request can obtain the corresponding random waiting time after receiving the corresponding server response data, and then after waiting for the random waiting time, re-send the data read request to the server. In the parameters corresponding to this data read request, the number of requests is added by 1 to the number of requests in the previous time.
S160、获取各当前可服务数据读取请求对应的数据请求量,根据预先设置的内存空间分配策略获取各当前可服务数据读取请求对应的内存分配值。S160. Obtain a data request amount corresponding to each current serviceable data read request, and obtain a memory allocation value corresponding to each current serviceable data read request according to a preset memory space allocation strategy.
在本实施例中,例如上述举例的线程1-线程3均为当前可服务数据读取请求对应的线程,此时分别获取线程1对应的数据请求量M1、线程2对应的数据请求量M2、线程3对应的数据请求量M3,由于M1+M2+M3是已经超出了服务器的当前可用内存值。此时会根据预先设置的内存空间分配策略分别对上述3个线程分别分配对应的内存分配值。In this embodiment, for example, the thread 1 to thread 3 in the above example are threads corresponding to the current serviceable data read request. At this time, the data request amount M1 corresponding to thread 1 and the data request amount M2 corresponding to thread 2 are obtained respectively. The data request amount M3 corresponding to thread 3, because M1+M2+M3 has exceeded the current available memory value of the server. At this time, the corresponding memory allocation values are allocated to the above three threads respectively according to the preset memory space allocation strategy.
在一实施例中,步骤S160包括:In an embodiment, step S160 includes:
获取各当前可服务数据读取请求对应的目标用户端,及各目标用户端对应的历史数据读取速率;Obtain the target client corresponding to each current serviceable data read request, and the historical data reading rate corresponding to each target client;
将各目标用户端对应的历史数据读取速率按照降序排序,得到各目标用户端对应的当前服务排序值;Sort the historical data reading rate corresponding to each target client in descending order to obtain the current service ranking value corresponding to each target client;
将当前服务排序值为当前最大值的目标用户端删除,将剩余的各目标用户端对应的数据请求量进行求和得到当前第一服务内存值;Delete the target client whose current service ranking value is the current maximum value, and sum the data request amount corresponding to each of the remaining target clients to obtain the current first service memory value;
若当前第一服务内存值未超出服务器的当前可用内存值,将与剩余的各目标用户端对应的内存分配值设置为对应的数据请求量;If the current memory value of the first service does not exceed the current available memory value of the server, the memory allocation value corresponding to each remaining target client is set to the corresponding data request amount;
将服务器的当前可用内存值与当前第一服务内存值求差以得到当前第一内存剩余值,将当前服务排序值为当前最大值的目标用户端对应的内存分配值设置为当前第一内存剩余值。The current available memory value of the server and the current first service memory value are calculated to obtain the current first memory remaining value, and the memory allocation value corresponding to the target client whose current service ranking value is the current maximum value is set to the current first memory remaining value value.
在本实施例中,例如线程1对应的目标用户端1,目标用户端1在服务器中历次读取数据速率的平均值记为第一历史数据读取速率(如1M/s);线程2对应的目标用户端2,目标用户端2在服务器中历次读取数据速率的平均值记为第二历史数据读取速率(如2M/s);线程3对应的目标用户端3,目标用户端3在服务器中历次读取数据速率的平均值记为第三历史数据读取速率(如3M/s)。In this embodiment, for example, the target client 1 corresponding to thread 1, the average value of the previous reading data rate of the target client 1 in the server is recorded as the first historical data reading rate (such as 1M/s); thread 2 corresponds to The target client 2 of the target client 2, the average value of the previous reading data rate of the target client 2 in the server is recorded as the second historical data reading rate (such as 2M/s); the target client 3 corresponding to the thread 3, the target client 3 The average value of the previous reading data rate in the server is recorded as the third historical data reading rate (for example, 3M/s).
由于第三历史数据读取速率大于第二历史数据读取速率,第二历史数据读取速率大于第一历史数据读取速率,此时降序排序为第三历史数据读取速率、第二历史数据读取速率、第一历史数据读取速率,目标用户端1对应的当前服务排序值为3,目标用户端2对应的当前服务排序值为2,目标用户端3对应的当前服务排序值为1。Since the reading rate of the third historical data is greater than the reading rate of the second historical data, and the reading rate of the second historical data is greater than the reading rate of the first historical data, the descending order is the third historical data reading rate and the second historical data Reading rate, the first historical data reading rate, the current service ranking value corresponding to target client 1 is 3, the current service ranking value corresponding to target client 2 is 2, and the current service ranking value corresponding to target client 3 is 1 .
由于线程1-线程3各自对应的数据请求量求和后,是首次超过服务器的当前可用内存值,有可能的原因是线程3突然急剧接近服务器的当前可用内存值,但是线程3对应的用户端3的历史数据读取速率相较于用户端1的历史数据读取速率和用户端2的历史数据读取速率,线程3对应的用户端3的历史数据读取速率为最大值。此时需要进一步核实若将线程3提供完整数据读取服务所需的内存空间后,是否还有剩余的内存空间继续为线程2和线程1提供数据读取服务,此时可以先将当前服务排序值为当前最大值的目标用户端删除,将剩余的各目标用户端对应的数据请求量进行求和得到当前第一服务内存值,该第一服务内存值在此实例中是线程3(线程3对应的目标用户端3)相应的数据请求量与线程2相应的数据请求量求和而得到。例如线程3对应的数据请求量为900M,线程2对应的数据请求量为50M,此时当前第一服务内存值为950M,其是小于服务器的当前可用内存值1G。Since the sum of the data requests corresponding to threads 1 and 3 exceeds the current available memory value of the server for the first time, the possible reason is that thread 3 suddenly approaches the current available memory value of the server sharply, but the user side corresponding to thread 3 The historical data reading rate of 3 is compared with the historical data reading rate of the user terminal 1 and the historical data reading rate of the user terminal 2, and the historical data reading rate of the user terminal 3 corresponding to the thread 3 is the maximum. At this time, it is necessary to further verify if thread 3 provides the memory space required for the complete data reading service, whether there is any remaining memory space to continue to provide data reading services for thread 2 and thread 1, at this time, the current services can be sorted first The target client whose value is the current maximum value is deleted, and the data request amount corresponding to each remaining target client is summed to obtain the current first service memory value. In this example, the first service memory value is thread 3 (thread 3). The corresponding target client 3) is obtained by summing the corresponding data request amount and the thread 2 corresponding data request amount. For example, the data request volume corresponding to thread 3 is 900M, and the data request volume corresponding to thread 2 is 50M. At this time, the current first service memory value is 950M, which is 1G less than the current available memory value of the server.
线程3对应的数据请求量为900M,线程2对应的数据请求量为50M,当前第一服务内存值为950M,其是小于服务器的当前可用内存值1G。此时对线程3分配900M的内存分配值,对线程2分配50M的内存分配值。The data request volume corresponding to thread 3 is 900M, the data request volume corresponding to thread 2 is 50M, and the current first service memory value is 950M, which is 1G less than the current available memory value of the server. At this time, a memory allocation value of 900M is allocated to thread 3, and a memory allocation value of 50M is allocated to thread 2.
通过上述方式,服务器在针对目标用户端3的数据读取请求能一次反馈全部数据,而且针对目标用户端2的数据读取请求能一次反馈全部数据,但针对目标用户端1的数据读取请 求能一次反馈部分数据(该部分数据的数据量大小为当前第一内存剩余值)。Through the above method, the server can feed back all data at one time for the data read request of the target client 3, and the data read request for the target client 2 can feed back all data at one time, but the data read request for the target client 1 Part of the data can be fed back at one time (the data size of this part of the data is the current remaining value of the first memory).
除了上述内存空间分配策略的第一具体实施例,还可以不考虑各目标用户端对应的历史数据读取速率,直接按照线程进入线程池的先后顺序来对各当前可服务数据读取请求对应的目标用户端来分配内存分配值。例如目标用户端1对应的线程1之数据请求量为300M、且线程1是第1位进入线程池的,故此时先分配取值为300M的内存分配值至目标用户端1;之后目标用户端2对应的线程2之数据请求量为50M、且线程2是第2位进入线程池的,故此时先分配取值为50M的内存分配值至目标用户端2;之后目标用户端3对应的线程3之数据请求量为900M、且线程3是第3位进入线程池的,故此时先分配取值为674M(1024M-300M-50M=674M)的内存分配值至目标用户端3。In addition to the first specific embodiment of the above-mentioned memory space allocation strategy, the historical data read rate corresponding to each target client terminal may also be ignored, and the current serviceable data read request corresponding to each current serviceable data read request can be directly determined according to the order in which the threads enter the thread pool. The target client allocates the memory allocation value. For example, the data request amount of thread 1 corresponding to target client 1 is 300M, and thread 1 is the first to enter the thread pool, so at this time, first allocate a memory allocation value of 300M to target client 1; then target client 1 2 The data request amount of thread 2 corresponding to 2 is 50M, and thread 2 enters the thread pool at the second place, so at this time, first allocate a memory allocation value of 50M to target client 2; then the thread corresponding to target client 3 The data request amount of 3 is 900M, and thread 3 enters the thread pool at the third place, so the memory allocation value of 674M (1024M-300M-50M=674M) is first allocated to the target client 3 at this time.
S170、判断是否有当前可服务数据读取请求对应的内存分配值小于当前可服务数据读取请求对应的数据请求量。S170: Determine whether the memory allocation value corresponding to the current serviceable data read request is less than the data request amount corresponding to the current serviceable data read request.
在本实施例中,判断是否有当前可服务数据读取请求对应的内存分配值小于当前可服务数据读取请求对应的数据请求量,是为了判断是否有目标用户端的数据读取请求并未完全响应,服务器此次只是提供了满足其部分需求的内存空间值以实现部分请求数据的传输。若有目标用户端的数据读取请求并未完全响应,则需执行后续的处理步骤。In this embodiment, it is judged whether the memory allocation value corresponding to the current serviceable data read request is less than the data request amount corresponding to the current serviceable data read request, in order to determine whether there is a data read request from the target client that is not complete. In response, the server only provided a memory space value that satisfies part of its requirements this time to realize the transmission of part of the requested data. If the data read request from the target client is not fully responded, the subsequent processing steps need to be performed.
S180、若有当前可服务数据读取请求对应的内存分配值小于当前可服务数据读取请求对应的数据请求量,根据该当前可服务数据读取请求对应的内存分配值发送对应的服务器响应数据至对应的目标用户端。S180. If the memory allocation value corresponding to the current serviceable data read request is less than the data request amount corresponding to the current serviceable data read request, send the corresponding server response data according to the memory allocation value corresponding to the current serviceable data read request To the corresponding target client.
在本实施例中,若有当前可服务数据读取请求对应的内存分配值小于当前可服务数据读取请求对应的数据请求量,表示有目标用户端的数据读取请求并未完全响应,服务器此次只是提供了满足其部分需求的内存空间值以实现部分请求数据的传输。In this embodiment, if the memory allocation value corresponding to the current serviceable data read request is less than the data request amount corresponding to the current serviceable data read request, it means that the data read request from the target client has not fully responded, and the server is here It only provides the memory space value that meets part of its requirements to realize the transmission of part of the requested data.
服务器根据目标用户端的数据读取请求反馈的服务器响应数据格式为{时间序列片段,{请求次数,请求数据类型列表,数据时间范围,随机等待时间}},其中,由于服务器此次未提供足够的内存空间给目标用户端对应的线程来使用,此次时间序列片段不为空值,随机等待时间则为服务器随机生成例如1-10秒。The server response data format returned by the server according to the target client’s data read request is {time series fragment, {request times, request data type list, data time range, random waiting time}}, where the server did not provide enough The memory space is used by the thread corresponding to the target client. This time series fragment is not a null value, and the random waiting time is randomly generated by the server, for example, 1-10 seconds.
例如目标用户端3对应的线程3之数据请求量为900M、且线程3是第3位进入线程池的,服务器对其设置674M的内存分配值后,初次反馈的时间序列片段的大小为674M。而且目标用户端3在等待随机等待时间之后再次发出数据读取请求,直至成功获取到剩余的226M数据。目标用户端3在分批接收到了总共900M的反馈数据后,在本地进行时间序列片段的拼接,即可渲染到目标用户端3的用户界面上进行显示。For example, the data request volume of thread 3 corresponding to target client 3 is 900M, and thread 3 enters the thread pool at the third place. After the server sets a memory allocation value of 674M for it, the size of the first time series segment feedback is 674M. Furthermore, the target client 3 sends a data read request again after waiting for a random waiting time, until the remaining 226M data is successfully obtained. After the target client 3 receives a total of 900M feedback data in batches, the time-series fragments are spliced locally, which can then be rendered to the user interface of the target client 3 for display.
在一实施例中,步骤S170之后还包括:In an embodiment, after step S170, the method further includes:
若有当前可服务数据读取请求对应的内存分配值等于当前可服务数据读取请求对应的数据请求量,根据该当前可服务数据读取请求对应的内存分配值发送对应的服务器响应数据至对应的目标用户端。If the memory allocation value corresponding to the current serviceable data read request is equal to the data request amount corresponding to the current serviceable data read request, the corresponding server response data is sent to the corresponding server according to the memory allocation value corresponding to the current serviceable data read request The target client.
在本实施例中,有目标用户端的数据读取请求已完全响应,服务器此次提供了满足其全部需求的内存空间值以实现全部请求数据的传输,服务器根据目标用户端的数据读取请求反馈的服务器响应数据格式为{时间序列片段,{请求次数,请求数据类型列表,数据时间范围,随机等待时间}}。其中,由于服务器此次已提供足够的内存空间给目标用户端对应的线程来使用,此次时间序列片段不为空值,随机等待时间则为空值(表示不用等待随机等待时间后再次请求服务器)。In this embodiment, a data read request from the target client has been fully responded, and the server provides a memory space value that meets all its requirements this time to realize the transmission of all requested data. The server responds according to the data read request from the target client. The server response data format is {time sequence fragment, {request times, request data type list, data time range, random waiting time}}. Among them, because the server has provided enough memory space for the thread corresponding to the target client to use this time, the time series fragment is not a null value, and the random waiting time is a null value (indicating that there is no need to wait for the random waiting time and then request the server again ).
在一实施例中,所述若有当前可服务数据读取请求对应的内存分配值等于当前可服务数据读取请求对应的数据请求量,根据该当前可服务数据读取请求对应的内存分配值发送对应的服务器响应数据至对应的目标用户端之后,还包括:In one embodiment, if the memory allocation value corresponding to the current serviceable data read request is equal to the data request amount corresponding to the current serviceable data read request, according to the memory allocation value corresponding to the current serviceable data read request After sending the corresponding server response data to the corresponding target client, it also includes:
若检测到已将服务器响应数据发送至对应的目标用户端,将各服务器响应数据对应的内存进行释放,以更新服务器的当前可用内存值,返回执行判断是否检测到用户端发送的数据读取请求的步骤。If it is detected that the server response data has been sent to the corresponding target client, the memory corresponding to each server response data will be released to update the current available memory value of the server, and the execution will be returned to determine whether the data read request sent by the client has been detected A step of.
在本实施例中,例如线程1对应的数据请求量为300M,服务器对其分配的内存分配值为300M;线程2对应的数据请求量为400M,服务器对其分配的内存分配值为400M;线程3对应的数据请求量为900M,服务器对其分配的内存分配值为324M,在分配完线程1-线程3各自对应给的内存分配值之后,服务器的当前可用内存值更新为0M。此时上述三个线程中,若检测到其中一个或多个线程对应的服务器响应数据发送至对应的目标用户端,则获取该线程对应的内存分配值以叠加至为之前已降至0M的服务器的当前可用内存值,例如线程1和线程2对应的服务器响应数据分别发送至对应的目标用户端,此时将服务器的当前可用内存值更新至700M(300M+400M=700M),之后再返回执行判断是否检测到用户端发送的数据读取请求的步骤。In this embodiment, for example, the data request amount corresponding to thread 1 is 300M, and the memory allocation value allocated by the server is 300M; the data request amount corresponding to thread 2 is 400M, and the memory allocation value allocated by the server is 400M; thread 3 The corresponding data request amount is 900M, and the memory allocation value allocated by the server to it is 324M. After the memory allocation value corresponding to thread 1-thread 3 is allocated, the current available memory value of the server is updated to 0M. At this time, among the above three threads, if it is detected that the server response data corresponding to one or more of the threads is sent to the corresponding target client, the memory allocation value corresponding to the thread is obtained to be added to the server that has been reduced to 0M before For example, the server response data corresponding to thread 1 and thread 2 are sent to the corresponding target client. At this time, the current available memory value of the server is updated to 700M (300M+400M=700M), and then the execution is returned. The step of judging whether a data read request sent by the client is detected.
该方法实现了当服务器中接收了大量并发请求时,服务器不会出现内存溢出导致不可用的问题,而且能稳定响应请求,提高了服务器的稳定性。The method realizes that when a large number of concurrent requests are received in the server, the server will not have the problem of unavailability caused by memory overflow, and can respond to requests stably, which improves the stability of the server.
本申请实施例还提供一种时间序列数据分段构建装置,该时间序列数据分段构建装置用于执行前述时间序列数据分段构建方法的任一实施例。具体地,请参阅图3,图3是本申请实施例提供的时间序列数据分段构建装置的示意性框图。The embodiment of the present application also provides a time series data segment construction device, which is used to execute any embodiment of the aforementioned time series data segment construction method. Specifically, please refer to FIG. 3, which is a schematic block diagram of an apparatus for constructing time series data segments according to an embodiment of the present application.
如图3所示,时间序列数据分段构建装置100包括:读取请求检测单元110、请求参数获取单元120、请求筛选单元130、集合分类单元140、响应数据生成单元150、内存分配单元160、内存判断单元170、第一响应数据发送单元180。As shown in FIG. 3, the time series data segment construction device 100 includes: a read request detection unit 110, a request parameter acquisition unit 120, a request screening unit 130, a collection classification unit 140, a response data generation unit 150, a memory allocation unit 160, The memory judgment unit 170 and the first response data sending unit 180.
读取请求检测单元110,用于判断是否检测到用户端发送的数据读取请求。The read request detection unit 110 is used to determine whether a data read request sent by the client is detected.
请求参数获取单元120,用于若检测到用户端发送的数据读取请求,将各数据读取请求对应的线程加入线程池,获取数据读取请求对应的请求总个数以及各数据读取请求对应的数据请求量。The request parameter obtaining unit 120 is configured to, if the data reading request sent by the user terminal is detected, add the thread corresponding to each data reading request to the thread pool, and obtain the total number of requests corresponding to the data reading request and each data reading request The corresponding data request volume.
在一实施例中,请求参数获取单元120包括:In an embodiment, the request parameter obtaining unit 120 includes:
请求存储单元,用于将各用户端的数据读取请求根据请求接收时间依序存储于线程池中;其中,每一数据读取请求对应启动一个线程;The request storage unit is used to store the data read requests of each client in the thread pool in sequence according to the request receiving time; wherein, each data read request starts a thread correspondingly;
请求解析单元,用于根据线程池中存储的数据读取请求,解析获取数据读取请求对应的请求总个数,以及解析获取各数据读取请求对应的数据请求量;其中,所述数据请求量为数据待占用内存的空间值;所述数据读取请求中包括请求次数、请求数据类型列表、及数据时间范围。The request parsing unit is used to analyze the total number of requests corresponding to the data read request according to the data read request stored in the thread pool, and to analyze the data request amount corresponding to each data read request; wherein, the data request The amount is the space value of the memory to be occupied by the data; the data read request includes the number of requests, the list of requested data types, and the data time range.
在一实施例中,请求解析单元包括:In an embodiment, the request parsing unit includes:
哈希表获取单元,用于获取预先存储的哈希表;其中,所述哈希表中存储有多种数据类别,和与多种数据类别中每一数据类别一一对应的单条数据大小值;The hash table obtaining unit is used to obtain a pre-stored hash table; wherein the hash table stores multiple data categories, and a single data size value corresponding to each of the multiple data categories one-to-one ;
数据类别获取单元,用于获取各数据读取请求分别对应的数据类别;The data category obtaining unit is used to obtain the data category corresponding to each data reading request;
请求量计算单元,用于在所述哈希表中查询获取各数据类别对应的单条数据大小值,以对应计算各数据读取请求对应的数据请求量。需要强调的是,为进一步保证上述数据请求量的私密和安全性,上述数据请求量还可以存储于一区块链的节点中。The request amount calculation unit is configured to query and obtain the size value of a single piece of data corresponding to each data category in the hash table, so as to correspondingly calculate the data request amount corresponding to each data reading request. It should be emphasized that, in order to further ensure the privacy and security of the above data request amount, the above data request amount may also be stored in a node of a blockchain.
请求筛选单元130,用于按照各数据读取请求对应的接收时间进行升序排序,按升序顺序依序获取各数据读取请求的数据请求量并求和,直至累计数据请求量超出服务器的当前可用内存值,获取当前已获取的数据读取请求以及对应的第一请求总个数;其中,所述累计数据请求量的初始值为0。The request screening unit 130 is configured to sort in ascending order according to the receiving time corresponding to each data read request, obtain and sum the data request amount of each data read request in ascending order, until the accumulated data request amount exceeds the current available server The memory value is used to obtain the total number of data read requests currently obtained and the corresponding first requests; wherein the initial value of the cumulative data request amount is 0.
在一实施例中,请求筛选单元130包括:In an embodiment, the request screening unit 130 includes:
初始化单元,用于将累计数据请求量值的初始值置为0,将线程池中初始获被取的线程编号n的取值设置为1;The initialization unit is used to set the initial value of the cumulative data request value to 0, and set the value of the thread number n initially obtained in the thread pool to 1;
数据请求量参数获取单元,用于获取当前的线程池中排序号为n的线程对应的数据请求量,并获取上一数据读取请求对应的累计数据请求量;The data request quantity parameter obtaining unit is used to obtain the data request quantity corresponding to the thread with the sort number n in the current thread pool, and obtain the accumulated data request quantity corresponding to the last data read request;
线程阻塞单元,用于将线程池中排序号为n之后的并行线程进行阻塞;The thread blocking unit is used to block parallel threads in the thread pool after the sort number is n;
请求量求和单元,用于将排序号为n的线程对应的数据请求量与上一数据读取请求对应 的累计数据请求量求和,得到排序号为n的线程对应的当前累计数据请求量;The request amount summation unit is used to sum the data request amount corresponding to the thread with the sort number n and the cumulative data request amount corresponding to the last data read request to obtain the current cumulative data request corresponding to the thread with the sort number n ;
请求量更新单元,用于以当前累计数据请求量对累计数据请求量进行更新,得到更新后的累计数据请求量;The request amount update unit is used to update the cumulative data request amount with the current cumulative data request amount to obtain the updated cumulative data request amount;
请求量比较单元,用于判断排序号为n的线程对应的累计数据请求量是否超出服务器的当前可用内存值;The request amount comparison unit is used to determine whether the cumulative data request amount corresponding to the thread with the sort number n exceeds the current available memory value of the server;
排序号自增单元,用于若排序号为n的线程对应的累计数据请求量未超出服务器的当前可用内存值,将排序号n的值加一,以得到更新后的排序号n,将线程池中所有线程解除阻塞,返回执行获取当前的线程池中排序号为n的线程对应的数据请求量,并获取上一数据读取请求对应的累计数据请求量的步骤;The sort number self-increment unit is used to add one to the value of the sort number n if the cumulative data request corresponding to the thread with the sort number n does not exceed the current available memory value of the server to obtain the updated sort number n, and the thread All threads in the pool are unblocked and return to the step of obtaining the data request amount corresponding to the thread with the sort number n in the current thread pool, and obtaining the cumulative data request amount corresponding to the last data read request;
第一请求总个数获取单元,用于若排序号为n的线程对应的当前累计数据请求量超出服务器的当前可用内存值,获取当前的排序号n以作为第一请求总个数,并获取当前已获取的数据读取请求对应的线程。The first request total number obtaining unit is used to obtain the current sort number n as the total number of first requests if the current cumulative data request volume corresponding to the thread with the sort number n exceeds the current available memory value of the server, and obtain The thread corresponding to the currently acquired data read request.
集合分类单元140,用于将所接收到用户端的数据读取请求的组合作为当前请求集合,由当前已获取的数据读取请求组成当前可服务数据读取请求集合,将所述当前请求集合中删除当前可服务数据读取请求集合以作为当前不可服务数据读取请求集合;其中,当前不可服务数据读取请求集合包括一条或者多条当前不可服务数据读取请求,当前可服务数据读取请求集合中包括一条或者多条当前可服务数据读取请求。The set classification unit 140 is configured to use the combination of data read requests received from the client as the current request set, the current serviceable data read request set is composed of the currently acquired data read requests, and the current request set is Delete the current serviceable data read request set as the current unserviceable data read request set; where the current unserviceable data read request set includes one or more currently unserviceable data read requests, and the current serviceable data read request The set includes one or more current serviceable data read requests.
响应数据生成单元150,用于生成与各当前不可服务数据读取请求对应的服务器响应数据,发送各服务器响应数据至与各当前不可服务数据读取请求分别与对应的客户端,将各当前不可服务数据读取请求对应的线程从线程池中释放。The response data generating unit 150 is configured to generate server response data corresponding to each currently unserviceable data read request, and send each server response data to the client corresponding to each currently unserviceable data read request, and compare each currently unserviceable data read request to the corresponding client. The thread corresponding to the service data read request is released from the thread pool.
内存分配单元160,用于获取各当前可服务数据读取请求对应的数据请求量,根据预先设置的内存空间分配策略获取各当前可服务数据读取请求对应的内存分配值。The memory allocation unit 160 is configured to obtain the data request amount corresponding to each current serviceable data read request, and obtain the memory allocation value corresponding to each current serviceable data read request according to a preset memory space allocation strategy.
在一实施例中,内存分配单元160包括:In an embodiment, the memory allocation unit 160 includes:
历史数据读取速率获取单元,用于获取各当前可服务数据读取请求对应的目标用户端,及各目标用户端对应的历史数据读取速率;The historical data reading rate obtaining unit is used to obtain the target client corresponding to each current serviceable data reading request, and the historical data reading rate corresponding to each target client;
速率排序单元,用于将各目标用户端对应的历史数据读取速率按照降序排序,得到各目标用户端对应的当前服务排序值;The rate sorting unit is used to sort the historical data reading rate corresponding to each target client terminal in descending order to obtain the current service ranking value corresponding to each target client terminal;
当前第一服务内存值获取单元,用于将当前服务排序值为当前最大值的目标用户端删除,将剩余的各目标用户端对应的数据请求量进行求和得到当前第一服务内存值;The current first service memory value obtaining unit is used to delete the target client whose current service ranking value is the current maximum value, and to sum the data request amounts corresponding to each of the remaining target clients to obtain the current first service memory value;
数据请求量重置单元,用于若当前第一服务内存值未超出服务器的当前可用内存值,将与剩余的各目标用户端对应的内存分配值设置为对应的数据请求量;The data request amount resetting unit is used to set the memory allocation value corresponding to each remaining target client to the corresponding data request amount if the current first service memory value does not exceed the current available memory value of the server;
当前第一内存剩余值获取单元,用于将服务器的当前可用内存值与当前第一服务内存值求差以得到当前第一内存剩余值,将当前服务排序值为当前最大值的目标用户端对应的内存分配值设置为当前第一内存剩余值。The current first memory remaining value obtaining unit is used to calculate the difference between the current available memory value of the server and the current first service memory value to obtain the current first memory remaining value, and the current service ranking value is corresponding to the target client with the current maximum value The memory allocation value of is set to the current remaining value of the first memory.
内存判断单元170,用于判断是否有当前可服务数据读取请求对应的内存分配值小于当前可服务数据读取请求对应的数据请求量。The memory judging unit 170 is configured to judge whether the memory allocation value corresponding to the current serviceable data read request is less than the data request amount corresponding to the current serviceable data read request.
第一响应数据发送单元180,用于若有当前可服务数据读取请求对应的内存分配值小于当前可服务数据读取请求对应的数据请求量,根据该当前可服务数据读取请求对应的内存分配值发送对应的服务器响应数据至对应的目标用户端。The first response data sending unit 180 is configured to: if the memory allocation value corresponding to the current serviceable data read request is less than the data request amount corresponding to the current serviceable data read request, read the memory corresponding to the current serviceable data request The assigned value sends the corresponding server response data to the corresponding target client.
在一实施例中,时间序列数据分段构建装置100还包括:In an embodiment, the time series data segment construction device 100 further includes:
第二响应数据发送单元,用于若有当前可服务数据读取请求对应的内存分配值等于当前可服务数据读取请求对应的数据请求量,根据该当前可服务数据读取请求对应的内存分配值发送对应的服务器响应数据至对应的目标用户端。The second response data sending unit is used to if the memory allocation value corresponding to the current serviceable data read request is equal to the data request amount corresponding to the current serviceable data read request, according to the memory allocation corresponding to the current serviceable data read request Send the corresponding server response data to the corresponding target client.
在一实施例中,时间序列数据分段构建装置100还包括:In an embodiment, the time series data segment construction device 100 further includes:
当前可用内存值更新单元,用于若检测到已将服务器响应数据发送至对应的目标用户端,将各服务器响应数据对应的内存进行释放,以更新服务器的当前可用内存值,返回执行判断 是否检测到用户端发送的数据读取请求的步骤。The current available memory value update unit is used to, if it is detected that the server response data has been sent to the corresponding target client, release the memory corresponding to each server response data to update the current available memory value of the server, and return to execute to determine whether to detect Steps to the data read request sent by the client.
该装置实现了当服务器中接收了大量并发请求时,服务器不会出现内存溢出导致不可用的问题,而且能稳定响应请求,提高了服务器的稳定性。The device realizes that when a large number of concurrent requests are received in the server, the server will not have the problem of unavailability caused by memory overflow, and can stably respond to requests, thereby improving the stability of the server.
上述时间序列数据分段构建装置可以实现为计算机程序的形式,该计算机程序可以在如图4所示的计算机设备上运行。The above-mentioned time series data segmentation construction device can be implemented in the form of a computer program, and the computer program can be run on a computer device as shown in FIG. 4.
请参阅图4,图4是本申请实施例提供的计算机设备的示意性框图。该计算机设备500是服务器,服务器可以是独立的服务器,也可以是多个服务器组成的服务器集群。Please refer to FIG. 4, which is a schematic block diagram of a computer device according to an embodiment of the present application. The computer device 500 is a server, and the server may be an independent server or a server cluster composed of multiple servers.
参阅图4,该计算机设备500包括通过系统总线501连接的处理器502、存储器和网络接口505,其中,存储器可以包括非易失性存储介质503和内存储器504。4, the computer device 500 includes a processor 502, a memory, and a network interface 505 connected through a system bus 501, where the memory may include a non-volatile storage medium 503 and an internal memory 504.
该非易失性存储介质503可存储操作系统5031和计算机程序5032。该计算机程序5032被执行时,可使得处理器502执行时间序列数据分段构建方法。The non-volatile storage medium 503 can store an operating system 5031 and a computer program 5032. When the computer program 5032 is executed, the processor 502 can execute the method for constructing time series data segments.
该处理器502用于提供计算和控制能力,支撑整个计算机设备500的运行。The processor 502 is used to provide calculation and control capabilities, and support the operation of the entire computer device 500.
该内存储器504为非易失性存储介质503中的计算机程序5032的运行提供环境,该计算机程序5032被处理器502执行时,可使得处理器502执行时间序列数据分段构建方法。The internal memory 504 provides an environment for the operation of the computer program 5032 in the non-volatile storage medium 503. When the computer program 5032 is executed by the processor 502, the processor 502 can execute the method for constructing time series data segments.
该网络接口505用于进行网络通信,如提供数据信息的传输等。本领域技术人员可以理解,图4中示出的结构,仅仅是与本申请方案相关的部分结构的框图,并不构成对本申请方案所应用于其上的计算机设备500的限定,具体的计算机设备500可以包括比图中所示更多或更少的部件,或者组合某些部件,或者具有不同的部件布置。The network interface 505 is used for network communication, such as providing data information transmission. Those skilled in the art can understand that the structure shown in FIG. 4 is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device 500 to which the solution of the present application is applied. The specific computer device 500 may include more or fewer components than shown in the figure, or combine certain components, or have a different component arrangement.
其中,所述处理器502用于运行存储在存储器中的计算机程序5032,以实现本申请实施例公开的时间序列数据分段构建方法。Wherein, the processor 502 is configured to run a computer program 5032 stored in a memory to implement the method for constructing time series data segments disclosed in the embodiments of the present application.
本领域技术人员可以理解,图4中示出的计算机设备的实施例并不构成对计算机设备具体构成的限定,在其他实施例中,计算机设备可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件布置。例如,在一些实施例中,计算机设备可以仅包括存储器及处理器,在这样的实施例中,存储器及处理器的结构及功能与图4所示实施例一致,在此不再赘述。Those skilled in the art can understand that the embodiment of the computer device shown in FIG. 4 does not constitute a limitation on the specific configuration of the computer device. In other embodiments, the computer device may include more or less components than those shown in the figure. Or some parts are combined, or different parts are arranged. For example, in some embodiments, the computer device may only include a memory and a processor. In such an embodiment, the structures and functions of the memory and the processor are consistent with the embodiment shown in FIG. 4, and will not be repeated here.
应当理解,在本申请实施例中,处理器502可以是中央处理单元(Central ProcessingUnit,CPU),该处理器502还可以是其他通用处理器、数字信号处理器(Digital Signal Processor,DSP)、专用集成电路(Application Specific Integrated Circuit,ASIC)、现成可编程门阵列(Field-Programmable GateArray,FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件等。其中,通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。It should be understood that, in this embodiment of the application, the processor 502 may be a central processing unit (Central Processing Unit, CPU), and the processor 502 may also be other general-purpose processors, digital signal processors (Digital Signal Processors, DSPs), and special purpose processors. Integrated circuit (Application Specific Integrated Circuit, ASIC), ready-made programmable gate array (Field-Programmable Gate Array, FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, etc. Among them, the general-purpose processor may be a microprocessor or the processor may also be any conventional processor.
在本申请的另一实施例中提供计算机可读存储介质。该计算机可读存储介质可以为非易失性的计算机可读存储介质,也可以是易失性的计算机可读存储介质。该计算机可读存储介质存储有计算机程序,其中计算机程序被处理器执行时实现本申请实施例公开的时间序列数据分段构建方法。In another embodiment of the present application, a computer-readable storage medium is provided. The computer-readable storage medium may be a non-volatile computer-readable storage medium, or may be a volatile computer-readable storage medium. The computer-readable storage medium stores a computer program, where the computer program is executed by a processor to implement the time-series data segment construction method disclosed in the embodiments of the present application.
所属领域的技术人员可以清楚地了解到,为了描述的方便和简洁,上述描述的设备、装置和单元的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。本领域普通技术人员可以意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,能够以电子硬件、计算机软件或者二者的结合来实现,为了清楚地说明硬件和软件的可互换性,在上述说明中已经按照功能一般性地描述了各示例的组成及步骤。这些功能究竟以硬件还是软件方式来执行取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本申请的范围。Those skilled in the art can clearly understand that, for the convenience and conciseness of description, the specific working process of the above-described equipment, device, and unit can refer to the corresponding process in the foregoing method embodiment, which will not be repeated here. A person of ordinary skill in the art may be aware that the units and algorithm steps of the examples described in the embodiments disclosed herein can be implemented by electronic hardware, computer software, or a combination of both, in order to clearly illustrate the hardware and software Interchangeability, in the above description, the composition and steps of each example have been generally described in accordance with the function. Whether these functions are executed by hardware or software depends on the specific application and design constraint conditions of the technical solution. Professionals and technicians can use different methods for each specific application to implement the described functions, but such implementation should not be considered beyond the scope of this application.
在本申请所提供的几个实施例中,应该理解到,所揭露的设备、装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,所述单元的划分,仅仅为逻辑功能划分,实际实现时可以有另外的划分方式,也可以将具有相同功能的单元集合成一个单元,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以 忽略,或不执行。另外,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口、装置或单元的间接耦合或通信连接,也可以是电的,机械的或其它的形式连接。In the several embodiments provided in this application, it should be understood that the disclosed equipment, device, and method may be implemented in other ways. For example, the device embodiments described above are only illustrative. For example, the division of the units is only a logical function division. In actual implementation, there may be other division methods, or the units with the same function may be combined into one. Units, for example, multiple units or components can be combined or integrated into another system, or some features can be omitted or not implemented. In addition, the displayed or discussed mutual coupling or direct coupling or communication connection may be indirect coupling or communication connection through some interfaces, devices or units, and may also be electrical, mechanical or other forms of connection.
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本申请实施例方案的目的。The units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the objectives of the solutions of the embodiments of the present application.
另外,在本申请各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以是两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。In addition, the functional units in the various embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units may be integrated into one unit. The above-mentioned integrated unit can be implemented in the form of hardware or software functional unit.
本申请所指区块链是分布式数据存储、点对点传输、共识机制、加密算法等计算机技术的新型应用模式。区块链(Blockchain),本质上是一个去中心化的数据库,是一串使用密码学方法相关联产生的数据块,每一个数据块中包含了一批次网络交易的信息,用于验证其信息的有效性(防伪)和生成下一个区块。区块链可以包括区块链底层平台、平台产品服务层以及应用服务层等。所述集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个存储介质中。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分,或者该技术方案的全部或部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本申请各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(ROM,Read-Only Memory)、磁碟或者光盘等各种可以存储程序代码的介质。The blockchain referred to in this application is a new application mode of computer technology such as distributed data storage, point-to-point transmission, consensus mechanism, and encryption algorithm. Blockchain, essentially a decentralized database, is a series of data blocks associated with cryptographic methods. Each data block contains a batch of network transaction information for verification. The validity of the information (anti-counterfeiting) and the generation of the next block. The blockchain can include the underlying platform of the blockchain, the platform product service layer, and the application service layer. If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a storage medium. Based on this understanding, the technical solution of this application is essentially or the part that contributes to the existing technology, or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium. It includes several instructions to make a computer device (which may be a personal computer, a server, or a network device, etc.) execute all or part of the steps of the methods described in the various embodiments of the present application. The aforementioned storage media include: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), magnetic disk or optical disk and other media that can store program codes.
以上所述,仅为本申请的具体实施方式,但本申请的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本申请揭露的技术范围内,可轻易想到各种等效的修改或替换,这些修改或替换都应涵盖在本申请的保护范围之内。因此,本申请的保护范围应以权利要求的保护范围为准。The above are only specific implementations of this application, but the protection scope of this application is not limited to this. Any person skilled in the art can easily think of various equivalents within the technical scope disclosed in this application. Modifications or replacements, these modifications or replacements shall be covered within the protection scope of this application. Therefore, the protection scope of this application shall be subject to the protection scope of the claims.

Claims (20)

  1. 一种时间序列数据分段构建方法,其中,包括:A method for constructing time series data segmentation, which includes:
    判断是否检测到用户端发送的数据读取请求;Determine whether the data read request sent by the client is detected;
    若检测到用户端发送的数据读取请求,将各数据读取请求对应的线程加入线程池,获取数据读取请求对应的请求总个数以及各数据读取请求对应的数据请求量;If the data read request sent by the client is detected, the thread corresponding to each data read request is added to the thread pool, and the total number of requests corresponding to the data read request and the data request amount corresponding to each data read request are obtained;
    按照各数据读取请求对应的接收时间进行升序排序,按升序顺序依序获取各数据读取请求的数据请求量并求和,直至累计数据请求量超出服务器的当前可用内存值,获取当前已获取的数据读取请求以及对应的第一请求总个数;其中,所述累计数据请求量的初始值为0;Sort in ascending order according to the receiving time corresponding to each data read request, and obtain the data request amount of each data read request in ascending order and sum them until the accumulated data request amount exceeds the current available memory value of the server, and obtain the current obtained The total number of data read requests and corresponding first requests; wherein the initial value of the cumulative data request amount is 0;
    将所接收到用户端的数据读取请求的组合作为当前请求集合,由当前已获取的数据读取请求组成当前可服务数据读取请求集合,将所述当前请求集合中删除当前可服务数据读取请求集合以作为当前不可服务数据读取请求集合;其中,当前不可服务数据读取请求集合包括一条或者多条当前不可服务数据读取请求,当前可服务数据读取请求集合中包括一条或者多条当前可服务数据读取请求;The combination of data read requests received from the user side is taken as the current request set, the current serviceable data read request set is composed of the currently acquired data read requests, and the current serviceable data read is deleted from the current request set The request set is taken as the current unserviceable data read request set; among them, the current unserviceable data read request set includes one or more currently unserviceable data read requests, and the current serviceable data read request set includes one or more Current serviceable data read request;
    生成与各当前不可服务数据读取请求对应的服务器响应数据,发送各服务器响应数据至与各当前不可服务数据读取请求分别与对应的客户端,将各当前不可服务数据读取请求对应的线程从线程池中释放;Generate server response data corresponding to each currently unserviceable data read request, send each server response data to the corresponding client with each currently unserviceable data read request, and transfer the thread corresponding to each currently unserviceable data read request Release from the thread pool;
    获取各当前可服务数据读取请求对应的数据请求量,根据预先设置的内存空间分配策略获取各当前可服务数据读取请求对应的内存分配值;Obtain the data request amount corresponding to each current serviceable data read request, and obtain the memory allocation value corresponding to each current serviceable data read request according to the preset memory space allocation strategy;
    判断是否有当前可服务数据读取请求对应的内存分配值小于当前可服务数据读取请求对应的数据请求量;以及Determine whether the memory allocation value corresponding to the current serviceable data read request is less than the data request amount corresponding to the current serviceable data read request; and
    若有当前可服务数据读取请求对应的内存分配值小于当前可服务数据读取请求对应的数据请求量,根据该当前可服务数据读取请求对应的内存分配值发送对应的服务器响应数据至对应的目标用户端。If the memory allocation value corresponding to the current serviceable data read request is less than the data request amount corresponding to the current serviceable data read request, the corresponding server response data is sent to the corresponding server according to the memory allocation value corresponding to the current serviceable data read request The target client.
  2. 根据权利要求1所述的时间序列数据分段构建方法,其中,所述数据请求量存储于区块链中,所述将各数据读取请求对应的线程加入线程池,获取数据读取请求对应的请求总个数以及各数据读取请求对应的数据请求量,包括:The method for constructing time series data segments according to claim 1, wherein the data request amount is stored in a blockchain, and the thread corresponding to each data reading request is added to the thread pool to obtain the data reading request corresponding The total number of requests and the amount of data requests corresponding to each data read request include:
    将各用户端的数据读取请求根据请求接收时间依序存储于线程池中;其中,每一数据读取请求对应启动一个线程;The data read requests of each client are sequentially stored in the thread pool according to the request receiving time; among them, each data read request starts a thread correspondingly;
    根据线程池中存储的数据读取请求,解析获取数据读取请求对应的请求总个数,以及解析获取各数据读取请求对应的数据请求量;其中,所述数据请求量为数据待占用内存的空间值;所述数据读取请求中包括请求次数、请求数据类型列表、及数据时间范围。According to the data read request stored in the thread pool, analyze the total number of requests corresponding to the data read request, and analyze the data request amount corresponding to each data read request; wherein the data request amount is the memory to be occupied by the data The spatial value of; the data read request includes the number of requests, the list of requested data types, and the data time range.
  3. 根据权利要求2所述的时间序列数据分段构建方法,其中,所述解析获取数据读取请求对应的请求总个数,以及解析获取各数据读取请求对应的数据请求量,包括:The method for constructing time series data segments according to claim 2, wherein the analyzing and obtaining the total number of requests corresponding to the data reading request and analyzing and obtaining the data request amount corresponding to each data reading request comprise:
    获取预先存储的哈希表;其中,所述哈希表中存储有多种数据类别,和与多种数据类别中每一数据类别一一对应的单条数据大小值;Obtain a pre-stored hash table; wherein multiple data categories are stored in the hash table, and a single data size value corresponding to each data category of the multiple data categories one-to-one;
    获取各数据读取请求分别对应的数据类别;Obtain the data category corresponding to each data read request;
    在所述哈希表中查询获取各数据类别对应的单条数据大小值,以对应计算各数据读取请求对应的数据请求量。The hash table is queried to obtain the size value of a single piece of data corresponding to each data category, so as to correspondingly calculate the data request amount corresponding to each data reading request.
  4. 根据权利要求1所述的时间序列数据分段构建方法,其中,所述按照各数据读取请求对应的接收时间进行升序排序,按升序顺序依序获取各数据读取请求的数据请求量并求和,直至累计数据请求量超出服务器的当前可用内存值,获取当前已获取的数据读取请求以及对应的第一请求总个数,包括:The method for constructing time-series data segments according to claim 1, wherein the data read request is sorted in ascending order according to the receiving time corresponding to each data read request, and the data request amount of each data read request is obtained in ascending order and calculated And, until the cumulative data request volume exceeds the current available memory value of the server, obtain the currently acquired data read requests and the total number of corresponding first requests, including:
    将累计数据请求量值的初始值置为0,将线程池中初始获被取的线程编号n的取值设置为1;Set the initial value of the cumulative data request value to 0, and set the value of the thread number n initially obtained in the thread pool to 1;
    获取当前的线程池中排序号为n的线程对应的数据请求量,并获取上一数据读取请求对 应的累计数据请求量;Obtain the data request amount corresponding to the thread with the sort number n in the current thread pool, and obtain the accumulated data request amount corresponding to the last data read request;
    将线程池中排序号为n之后的并行线程进行阻塞;Block parallel threads in the thread pool after the sort number n;
    将排序号为n的线程对应的数据请求量与上一数据读取请求对应的累计数据请求量求和,得到排序号为n的线程对应的当前累计数据请求量;Sum the data request volume corresponding to the thread with the sort number n and the cumulative data request volume corresponding to the last data read request to obtain the current cumulative data request volume corresponding to the thread with the sort number n;
    以当前累计数据请求量对累计数据请求量进行更新,得到更新后的累计数据请求量;Update the cumulative data request amount with the current cumulative data request amount to obtain the updated cumulative data request amount;
    判断排序号为n的线程对应的累计数据请求量是否超出服务器的当前可用内存值;Determine whether the cumulative data request volume corresponding to the thread with the sort number n exceeds the current available memory value of the server;
    若排序号为n的线程对应的累计数据请求量未超出服务器的当前可用内存值,将排序号n的值加一,以得到更新后的排序号n,将线程池中所有线程解除阻塞,返回执行获取当前的线程池中排序号为n的线程对应的数据请求量,并获取上一数据读取请求对应的累计数据请求量的步骤;If the cumulative data request volume corresponding to the thread with the sort number n does not exceed the current available memory value of the server, add one to the value of the sort number n to get the updated sort number n, unblock all threads in the thread pool, and return Perform the steps of obtaining the data request amount corresponding to the thread with the sort number n in the current thread pool, and obtaining the cumulative data request amount corresponding to the previous data read request;
    若排序号为n的线程对应的当前累计数据请求量超出服务器的当前可用内存值,获取当前的排序号n以作为第一请求总个数,并获取当前已获取的数据读取请求对应的线程。If the current cumulative data request volume corresponding to the thread with the sort number n exceeds the current available memory value of the server, obtain the current sort number n as the total number of first requests, and obtain the thread corresponding to the currently acquired data read request .
  5. 根据权利要求1所述的时间序列数据分段构建方法,其中,所述获取各当前可服务数据读取请求对应的数据请求量,根据预先设置的内存空间分配策略获取各当前可服务数据读取请求对应的内存分配值,包括:The method for constructing time series data segments according to claim 1, wherein said obtaining the data request amount corresponding to each current serviceable data reading request, and obtaining each current serviceable data reading request according to a preset memory space allocation strategy Request the corresponding memory allocation value, including:
    获取各当前可服务数据读取请求对应的目标用户端,及各目标用户端对应的历史数据读取速率;Obtain the target client corresponding to each current serviceable data read request, and the historical data reading rate corresponding to each target client;
    将各目标用户端对应的历史数据读取速率按照降序排序,得到各目标用户端对应的当前服务排序值;Sort the historical data reading rate corresponding to each target client in descending order to obtain the current service ranking value corresponding to each target client;
    将当前服务排序值为当前最大值的目标用户端删除,将剩余的各目标用户端对应的数据请求量进行求和得到当前第一服务内存值;Delete the target client whose current service ranking value is the current maximum value, and sum the data request amount corresponding to each of the remaining target clients to obtain the current first service memory value;
    若当前第一服务内存值未超出服务器的当前可用内存值,将与剩余的各目标用户端对应的内存分配值设置为对应的数据请求量;If the current memory value of the first service does not exceed the current available memory value of the server, the memory allocation value corresponding to each remaining target client is set to the corresponding data request amount;
    将服务器的当前可用内存值与当前第一服务内存值求差以得到当前第一内存剩余值,将当前服务排序值为当前最大值的目标用户端对应的内存分配值设置为当前第一内存剩余值。The current available memory value of the server and the current first service memory value are calculated to obtain the current first memory remaining value, and the memory allocation value corresponding to the target client whose current service ranking value is the current maximum value is set to the current first memory remaining value value.
  6. 根据权利要求1所述的时间序列数据分段构建方法,其中,所述判断是否有当前可服务数据读取请求对应的内存分配值小于当前可服务数据读取请求对应的数据请求量之后,还包括:The method for constructing time series data segments according to claim 1, wherein after determining whether the memory allocation value corresponding to the current serviceable data read request is less than the data request amount corresponding to the current serviceable data read request, the include:
    若有当前可服务数据读取请求对应的内存分配值等于当前可服务数据读取请求对应的数据请求量,根据该当前可服务数据读取请求对应的内存分配值发送对应的服务器响应数据至对应的目标用户端。If the memory allocation value corresponding to the current serviceable data read request is equal to the data request amount corresponding to the current serviceable data read request, the corresponding server response data is sent to the corresponding server according to the memory allocation value corresponding to the current serviceable data read request The target client.
  7. 根据权利要求6所述的时间序列数据分段构建方法,其中,所述若有当前可服务数据读取请求对应的内存分配值等于当前可服务数据读取请求对应的数据请求量,根据该当前可服务数据读取请求对应的内存分配值发送对应的服务器响应数据至对应的目标用户端之后,还包括:The method for constructing time series data segments according to claim 6, wherein the memory allocation value corresponding to the current serviceable data read request is equal to the data request amount corresponding to the current serviceable data read request, and according to the current After the memory allocation value corresponding to the serviceable data read request sends the corresponding server response data to the corresponding target client, it also includes:
    若检测到已将服务器响应数据发送至对应的目标用户端,将各服务器响应数据对应的内存进行释放,以更新服务器的当前可用内存值,返回执行判断是否检测到用户端发送的数据读取请求的步骤。If it is detected that the server response data has been sent to the corresponding target client, the memory corresponding to each server response data will be released to update the current available memory value of the server, and the execution will be returned to determine whether the data read request sent by the client has been detected A step of.
  8. 根据权利要求7所述的时间序列数据分段构建方法,其中,所述服务器根据目标用户端的数据读取请求反馈的服务器响应数据格式为{时间序列片段,{请求次数,请求数据类型列表,数据时间范围,随机等待时间}},其中,时间序列片段不为空值,随机等待时间则为服务器随机生成。The method for constructing time series data segments according to claim 7, wherein the server response data format that the server feeds back according to the data reading request of the target client is {time series fragment, {request times, request data type list, data Time range, random waiting time}}, where the time series fragment is not a null value, and the random waiting time is randomly generated by the server.
  9. 一种时间序列数据分段构建装置,其中,包括:A time series data segmentation construction device, which includes:
    读取请求检测单元,用于判断是否检测到用户端发送的数据读取请求;The read request detection unit is used to determine whether the data read request sent by the client is detected;
    请求参数获取单元,用于若检测到用户端发送的数据读取请求,将各数据读取请求对应的线程加入线程池,获取数据读取请求对应的请求总个数以及各数据读取请求对应的数据请 求量;The request parameter acquisition unit is used to add the thread corresponding to each data read request to the thread pool if the data read request sent by the client is detected, and obtain the total number of requests corresponding to the data read request and the corresponding data read request Of data requests;
    请求筛选单元,用于按照各数据读取请求对应的接收时间进行升序排序,按升序顺序依序获取各数据读取请求的数据请求量并求和,直至累计数据请求量超出服务器的当前可用内存值,获取当前已获取的数据读取请求以及对应的第一请求总个数;其中,所述累计数据请求量的初始值为0;The request filtering unit is used to sort in ascending order according to the receiving time corresponding to each data read request, and obtain the data request amount of each data read request in ascending order and sum them until the accumulated data request amount exceeds the current available memory of the server Value, acquiring the total number of data read requests currently acquired and the corresponding first request; wherein, the initial value of the cumulative data request amount is 0;
    集合分类单元,用于将所接收到用户端的数据读取请求的组合作为当前请求集合,由当前已获取的数据读取请求组成当前可服务数据读取请求集合,将所述当前请求集合中删除当前可服务数据读取请求集合以作为当前不可服务数据读取请求集合;其中,当前不可服务数据读取请求集合包括一条或者多条当前不可服务数据读取请求,当前可服务数据读取请求集合中包括一条或者多条当前可服务数据读取请求;The set classification unit is used to take the combination of data reading requests received from the user side as the current request set, the current serviceable data reading request set is composed of the currently obtained data reading requests, and the current request set is deleted The current serviceable data read request set is taken as the current unserviceable data read request set; wherein the current unserviceable data read request set includes one or more currently unserviceable data read requests, and the current serviceable data read request set Include one or more current serviceable data read requests;
    响应数据生成单元,用于生成与各当前不可服务数据读取请求对应的服务器响应数据,发送各服务器响应数据至与各当前不可服务数据读取请求分别与对应的客户端,将各当前不可服务数据读取请求对应的线程从线程池中释放;The response data generating unit is used to generate server response data corresponding to each currently unserviceable data read request, and send each server response data to the corresponding client for each currently unserviceable data read request, and to compare each currently unserviceable data read request to the corresponding client. The thread corresponding to the data read request is released from the thread pool;
    内存分配单元,用于获取各当前可服务数据读取请求对应的数据请求量,根据预先设置的内存空间分配策略获取各当前可服务数据读取请求对应的内存分配值;The memory allocation unit is used to obtain the data request amount corresponding to each current serviceable data read request, and obtain the memory allocation value corresponding to each current serviceable data read request according to a preset memory space allocation strategy;
    内存判断单元,用于判断是否有当前可服务数据读取请求对应的内存分配值小于当前可服务数据读取请求对应的数据请求量;以及The memory judgment unit is used to judge whether the memory allocation value corresponding to the current serviceable data read request is less than the data request amount corresponding to the current serviceable data read request; and
    第一响应数据发送单元,用于若有当前可服务数据读取请求对应的内存分配值小于当前可服务数据读取请求对应的数据请求量,根据该当前可服务数据读取请求对应的内存分配值发送对应的服务器响应数据至对应的目标用户端。The first response data sending unit is used to if the memory allocation value corresponding to the current serviceable data read request is less than the data request amount corresponding to the current serviceable data read request, according to the memory allocation corresponding to the current serviceable data read request Send the corresponding server response data to the corresponding target client.
  10. 一种计算机设备,包括存储器、处理器及存储在所述存储器上并可在所述处理器上运行的计算机程序,其中,所述处理器执行所述计算机程序时实现以下步骤:A computer device includes a memory, a processor, and a computer program that is stored on the memory and can run on the processor, wherein the processor implements the following steps when the processor executes the computer program:
    判断是否检测到用户端发送的数据读取请求;Determine whether the data read request sent by the client is detected;
    若检测到用户端发送的数据读取请求,将各数据读取请求对应的线程加入线程池,获取数据读取请求对应的请求总个数以及各数据读取请求对应的数据请求量;If the data read request sent by the client is detected, the thread corresponding to each data read request is added to the thread pool, and the total number of requests corresponding to the data read request and the data request amount corresponding to each data read request are obtained;
    按照各数据读取请求对应的接收时间进行升序排序,按升序顺序依序获取各数据读取请求的数据请求量并求和,直至累计数据请求量超出服务器的当前可用内存值,获取当前已获取的数据读取请求以及对应的第一请求总个数;其中,所述累计数据请求量的初始值为0;Sort in ascending order according to the receiving time corresponding to each data read request, and obtain the data request amount of each data read request in ascending order and sum them until the accumulated data request amount exceeds the current available memory value of the server, and obtain the current obtained The total number of data read requests and corresponding first requests; wherein the initial value of the cumulative data request amount is 0;
    将所接收到用户端的数据读取请求的组合作为当前请求集合,由当前已获取的数据读取请求组成当前可服务数据读取请求集合,将所述当前请求集合中删除当前可服务数据读取请求集合以作为当前不可服务数据读取请求集合;其中,当前不可服务数据读取请求集合包括一条或者多条当前不可服务数据读取请求,当前可服务数据读取请求集合中包括一条或者多条当前可服务数据读取请求;The combination of data read requests received from the user side is taken as the current request set, the current serviceable data read request set is composed of the currently acquired data read requests, and the current serviceable data read is deleted from the current request set The request set is taken as the current unserviceable data read request set; among them, the current unserviceable data read request set includes one or more currently unserviceable data read requests, and the current serviceable data read request set includes one or more Current serviceable data read request;
    生成与各当前不可服务数据读取请求对应的服务器响应数据,发送各服务器响应数据至与各当前不可服务数据读取请求分别与对应的客户端,将各当前不可服务数据读取请求对应的线程从线程池中释放;Generate server response data corresponding to each currently unserviceable data read request, send each server response data to the corresponding client with each currently unserviceable data read request, and transfer the thread corresponding to each currently unserviceable data read request Release from the thread pool;
    获取各当前可服务数据读取请求对应的数据请求量,根据预先设置的内存空间分配策略获取各当前可服务数据读取请求对应的内存分配值;Obtain the data request amount corresponding to each current serviceable data read request, and obtain the memory allocation value corresponding to each current serviceable data read request according to the preset memory space allocation strategy;
    判断是否有当前可服务数据读取请求对应的内存分配值小于当前可服务数据读取请求对应的数据请求量;以及Determine whether the memory allocation value corresponding to the current serviceable data read request is less than the data request amount corresponding to the current serviceable data read request; and
    若有当前可服务数据读取请求对应的内存分配值小于当前可服务数据读取请求对应的数据请求量,根据该当前可服务数据读取请求对应的内存分配值发送对应的服务器响应数据至对应的目标用户端。If the memory allocation value corresponding to the current serviceable data read request is less than the data request amount corresponding to the current serviceable data read request, the corresponding server response data is sent to the corresponding server according to the memory allocation value corresponding to the current serviceable data read request The target client.
  11. 根据权利要求10所述的计算机设备,其中,所述数据请求量存储于区块链中,所述将各数据读取请求对应的线程加入线程池,获取数据读取请求对应的请求总个数以及各数据读取请求对应的数据请求量,包括:The computer device according to claim 10, wherein the data request amount is stored in a blockchain, and the thread corresponding to each data read request is added to the thread pool to obtain the total number of requests corresponding to the data read request And the data request amount corresponding to each data read request, including:
    将各用户端的数据读取请求根据请求接收时间依序存储于线程池中;其中,每一数据读取请求对应启动一个线程;The data read requests of each client are sequentially stored in the thread pool according to the request receiving time; among them, each data read request starts a thread correspondingly;
    根据线程池中存储的数据读取请求,解析获取数据读取请求对应的请求总个数,以及解析获取各数据读取请求对应的数据请求量;其中,所述数据请求量为数据待占用内存的空间值;所述数据读取请求中包括请求次数、请求数据类型列表、及数据时间范围。According to the data read request stored in the thread pool, analyze the total number of requests corresponding to the data read request, and analyze the data request amount corresponding to each data read request; wherein the data request amount is the memory to be occupied by the data The spatial value of; the data read request includes the number of requests, the list of requested data types, and the data time range.
  12. 根据权利要求11所述的计算机设备,其中,所述解析获取数据读取请求对应的请求总个数,以及解析获取各数据读取请求对应的数据请求量,包括:The computer device according to claim 11, wherein said analyzing and obtaining the total number of requests corresponding to data reading requests and analyzing and obtaining the data request amount corresponding to each data reading request comprises:
    获取预先存储的哈希表;其中,所述哈希表中存储有多种数据类别,和与多种数据类别中每一数据类别一一对应的单条数据大小值;Obtain a pre-stored hash table; wherein multiple data categories are stored in the hash table, and a single data size value corresponding to each data category of the multiple data categories one-to-one;
    获取各数据读取请求分别对应的数据类别;Obtain the data category corresponding to each data read request;
    在所述哈希表中查询获取各数据类别对应的单条数据大小值,以对应计算各数据读取请求对应的数据请求量。The hash table is queried to obtain the size value of a single piece of data corresponding to each data category, so as to correspondingly calculate the data request amount corresponding to each data reading request.
  13. 根据权利要求10所述的计算机设备,其中,所述按照各数据读取请求对应的接收时间进行升序排序,按升序顺序依序获取各数据读取请求的数据请求量并求和,直至累计数据请求量超出服务器的当前可用内存值,获取当前已获取的数据读取请求以及对应的第一请求总个数,包括:The computer device according to claim 10, wherein the data read request is sorted in ascending order according to the receiving time corresponding to each data read request, and the data request amount of each data read request is sequentially obtained in ascending order and summed until the data is accumulated The request amount exceeds the current available memory value of the server, and the total number of data read requests that have been obtained currently and the corresponding first requests are obtained, including:
    将累计数据请求量值的初始值置为0,将线程池中初始获被取的线程编号n的取值设置为1;Set the initial value of the cumulative data request value to 0, and set the value of the thread number n initially obtained in the thread pool to 1;
    获取当前的线程池中排序号为n的线程对应的数据请求量,并获取上一数据读取请求对应的累计数据请求量;Obtain the data request amount corresponding to the thread with the sort number n in the current thread pool, and obtain the accumulated data request amount corresponding to the last data read request;
    将线程池中排序号为n之后的并行线程进行阻塞;Block parallel threads in the thread pool after the sort number n;
    将排序号为n的线程对应的数据请求量与上一数据读取请求对应的累计数据请求量求和,得到排序号为n的线程对应的当前累计数据请求量;Sum the data request volume corresponding to the thread with the sort number n and the cumulative data request volume corresponding to the last data read request to obtain the current cumulative data request volume corresponding to the thread with the sort number n;
    以当前累计数据请求量对累计数据请求量进行更新,得到更新后的累计数据请求量;Update the cumulative data request amount with the current cumulative data request amount to obtain the updated cumulative data request amount;
    判断排序号为n的线程对应的累计数据请求量是否超出服务器的当前可用内存值;Determine whether the cumulative data request volume corresponding to the thread with the sort number n exceeds the current available memory value of the server;
    若排序号为n的线程对应的累计数据请求量未超出服务器的当前可用内存值,将排序号n的值加一,以得到更新后的排序号n,将线程池中所有线程解除阻塞,返回执行获取当前的线程池中排序号为n的线程对应的数据请求量,并获取上一数据读取请求对应的累计数据请求量的步骤;If the cumulative data request volume corresponding to the thread with the sort number n does not exceed the current available memory value of the server, add one to the value of the sort number n to get the updated sort number n, unblock all threads in the thread pool, and return Perform the steps of obtaining the data request amount corresponding to the thread with the sort number n in the current thread pool, and obtaining the cumulative data request amount corresponding to the previous data read request;
    若排序号为n的线程对应的当前累计数据请求量超出服务器的当前可用内存值,获取当前的排序号n以作为第一请求总个数,并获取当前已获取的数据读取请求对应的线程。If the current cumulative data request volume corresponding to the thread with the sort number n exceeds the current available memory value of the server, obtain the current sort number n as the total number of first requests, and obtain the thread corresponding to the currently acquired data read request .
  14. 根据权利要求10所述的计算机设备,其中,所述获取各当前可服务数据读取请求对应的数据请求量,根据预先设置的内存空间分配策略获取各当前可服务数据读取请求对应的内存分配值,包括:The computer device according to claim 10, wherein said obtaining the data request amount corresponding to each current serviceable data reading request, and obtaining the memory allocation corresponding to each current serviceable data reading request according to a preset memory space allocation strategy Values include:
    获取各当前可服务数据读取请求对应的目标用户端,及各目标用户端对应的历史数据读取速率;Obtain the target client corresponding to each current serviceable data read request, and the historical data reading rate corresponding to each target client;
    将各目标用户端对应的历史数据读取速率按照降序排序,得到各目标用户端对应的当前服务排序值;Sort the historical data reading rate corresponding to each target client in descending order to obtain the current service ranking value corresponding to each target client;
    将当前服务排序值为当前最大值的目标用户端删除,将剩余的各目标用户端对应的数据请求量进行求和得到当前第一服务内存值;Delete the target client whose current service ranking value is the current maximum value, and sum the data request amount corresponding to each of the remaining target clients to obtain the current first service memory value;
    若当前第一服务内存值未超出服务器的当前可用内存值,将与剩余的各目标用户端对应的内存分配值设置为对应的数据请求量;If the current memory value of the first service does not exceed the current available memory value of the server, the memory allocation value corresponding to each remaining target client is set to the corresponding data request amount;
    将服务器的当前可用内存值与当前第一服务内存值求差以得到当前第一内存剩余值,将当前服务排序值为当前最大值的目标用户端对应的内存分配值设置为当前第一内存剩余值。The current available memory value of the server and the current first service memory value are calculated to obtain the current first memory remaining value, and the memory allocation value corresponding to the target client whose current service ranking value is the current maximum value is set to the current first memory remaining value value.
  15. 根据权利要求10所述的计算机设备,其中,所述判断是否有当前可服务数据读取请求对应的内存分配值小于当前可服务数据读取请求对应的数据请求量之后,还包括:The computer device according to claim 10, wherein after determining whether the memory allocation value corresponding to the current serviceable data read request is less than the data request amount corresponding to the current serviceable data read request, the method further comprises:
    若有当前可服务数据读取请求对应的内存分配值等于当前可服务数据读取请求对应的数据请求量,根据该当前可服务数据读取请求对应的内存分配值发送对应的服务器响应数据至对应的目标用户端。If the memory allocation value corresponding to the current serviceable data read request is equal to the data request amount corresponding to the current serviceable data read request, the corresponding server response data is sent to the corresponding server according to the memory allocation value corresponding to the current serviceable data read request The target client.
  16. 根据权利要求15所述的计算机设备,其中,所述若有当前可服务数据读取请求对应的内存分配值等于当前可服务数据读取请求对应的数据请求量,根据该当前可服务数据读取请求对应的内存分配值发送对应的服务器响应数据至对应的目标用户端之后,还包括:The computer device according to claim 15, wherein the memory allocation value corresponding to the current serviceable data read request is equal to the data request amount corresponding to the current serviceable data read request, and the current serviceable data read request is read according to the current serviceable data request amount. After requesting the corresponding memory allocation value and sending the corresponding server response data to the corresponding target client, it also includes:
    若检测到已将服务器响应数据发送至对应的目标用户端,将各服务器响应数据对应的内存进行释放,以更新服务器的当前可用内存值,返回执行判断是否检测到用户端发送的数据读取请求的步骤。If it is detected that the server response data has been sent to the corresponding target client, the memory corresponding to each server response data will be released to update the current available memory value of the server, and the execution will be returned to determine whether the data read request sent by the client has been detected A step of.
  17. 根据权利要求16所述的计算机设备,其中,所述服务器根据目标用户端的数据读取请求反馈的服务器响应数据格式为{时间序列片段,{请求次数,请求数据类型列表,数据时间范围,随机等待时间}},其中,时间序列片段不为空值,随机等待时间则为服务器随机生成。The computer device according to claim 16, wherein the server response data format of the server response data fed back by the server according to the data read request of the target client is {time series fragment, {request times, request data type list, data time range, random waiting Time}}, where the time sequence fragment is not a null value, and the random waiting time is randomly generated by the server.
  18. 一种计算机可读存储介质,其中,所述计算机可读存储介质存储有计算机程序,所述计算机程序当被处理器执行时使所述处理器执行以下操作:A computer-readable storage medium, wherein the computer-readable storage medium stores a computer program that, when executed by a processor, causes the processor to perform the following operations:
    判断是否检测到用户端发送的数据读取请求;Determine whether the data read request sent by the client is detected;
    若检测到用户端发送的数据读取请求,将各数据读取请求对应的线程加入线程池,获取数据读取请求对应的请求总个数以及各数据读取请求对应的数据请求量;If the data read request sent by the client is detected, the thread corresponding to each data read request is added to the thread pool, and the total number of requests corresponding to the data read request and the data request amount corresponding to each data read request are obtained;
    按照各数据读取请求对应的接收时间进行升序排序,按升序顺序依序获取各数据读取请求的数据请求量并求和,直至累计数据请求量超出服务器的当前可用内存值,获取当前已获取的数据读取请求以及对应的第一请求总个数;其中,所述累计数据请求量的初始值为0;Sort in ascending order according to the receiving time corresponding to each data read request, and obtain the data request amount of each data read request in ascending order and sum them until the accumulated data request amount exceeds the current available memory value of the server, and obtain the current obtained The total number of data read requests and corresponding first requests; wherein the initial value of the cumulative data request amount is 0;
    将所接收到用户端的数据读取请求的组合作为当前请求集合,由当前已获取的数据读取请求组成当前可服务数据读取请求集合,将所述当前请求集合中删除当前可服务数据读取请求集合以作为当前不可服务数据读取请求集合;其中,当前不可服务数据读取请求集合包括一条或者多条当前不可服务数据读取请求,当前可服务数据读取请求集合中包括一条或者多条当前可服务数据读取请求;The combination of data read requests received from the user side is taken as the current request set, the current serviceable data read request set is composed of the currently acquired data read requests, and the current serviceable data read is deleted from the current request set The request set is taken as the current unserviceable data read request set; among them, the current unserviceable data read request set includes one or more currently unserviceable data read requests, and the current serviceable data read request set includes one or more Current serviceable data read request;
    生成与各当前不可服务数据读取请求对应的服务器响应数据,发送各服务器响应数据至与各当前不可服务数据读取请求分别与对应的客户端,将各当前不可服务数据读取请求对应的线程从线程池中释放;Generate server response data corresponding to each currently unserviceable data read request, send each server response data to the corresponding client with each currently unserviceable data read request, and transfer the thread corresponding to each currently unserviceable data read request Release from the thread pool;
    获取各当前可服务数据读取请求对应的数据请求量,根据预先设置的内存空间分配策略获取各当前可服务数据读取请求对应的内存分配值;Obtain the data request amount corresponding to each current serviceable data read request, and obtain the memory allocation value corresponding to each current serviceable data read request according to the preset memory space allocation strategy;
    判断是否有当前可服务数据读取请求对应的内存分配值小于当前可服务数据读取请求对应的数据请求量;以及Determine whether the memory allocation value corresponding to the current serviceable data read request is less than the data request amount corresponding to the current serviceable data read request; and
    若有当前可服务数据读取请求对应的内存分配值小于当前可服务数据读取请求对应的数据请求量,根据该当前可服务数据读取请求对应的内存分配值发送对应的服务器响应数据至对应的目标用户端。If the memory allocation value corresponding to the current serviceable data read request is less than the data request amount corresponding to the current serviceable data read request, the corresponding server response data is sent to the corresponding server according to the memory allocation value corresponding to the current serviceable data read request The target client.
  19. 根据权利要求18所述的计算机可读存储介质,其中,所述数据请求量存储于区块链中,所述将各数据读取请求对应的线程加入线程池,获取数据读取请求对应的请求总个数以及各数据读取请求对应的数据请求量,包括:The computer-readable storage medium according to claim 18, wherein the data request amount is stored in a blockchain, and the thread corresponding to each data read request is added to the thread pool to obtain the request corresponding to the data read request The total number and the amount of data requests corresponding to each data read request, including:
    将各用户端的数据读取请求根据请求接收时间依序存储于线程池中;其中,每一数据读取请求对应启动一个线程;The data read requests of each client are sequentially stored in the thread pool according to the request receiving time; among them, each data read request starts a thread correspondingly;
    根据线程池中存储的数据读取请求,解析获取数据读取请求对应的请求总个数,以及解析获取各数据读取请求对应的数据请求量;其中,所述数据请求量为数据待占用内存的空间值;所述数据读取请求中包括请求次数、请求数据类型列表、及数据时间范围。According to the data read request stored in the thread pool, analyze the total number of requests corresponding to the data read request, and analyze the data request amount corresponding to each data read request; wherein the data request amount is the memory to be occupied by the data The spatial value of; the data read request includes the number of requests, the list of requested data types, and the data time range.
  20. 根据权利要求19所述的计算机可读存储介质,其中,所述解析获取数据读取请求对应的请求总个数,以及解析获取各数据读取请求对应的数据请求量,包括:The computer-readable storage medium according to claim 19, wherein the analyzing and obtaining the total number of requests corresponding to the data reading request and analyzing and obtaining the data request amount corresponding to each data reading request comprises:
    获取预先存储的哈希表;其中,所述哈希表中存储有多种数据类别,和与多种数据类别中每一数据类别一一对应的单条数据大小值;Obtain a pre-stored hash table; wherein multiple data categories are stored in the hash table, and a single data size value corresponding to each data category of the multiple data categories one-to-one;
    获取各数据读取请求分别对应的数据类别;Obtain the data category corresponding to each data read request;
    在所述哈希表中查询获取各数据类别对应的单条数据大小值,以对应计算各数据读取请求对应的数据请求量。The hash table is queried to obtain the size value of a single piece of data corresponding to each data category, so as to correspondingly calculate the data request amount corresponding to each data reading request.
PCT/CN2020/103947 2020-04-28 2020-07-24 Time series data segmentation construction method and apparatus, computer device, and storage medium WO2021217916A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202010351304.8A CN111638949A (en) 2020-04-28 2020-04-28 Time series data segmentation construction method and device and computer equipment
CN202010351304.8 2020-04-28

Publications (1)

Publication Number Publication Date
WO2021217916A1 true WO2021217916A1 (en) 2021-11-04

Family

ID=72329861

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/103947 WO2021217916A1 (en) 2020-04-28 2020-07-24 Time series data segmentation construction method and apparatus, computer device, and storage medium

Country Status (2)

Country Link
CN (1) CN111638949A (en)
WO (1) WO2021217916A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116298737A (en) * 2023-05-24 2023-06-23 广东电网有限责任公司佛山供电局 Switch cabinet discharge monitoring system, method and equipment

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115168056B (en) * 2022-09-02 2022-12-02 深圳华锐分布式技术股份有限公司 Information processing method, device, equipment and medium based on resource allocation
CN117170821B (en) * 2023-11-01 2024-02-09 建信金融科技有限责任公司 Service processing method, device, electronic equipment and computer readable medium

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20070174839A1 (en) * 2006-01-24 2007-07-26 Ruriko Takahashi Method and system for managing programs within systems
CN102446139A (en) * 2011-11-14 2012-05-09 奇智软件(北京)有限公司 Method and device for data storage
CN104408088A (en) * 2014-11-11 2015-03-11 北京奇虎科技有限公司 Control method and device for concurrent requests
CN108845869A (en) * 2018-05-31 2018-11-20 中国平安人寿保险股份有限公司 Concurrent request control method, device, computer equipment and storage medium
CN109561133A (en) * 2018-10-23 2019-04-02 深圳壹账通智能科技有限公司 Method for processing business, device, equipment and computer readable storage medium
US20200034214A1 (en) * 2019-10-02 2020-01-30 Juraj Vanco Method for arbitration and access to hardware request ring structures in a concurrent environment

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20070174839A1 (en) * 2006-01-24 2007-07-26 Ruriko Takahashi Method and system for managing programs within systems
CN102446139A (en) * 2011-11-14 2012-05-09 奇智软件(北京)有限公司 Method and device for data storage
CN104408088A (en) * 2014-11-11 2015-03-11 北京奇虎科技有限公司 Control method and device for concurrent requests
CN108845869A (en) * 2018-05-31 2018-11-20 中国平安人寿保险股份有限公司 Concurrent request control method, device, computer equipment and storage medium
CN109561133A (en) * 2018-10-23 2019-04-02 深圳壹账通智能科技有限公司 Method for processing business, device, equipment and computer readable storage medium
US20200034214A1 (en) * 2019-10-02 2020-01-30 Juraj Vanco Method for arbitration and access to hardware request ring structures in a concurrent environment

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116298737A (en) * 2023-05-24 2023-06-23 广东电网有限责任公司佛山供电局 Switch cabinet discharge monitoring system, method and equipment
CN116298737B (en) * 2023-05-24 2023-08-01 广东电网有限责任公司佛山供电局 Switch cabinet discharge monitoring system, method and equipment

Also Published As

Publication number Publication date
CN111638949A (en) 2020-09-08

Similar Documents

Publication Publication Date Title
WO2021217916A1 (en) Time series data segmentation construction method and apparatus, computer device, and storage medium
JP5664098B2 (en) Composite event distribution apparatus, composite event distribution method, and composite event distribution program
US9304809B2 (en) Systems and methods for event stream processing
CN106302565B (en) Scheduling method and system of service server
CN107819797B (en) Access request processing method and device
CN106230997B (en) Resource scheduling method and device
US8850022B2 (en) Adjustment of end user response times according to user expectations for server applications under load
US20200104177A1 (en) Resource allocation system, management device, method, and program
US9792231B1 (en) Computer system for managing I/O metric information by identifying one or more outliers and comparing set of aggregated I/O metrics
US20180196603A1 (en) Memory Management Method, Apparatus, and System
WO2014194869A1 (en) Request processing method, device and system
US9647905B1 (en) System and method for optimized management of statistics counters, supporting lock-free updates, and queries for any to-the-present time interval
JP2009110347A (en) Resource management system, resource management device, and method thereof
EP4002115A1 (en) Resource allocation method and resource offloading method
JP2022549055A (en) NODE RATE LIMITING METHOD, APPARATUS, ELECTRONIC DEVICE AND STORAGE MEDIUM
CN111177513A (en) Method and device for determining abnormal access address, electronic equipment and storage medium
CN110750498B (en) Object access method, device and storage medium
CN110909978A (en) Resource processing method, device, server and computer readable storage medium
US10282245B1 (en) Root cause detection and monitoring for storage systems
US9893972B1 (en) Managing I/O requests
US20150079966A1 (en) Methods for facilitating telecommunication network administration and devices thereof
US10223189B1 (en) Root cause detection and monitoring for storage systems
CN111488373A (en) Method and system for processing request
WO2022134806A1 (en) Hotspot key determination method and apparatus, and device and storage medium
US9509797B1 (en) Client communication over fibre channel using a block device access model

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 20933034

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 160223)

122 Ep: pct application non-entry in european phase

Ref document number: 20933034

Country of ref document: EP

Kind code of ref document: A1