WO2020252896A1 - 基于hash表的全链路数据采样方法、装置、设备及存储介质 - Google Patents
基于hash表的全链路数据采样方法、装置、设备及存储介质 Download PDFInfo
- Publication number
- WO2020252896A1 WO2020252896A1 PCT/CN2019/102472 CN2019102472W WO2020252896A1 WO 2020252896 A1 WO2020252896 A1 WO 2020252896A1 CN 2019102472 W CN2019102472 W CN 2019102472W WO 2020252896 A1 WO2020252896 A1 WO 2020252896A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- hash table
- service request
- operation name
- initial
- requests
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Ceased
Links
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L43/00—Arrangements for monitoring or testing data switching networks
- H04L43/02—Capturing of monitoring data
- H04L43/022—Capturing of monitoring data by sampling
- H04L43/024—Capturing of monitoring data by sampling by adaptive sampling
Definitions
- This application relates to the field of monitoring process improvement, and in particular to a hash table-based link data sampling method, device, equipment and storage medium.
- microservice architecture With the popularity of microservice architecture, services are split according to different dimensions, and a request often involves multiple services.
- Internet applications are built on different sets of software modules. These software modules may be developed by different teams, may be implemented in different programming languages, may be distributed on thousands of servers, spanning multiple different data center. Therefore, some tools that can help understand system behavior and analyze performance problems are needed so that when a failure occurs, the problem can be quickly located and resolved. Full-link monitoring came into being under the background of such problems.
- the sampling rate of full link monitoring is sampled by percentage, for example, one percent, one sample per 100 requests.
- the inventor realizes that this will cause a relatively big problem. If the calling frequency of a certain service is relatively low , It may not be sampled, only full sampling or increase the sampling frequency, but this will reduce business performance, consume network bandwidth and reduce the performance of the monitoring system.
- the main purpose of this application is to solve the technical problem that service requests in the full-link monitoring system use a global sampling frequency, resulting in some services not being sampled, and increasing the global sampling frequency will reduce service performance, consume network bandwidth, and reduce the technical problem of monitoring system performance.
- the first aspect of the present application provides a full-link data sampling method based on a hash table, which includes: initializing a hash table at the call chain entry, the key of the hash table is the name of the business operation, and The value of the hash table includes the number of initial service requests and the number of initial sampling; it is determined whether the operation name of the received service request exists in the service operation name of the hash table; if the received service exists in the service operation name of the hash table For the requested operation name, adjust the number of initial service requests of the hash table to obtain the number of target service requests; determine whether the number of target service requests of the hash table is greater than or equal to the initial sampling times of the hash table; if the hash table The target service request times of the table are greater than or equal to the initial sampling times of the hash table, then the received service requests are collected.
- the second aspect of the present application provides a full-link data sampling device based on a hash table, including: an initialization unit, configured to initialize a hash table at the entry of the call chain, the keys of the hash table are business operation names, and the The value of the hash table includes the number of initial service requests and the number of initial sampling; the first judgment unit is used to judge whether the operation name of the received service request exists in the service operation name of the hash table; the first processing unit, if the hash If the operation name of the received service request exists in the service operation name of the table, it is used to adjust the initial service request times of the hash table to obtain the target service request times; the second judgment unit is used to judge the hash table Whether the number of target service requests is greater than or equal to the initial sampling times of the hash table; the collecting unit, if the number of target service requests of the hash table is greater than or equal to the initial sampling times of the hash table, is used to collect the received Business request.
- an initialization unit configured to initialize
- the third aspect of the present application provides a full-link data sampling device based on a hash table, including: a memory and at least one processor, the memory stores instructions, and the memory and the at least one processor are interconnected by wires The at least one processor invokes the instructions in the memory, so that the hash table-based full-link data sampling device executes the method described in the first aspect.
- the fourth aspect of the present application provides a computer-readable storage medium, the computer-readable storage medium stores computer instructions, and when the computer instructions run on a computer, the computer executes the above-mentioned first aspect method.
- a hash table is initialized at the call chain entry, the key of the hash table is the name of the business operation, and the value of the hash table includes the number of initial business requests and the number of initial sampling; determining the hash table Whether there is the operation name of the received business request in the business operation name of the hash table; if the operation name of the received business request exists in the business operation name of the hash table, adjust the number of initial service requests of the hash table, Obtain the number of target service requests; determine whether the number of target service requests of the hash table is greater than or equal to the initial sampling times of the hash table; if the number of target service requests of the hash table is greater than or equal to the initial sampling times of the hash table , Then collect the received service request.
- the name of the business operation, the number of initial business requests, and the number of initial samplings are set based on the hash table, the number of target business requests is obtained according to the business request, and the number of target business requests and initial sampling times are compared to determine whether to collect the business Request to realize custom sampling of full link data and improve the performance of the full link monitoring system.
- FIG. 1 is a schematic diagram of an embodiment of a full-link data sampling method based on a hash table in an embodiment of the application;
- FIG. 2 is a schematic diagram of another embodiment of a full-link data sampling method based on a hash table in an embodiment of the application;
- FIG. 3 is a schematic diagram of an embodiment of a full-link data sampling device based on a hash table in an embodiment of the application;
- Figure 4 is a schematic diagram of another embodiment of a full-link data sampling device based on a hash table in an embodiment of the application;
- Fig. 5 is a schematic diagram of another embodiment of a full-link data sampling device based on a hash table in an embodiment of the application.
- the embodiment of the application provides a full-link data sampling method, device, device, and storage medium based on a hash table, which are used to set the business operation name, the number of initial business requests, and the number of initial samplings based on the hash table, according to the business request Obtain the number of target service requests, compare the number of target service requests with the initial sampling times, determine whether to collect service requests, and implement custom sampling of full link data.
- the entire link data is sampled, and a fine-grained custom sampling strategy is designed according to the service call frequency.
- This custom sampling strategy uses full sampling and increased sampling frequency for services with low call frequency, and the call frequency is high Different sampling frequencies are set for the business to improve the performance of the full-link monitoring system.
- An embodiment of the full-link data sampling method based on the hash table in the embodiment of the present application includes:
- the key of the hash table is the name of the business operation, and the value of the hash table includes the number of initial business requests and the number of initial samples;
- the server initializes a hash table at the call chain entry, the key of the hash table is the name of the business operation, the value of the hash table includes the number of initial business requests and the number of initial sampling, and the initial values of the number of initial business requests are all 0.
- the server calls a preset hash table at the entry of the call chain, and the hash table includes keys and values.
- the keys and values of the hash table can be dynamically expanded.
- the hash table is a data structure that is directly accessed based on the key code value key and value, that is, it accesses the record by mapping the key code value to a position in the table To speed up the search. This mapping function is called a hash function, and the array storing records is called a hash table.
- the server sets the business operation name, the number of initial business requests, and the initial sampling times according to the business call frequency.
- the server uses the configured business operation name as the key of the hash table through the configuration file, and uses the set initial business request times and initial sampling times as the hash
- the value of the table, the initial sampling times is equal to 1 for full sampling.
- the business operation name can be preset according to the actual business operation
- the initial number of business requests is a record of the number of times the user operates the business within the range of sampling times.
- the initial sampling frequency refers to the period during which the server collects service requests.
- the initial sampling frequency corresponds to the service operation name.
- the initial sampling frequency is preset according to the actual service.
- the initial sampling times is set to 100.
- the server collects service request data; for services where the amount of service requests is very low, important, and requests are abnormal or timed out, such as user login
- the initial sampling frequency can be set to 1, that is, the full sampling mode.
- the business request is collected once to ensure that valuable information is tracked. The specifics are not limited here.
- a request for a complete call chain is a distributed topology interface. It is judged whether it is the call chain entry according to the request. If the front end initiates the request, then the call chain entry is the front end; if it is a request initiated by a distributed component, then the call chain The entrance is the distributed component, which is not limited here.
- the server judges whether the operation name of the received service request exists in the service operation name of the hash table; specifically, the server receives the service request, and the service request includes request parameters; the server parses the request parameters according to a preset algorithm to obtain the operation of the received service request Name; the server queries the hash table according to the operation name of the received business request, and obtains the query result; if the query result is not empty, it determines that the operation name of the received business request exists in the business operation name of the hash table; if the query result is empty, It is determined that the operation name of the received service request does not exist in the service operation name of the hash table.
- the server adjusts the initial service request times of the hash table to obtain the target service request times. Specifically, the server adds 1 to the number of initial business requests for the hash table according to the business operation name of the hash table. For example, the original value of the initial business request times for the hash table is 0. When the server compares the hash table with the business operation name of the hash table The number of initial service requests is incremented by 1, and the number of target service requests in the corresponding hash table is 1.
- the server is based on the operation name of the service request and the preset sampling frequency Write to the hash table and dynamically expand the hash table to facilitate the unified maintenance of the hash table and realize the control of custom sampling frequency.
- the server determines whether the number of target service requests of the hash table is greater than or equal to the initial sampling times of the hash table. Specifically, the server queries the hash table according to the business operation name of the hash table to obtain the target business request times of the hash table and the initial sampling times of the hash table. The server makes a difference based on the target business request times of the hash table and the initial sampling times of the hash table. Operate to obtain the calculation result. If the calculation result is greater than or equal to 0, the number of target service requests in the hash table is greater than or equal to the initial sampling frequency of the hash table; if the calculation result is less than 0, the number of target service requests in the hash table is less than that of the hash table Initial sampling times.
- the sampling times of the hash table is 100. If the number of service requests for the hash table is 100, the server determines that the number of service requests for the hash table is greater than or equal to the number of sampling times for the hash table; if the number of service requests for the hash table is 99, the server It is determined that the number of service requests for the hash table is less than the sampling times of the hash table, and sampling is not performed.
- the server collects the received service request. Further, after the server collects the service request, it also sets the number of target service requests in the hash table to 0 according to the operation name of the service request.
- the number of target service requests in the hash table must be set to 0 to facilitate the sampling of the next service request.
- the full link data is collected periodically, and then Realize a custom sampling strategy for full link data.
- the name of the business operation, the number of initial business requests, and the number of initial samplings are set based on the hash table, the number of target business requests is obtained according to the business request, and the number of target business requests and initial sampling times are compared to determine whether to collect the business Request, realize the custom sampling of the whole link data.
- the entire link data is sampled, and a fine-grained custom sampling strategy is designed according to the service call frequency.
- This custom sampling strategy uses full sampling and increased sampling frequency for services with low call frequency, and the call frequency is high Different sampling frequencies are set for the business to improve the performance of the full-link monitoring system.
- another embodiment of the full-link data sampling method based on the hash table in the embodiment of the present application includes:
- the hash table includes keys and values
- the server calls the preset hash table at the call chain entry.
- the hash table includes keys and values.
- the keys and values of the hash table can be dynamically expanded.
- the hash table is directly accessed according to the key code values key and value.
- the data structure that is, it accesses the record by mapping the key value to a location in the table to speed up the search. This mapping function is called a hash function, and the array storing records is called a hash table.
- a request for a complete call chain is a distributed topology interface. It is judged whether it is the call chain entry according to the request. If the front end initiates the request, then the call chain entry is the front end; if it is a request initiated by a distributed component, then the call chain The entrance is the distributed component, which is not limited here.
- the server sets the business operation name, the number of initial business requests, and the initial sampling times according to the business call frequency.
- the server uses the configured business operation name as the key of the hash table through the configuration file, and uses the set initial business request times and initial sampling times as the hash
- the value of the table, the initial sampling frequency is equal to 1 for full sampling, and the initial value of the initial service request frequency is all 0.
- the business operation name can be preset according to the actual business operation
- the initial number of business requests is a record of the number of times the user operates the business within the range of sampling times.
- the initial sampling frequency refers to the period during which the server collects service requests.
- the initial sampling frequency corresponds to the service operation name.
- the initial sampling frequency is preset according to the actual service. For example, for a service with a high request volume or a low load, you can The initial sampling frequency is set to 100.
- the server collects service request data; for services where the volume of service requests is very low, important, and requests are abnormal or timed out, such as user login
- the initial sampling times can be set to 1, that is, full sampling mode. Business requests are collected once to ensure that valuable information is tracked. The specifics are not limited here.
- the server receives the service request of the call chain.
- the service request includes request parameters.
- the server parses the request parameters according to a preset algorithm to obtain the operation name of the received service request.
- the server identifies the hash table according to the operation name of the received service request.
- the naming rule of the operation name of the received business request is consistent with the naming rule of the business operation name of the hash table and the business operation name of the hash table set through the configuration file, and the naming rule can accurately express or identify the business operation
- the server uses the service request names userlogin and userlogout to indicate the service operation requests for the user to log in to the system and the user to log out of the system, respectively. Login and logout can also be used for identification, and the specifics are not limited here.
- the server judges whether the operation name of the received business request exists in the business operation name of the hash table. Specifically, the server queries the hash table according to the operation name of the received business request, and obtains the query result. If the query result is empty, it determines the hash table The operation name of the received business request exists in the business operation name; if the query result is not empty, it is determined that the operation name of the received business request does not exist in the business operation name of the hash table.
- sampling is performed according to the preset sampling frequency
- the server performs sampling according to the preset sampling frequency.
- the preset sampling frequency is global.
- the preset sampling frequency is a percentage. One means that one hundred business requests are collected per unit time.
- the server sets the business operation name as a key, sets the preset sampling frequency and the number of business requests to the value of the business operation name, writes it into the hash table, dynamically expands and maintains the hash table. Customize the sampling frequency for a business request to form a fine-grained sampling frequency.
- the server adjusts the initial business request times of the hash table to obtain the target business request times. Specifically, the server adds 1 to the number of initial business requests for the hash table according to the business operation name of the hash table. For example, the original value of the initial business request times for the hash table is 0.
- the server compares the hash table with the business operation name of the hash table The number of initial service requests is incremented by 1, and the number of target service requests in the corresponding hash table is 1.
- the server determines whether the number of target service requests of the hash table is greater than or equal to the initial sampling times of the hash table. Specifically, the server queries the hash table according to the business operation name of the hash table to obtain the target business request times of the hash table and the initial sampling times of the hash table. The server makes a difference based on the target business request times of the hash table and the initial sampling times of the hash table. Operate to obtain the calculation result. If the calculation result is greater than or equal to 0, the number of target service requests in the hash table is greater than or equal to the initial sampling frequency of the hash table; if the calculation result is less than 0, the number of target service requests in the hash table is less than that of the hash table Initial sampling times.
- the initial sampling frequency of the hash table is 100. If the target service request frequency of the hash table is 100, the server determines that the target service request frequency of the hash table is greater than or equal to the initial sampling frequency of the hash table; if the target service request frequency of the hash table is If it is 99, the server determines that the number of target service requests of the hash table is less than the initial sampling times of the hash table.
- the server collects the received service requests.
- the server collects the service request and sends the monitoring data of the service request.
- the service request generates a global link identification traceid, through which the entire call chain can be connected in series.
- a traceid represents a call chain request. Different service requests correspond to different The traceid will be transmitted in the entire calling network of the service request.
- the server collects the service request, it also sets the number of target service requests in the hash table to 0 according to the operation name of the service request. It should be noted that after each service request is collected by the server, the number of target service requests in the hash table must be set to 0 to facilitate the sampling of the next service request.
- the server discards the received service request. Specifically, the server waits for the next service request, and repeats the above steps 203 to 209.
- the name of the business operation, the number of initial business requests, and the number of initial samplings are set based on the hash table, and the number of target business requests and the initial sampling times are compared to determine whether to collect business requests to realize the full link data Custom sampling.
- the entire link data is sampled, and a fine-grained custom sampling strategy is designed according to the service call frequency.
- This custom sampling strategy uses full sampling and increased sampling frequency for services with low call frequency, and the call frequency is high Different sampling frequencies are set for the business to improve the performance of the full-link monitoring system.
- An embodiment of a full-link data sampling device for a hash table includes:
- the initialization unit 301 is used to initialize a hash table at the entry of the call chain, the key of the hash table is the name of the business operation, and the value of the hash table includes the number of initial business requests and the number of initial sampling;
- the first judging unit 302 is configured to judge whether the operation name of the received service request exists in the service operation name of the hash table;
- the first processing unit 303 if the operation name of the received service request exists in the service operation name of the hash table, it is used to adjust the initial service request times of the hash table to obtain the target service request times;
- the second judgment unit 304 is configured to judge whether the number of target service requests of the hash table is greater than or equal to the initial sampling times of the hash table;
- the collecting unit 305 if the number of target service requests of the hash table is greater than or equal to the initial sampling times of the hash table, is used to collect the received service requests.
- the preset service operation name, service request times, and preset sampling times are set based on the hash table, and the comparison is made based on the service request times and the preset sampling times, so as to realize the automatic data of the whole link.
- the sampling Based on the hash table method, the entire link data is sampled, and a fine-grained custom sampling strategy is designed according to the service call frequency.
- the custom sampling strategy uses full sampling and increased sampling frequency for services with low call frequency, and the call frequency is high Different sampling frequencies are set for the business to improve the performance of the full-link monitoring system.
- FIG. 4 another embodiment of a full-link data sampling device based on a hash table in an embodiment of the present application includes:
- the initialization unit 301 is used to initialize a hash table at the entry of the call chain, the key of the hash table is the name of the business operation, and the value of the hash table includes the number of initial business requests and the number of initial sampling;
- the first judging unit 302 is configured to judge whether the operation name of the received service request exists in the service operation name of the hash table;
- the first processing unit 303 if the operation name of the received service request exists in the service operation name of the hash table, it is used to adjust the initial service request times of the hash table to obtain the target service request times;
- the second judgment unit 304 is configured to judge whether the number of target service requests of the hash table is greater than or equal to the initial sampling times of the hash table;
- the collecting unit 305 if the number of target service requests of the hash table is greater than or equal to the initial sampling times of the hash table, is used to collect the received service requests.
- the initialization unit 301 may also be specifically used for:
- the hash table includes keys and values
- the first determining unit 302 may also be specifically configured to:
- the service request includes request parameters
- the first processing unit 303 may also be specifically configured to:
- the initial business request times of the hash table are added by 1 according to the operation name of the business request to obtain the target business request times.
- the second determining unit 304 may also be specifically configured to:
- the full-link data sampling device based on the hash table may further include:
- the second processing unit 306 is configured to perform sampling according to the preset sampling frequency if the operation name of the received service request does not exist in the service operation name of the hash table.
- the full-link data sampling device based on the hash table may further include:
- the clearing unit 307 is configured to set the number of service requests of the hash table to 0 according to the operation name of the service request.
- the name of the business operation, the number of initial business requests, and the number of initial sampling are set based on the hash table, the number of target business requests is obtained according to the business request, and the number of target business requests and the initial sampling number are compared to determine whether to collect the business Request, realize the custom sampling of the whole link data.
- the entire link data is sampled, and a fine-grained custom sampling strategy is designed according to the service call frequency.
- This custom sampling strategy uses full sampling and increased sampling frequency for services with low call frequency, and the call frequency is high Set different sampling frequencies for the business to improve the performance of the full-link monitoring system.
- FIG. 5 is a schematic structural diagram of a full-link data sampling device based on a hash table provided by an embodiment of the present application.
- the full-link data sampling device 500 based on a hash table may have relatively large differences due to different configurations or performance. It may include one or more processors (central processing units, CPU) 501 (for example, one or more processors) and a memory 509, and one or more storage media 508 (for example, one or more Storage equipment in Shanghai). Among them, the memory 509 and the storage medium 508 may be short-term storage or persistent storage.
- the program stored in the storage medium 508 may include one or more modules (not shown in the figure), and each module may include a series of instruction operations on the full-link data sampling device based on the hash table. Further, the processor 501 may be configured to communicate with the storage medium 508, and execute a series of instruction operations in the storage medium 508 on the full-link data sampling device 500 based on the hash table.
- the hash table-based full-link data sampling device 500 may also include one or more power supplies 502, one or more wired or wireless network interfaces 503, one or more input and output interfaces 504, and/or, one or more operations System 505, such as Windows Serve, Mac OS X, Unix, Linux, FreeBSD, etc.
- operations System 505 such as Windows Serve, Mac OS X, Unix, Linux, FreeBSD, etc.
- the present application also provides a computer-readable storage medium, which may be a non-volatile computer-readable storage medium.
- the computer-readable storage medium stores computer instructions, and when the computer instructions are executed on the computer, the computer executes the following steps:
- the key of the hash table is the business operation name, and the value of the hash table includes the number of initial business requests and the number of initial sampling;
- the received service request is collected.
- the disclosed system, device, and method may be implemented in other ways.
- the device embodiments described above are only illustrative.
- the division of the units is only a logical function division, and there may be other divisions in actual implementation, for example, multiple units or components can be combined or It can be integrated into another system, or some features can be ignored or not implemented.
- 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 be in electrical, mechanical or other forms.
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Telephonic Communication Services (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
- Computer And Data Communications (AREA)
Abstract
本申请涉及基架运维领域,公开了一种基于hash表的全链路数据采样方法、装置、设备及存储介质。基于hash表的全链路数据采样方法包括:在调用链入口初始化哈希hash表,hash表的键为业务操作名称,hash表的值包括初始业务请求次数和初始采样次数;判断hash表的业务操作名称中是否存在接收的业务请求的操作名称;若hash表的业务操作名称中存在接收的业务请求的操作名称,则调整hash表的初始业务请求次数,得到目标业务请求次数;判断hash表的目标业务请求次数是否大于或者等于hash表的初始采样次数;若hash表的目标业务请求次数大于或者等于hash表的初始采样次数,则采集业务请求。本申请基于hash表的方式对全链路数据进行自定义采样,提高全链路监控系统性能。
Description
本申请要求于2019年6月18日提交中国专利局、申请号为201910524131.2、发明名称为“基于hash表的全链路数据采样方法、装置、设备及存储介质”的中国专利申请的优先权,其全部内容通过引用结合在申请中。
本申请涉及监控流程改进领域,尤其涉及基于hash表的链路数据采样方法、装置、设备及存储介质。
随着微服务架构的流行,服务按照不同的维度进行拆分,一次请求往往需要涉及到多个服务。互联网应用构建在不同的软件模块集上,这些软件模块,有可能是由不同的团队开发、可能使用不同的编程语言来实现、有可能布在了几千台服务器,横跨多个不同的数据中心。因此,就需要一些可以帮助理解系统行为、用于分析性能问题的工具,以便发生故障的时候,能够快速定位和解决问题。全链路监控就在这样的问题背景下产生了。
但是在大流量的生产环境下,全链路监控系统不可能将所有的业务请求全部记录,这就会对请求进行采样,因此可通过设置采样率确定百分之多少的请求会被记录下来,一般是针对全局设置,没有做到精细化设置。
目前全链路监控的采样率采用百分比来采样,比如,百分之一,每100条请求采样1条,发明人意识到这种会造成比较大的问题,如果某个业务的调用频率比较低,很可能不会被采样到,只能全采样或者增加采样频率,但是这样又会降低业务性能、消耗网络带宽以及降低监控系统性能。
发明内容
本申请的主要目的在于解决全链路监控系统中业务请求采用全局采样频率,导致部分业务没有被采样,而增加全局采样频率又会降低业务性能、消耗网络带宽以及降低监控系统性能的技术问题。
为实现上述目的,本申请第一方面提供了一种基于hash表的全链路数据采样方法,包括:在调用链入口初始化哈希hash表,所述hash表的键为业务操作名称,所述hash表的值包括初始业务请求次数和初始采样次数;判断所述hash表的业务操作名称中是否存在接收的业务请求的操作名称;若所述hash表的业务操作名称中存在所述接收的业务请求的操作名称,则调整所述hash表的初始业务请求次数,得到目标业务请求次数;判断所述hash表的目标业务请求次数是否大于或者等于所述hash表的初始采样次数;若所述hash表的目标业务请求次数大于或者等于所述hash表的初始采样次数,则采集所述接收的业务请求。
本申请第二方面提供了一种基于hash表的全链路数据采样装置,包括:初始化单元,用于在调用链入口初始化哈希hash表,所述hash表的键为业务操作名称,所述hash表的值包括初始业务请求次数和初始采样次数;第一判断单元,用于判断所述hash表的业务操作名称中是否存在接收的业务请求的操作名称;第一处理单元,若所述hash表的业务操作名称中存在所述接收的业务请求的操作名称,则用于调整所述hash表的初始业务请求次数,得到目标业务请求次数;第二判断单元,用于判断所述hash表的目标业务请求次数是否大于或者等于所述hash表的初始采样次数;采集单元,若所述hash表的目标业务请求次数大于或者等于所述hash表的初始采样次数,则用于采集所述接收的业务请求。
本申请第三方面提供了一种基于hash表的全链路数据采样设备,包括:存储器和至少一个处理器,所述存储器中存储有指令,所述存储器和所述至少一个处理器通过线路互联;所述至少一个处理器调用所述存储器中的所述指令,以使得所述基于hash表的全链路数据采样设备执行上述第一方面所述的方法。
本申请的第四方面提供了一种计算机可读存储介质,所述计算机可读存储介质中存储有计算机指令,当所述计算机指令在计算机上运行时,使得计算机执行上述第一方面所述的方法。
本申请提供的技术方案中,在调用链入口初始化哈希hash表,所述hash表的键为业务操作名称,所述hash表的值包括初始业务请求次数和初始采样次数;判断所述hash表的业务操作名称中是否存在接收的业务请求的操作名称;若所述hash表的业务操作名称中存在所述接收的业务请求的操作名称,则调整根调整所述hash表的初始业务请求次数,得到目标业务请求次数;判断所述hash表的目标业务请求次数是否大于或者等于所述hash表的初始采样次数;若所述hash表的目标业务请求次数大于或者等于所述hash表的初始采样次数,则采集所述接收的业务请求。本申请实施例中,基于hash表的方式设置业务操作名称、初始业务请求次数和初始采样次数,根据业务请求得到目标业务请求次数,根据目标业务请求次数和初始采样次数进行比较,确定是否采集业务请求,实现对全链路数据的自定义采样,提高全链路监控系统性能。
图1为本申请实施例中基于hash表的全链路数据采样方法的一个实施例示意图;
图2为本申请实施例中基于hash表的全链路数据采样方法的另一个实施例示意图;
图3为本申请实施例中基于hash表的全链路数据采样装置的一个实施例示意图;
图4为本申请实施例中基于hash表的全链路数据采样装置的另一个实施 例示意图;
图5为本申请实施例中基于hash表的全链路数据采样设备的另一个实施例示意图。
本申请实施例提供了一种基于hash表的全链路数据采样方法、装置、设备及存储介质,用于基于hash表的方式设置业务操作名称、初始业务请求次数和初始采样次数,根据业务请求得到目标业务请求次数,根据目标业务请求次数和初始采样次数进行比较,确定是否采集业务请求,实现对全链路数据的自定义采样。基于hash表的方式对全链路数据进行采样,根据业务调用频率设计一种细粒度的自定义采样策略,该自定义采样策略对调用频率低的业务采用全采样和增加采样频率,调用频率高的业务设置不同的采样频率,提高全链路监控系统性能。
为了使本技术领域的人员更好地理解本申请方案,下面将结合本申请实施例中的附图,对本申请实施例进行描述。
本申请的说明书和权利要求书及上述附图中的术语“第一”、“第二”、“第三”、“第四”等(如果存在)是用于区别类似的对象,而不必用于描述特定的顺序或先后次序。应该理解这样使用的数据在适当情况下可以互换,以便这里描述的实施例能够以除了在这里图示或描述的内容以外的顺序实施。此外,术语“包括”或“具有”及其任何变形,意图在于覆盖不排他的包含,例如,包含了一系列步骤或单元的过程、方法、系统、产品或设备不必限于清楚地列出的那些步骤或单元,而是可包括没有清楚地列出的或对于这些过程、方法、产品或设备固有的其它步骤或单元。
为便于理解,下面对本申请实施例的具体流程进行描述,请参阅图1,本申请实施例中基于hash表的全链路数据采样方法的一个实施例包括:
101、在调用链入口初始化哈希hash表,hash表的键为业务操作名称,hash表的值包括初始业务请求次数和初始采样次数;
服务器在调用链入口初始化哈希hash表,该hash表的键为业务操作名称,该hash表的值包括初始业务请求次数和初始采样次数,该初始业务请求次数的初始值全部为0。具体的,服务器在调用链入口调用预设的哈希hash表, hash表包括键和值。该hash表的键和值都是可以动态扩展的,hash表是根据关键码值key和value直接进行访问的数据结构,也就是说,它通过把关键码值映射到表中一个位置来访问记录,以加快查找的速度。这个映射函数叫做哈希函数,存放记录的数组叫做哈希表。
服务器根据业务调用频率设置业务操作名称、初始业务请求次数和初始采样次数,服务器通过配置文件将设置好的业务操作名称作为hash表的键,将设置好的初始业务请求次数和初始采样次数作为hash表的值,该初始采样次数等于1为全采样。其中,业务操作名称可以根据实际业务操作预先设置,初始业务请求次数是在采样次数范围内对用户操作业务次数的记录。初始采样次数是指服务器采集业务请求的周期,初始采样次数和业务操作名称是一一对应的,该初始采样次数根据实际业务预先设置,例如,对于请求量很高或者负载低的业务,可以将其初始采样次数设置为100,当请求次数累计到预置的采样次数值100时,服务器采集业务请求数据;对于业务请求量很低、重要的、请求出现异常或者超时的业务,比如用户登录这种业务操作,为防止遗漏重要信息,可以将初始采样次数设置为1,即全采样模式,业务请求一次采集一次,保证跟踪到有价值的信息,具体此处不做限定。
需要说明的是,一个请求完整的调用链是分布式的拓扑接口,根据请求判断是否为调用链入口,若是前端发起请求,那么调用链入口就是前端;若是分布式组件发起的请求,那么调用链入口就是该分布式组件,具体此处不做限定。
102、判断hash表的业务操作名称中是否存在接收的业务请求的操作名称;
服务器判断hash表的业务操作名称中是否存在接收的业务请求的操作名称;具体的,服务器接收业务请求,该业务请求包括请求参数;服务器根据预置算法解析请求参数,得到接收的业务请求的操作名称;服务器根据接收的业务请求的操作名称查询hash表,得到查询结果;若查询结果不为空,则确定hash表的业务操作名称中存在接收的业务请求的操作名称;若查询结果为空,则确定hash表的业务操作名称中不存在接收的业务请求的操作名称。
103、若hash表的业务操作名称中存在接收的业务请求的操作名称,则调整hash表的初始业务请求次数,得到目标业务请求次数;
若hash表的业务操作名称中存在接收的业务请求的操作名称,则服务器调整hash表的初始业务请求次数,得到目标业务请求次数。具体的,服务器根据hash表的业务操作名称对hash表的初始业务请求次数进行加1,例如,hash表的初始业务请求次数原始值为0,当服务器根据hash表的业务操作名称对hash表的初始业务请求次数进行加1,则相应hash表的目标业务请求次数为1。
需要说明的是,若hash表的业务操作名称中不存在接收的业务请求的操作名称,则根据预置的采样频率进行采样,可选的,服务器根据业务请求的操作名称和预置的采样频率写入hash表中,动态扩展hash表,便于统一维护hash表,实现自定义采样频率的控制。
104、判断hash表的目标业务请求次数是否大于或者等于hash表的初始采样次数;
服务器判断hash表的目标业务请求次数是否大于或者等于hash表的初始采样次数。具体的,服务器根据hash表的业务操作名称查询hash表,得到hash表的目标业务请求次数和hash表的初始采样次数,服务器根据该hash表的目标业务请求次数和hash表的初始采样次数进行差运算,得到计算结果,若计算结果大于或者等于0,则hash表的目标业务请求次数大于或者等于hash表的初始采样次数;若计算结果小于0,则hash表的目标业务请求次数小于hash表的初始采样次数。例如,hash表的采样次数为100,若hash表的业务请求次数为100,则服务器确定hash表的业务请求次数大于或者等于hash表的采样次数;若hash表的业务请求次数为99,则服务器确定hash表的业务请求次数小于hash表的采样次数,不予采样。
105、若hash表的目标业务请求次数大于或者等于hash表的初始采样次数,则采集接收的业务请求。
若hash表的目标业务请求次数大于或者等于hash表的初始采样次数,则服务器采集该接收的业务请求。进一步的,服务器采集业务请求后,还要根据该业务请求的操作名称设置hash表的目标业务请求次数为0。
需要说明的是,服务器每次采集业务请求后,都要设置hash表的目标业务请求次数为0,便于进行下一次业务请求的采样,通过该设置,对全链路数 据进行周期性采集,进而实现一种全链路数据的自定义采样策略。
本申请实施例中,基于hash表的方式设置业务操作名称、初始业务请求次数和初始采样次数,根据业务请求得到目标业务请求次数,根据目标业务请求次数和初始采样次数进行比较,确定是否采集业务请求,实现对全链路数据的自定义采样。基于hash表的方式对全链路数据进行采样,根据业务调用频率设计一种细粒度的自定义采样策略,该自定义采样策略对调用频率低的业务采用全采样和增加采样频率,调用频率高的业务设置不同的采样频率,提高全链路监控系统性能。
请参阅图2,本申请实施例中基于hash表的全链路数据采样方法的另一个实施例包括:
201、在调用链入口调用预设的哈希hash表,hash表包括键和值;
服务器在调用链入口调用预设的哈希hash表,该hash表包括键和值,该hash表的键和值都是可以动态扩展的,hash表是根据关键码值key和value直接进行访问的数据结构,也就是说,它通过把关键码值映射到表中一个位置来访问记录,以加快查找的速度。这个映射函数叫做哈希函数,存放记录的数组叫做哈希表。
需要说明的是,一个请求完整的调用链是分布式的拓扑接口,根据请求判断是否为调用链入口,若是前端发起请求,那么调用链入口就是前端;若是分布式组件发起的请求,那么调用链入口就是该分布式组件,具体此处不做限定。
202、通过配置文件将设置好的业务操作名称作为hash表的键,将设置好的初始业务请求次数和初始采样次数作为hash表的值;
服务器根据业务调用频率设置业务操作名称、初始业务请求次数和初始采样次数,服务器通过配置文件将设置好的业务操作名称作为hash表的键,将设置好的初始业务请求次数和初始采样次数作为hash表的值,该初始采样次数等于1为全采样,该初始业务请求次数的初始值全部为0。
其中,业务操作名称可以根据实际业务操作预先设置,初始业务请求次数是在采样次数范围内对用户操作业务次数的记录。初始采样次数是指服务器采集业务请求的周期,初始采样次数和业务操作名称是一一对应的,该初始采样次数根据实际业务预先设置,例如,对于请求量很高或者负载低的业务,可以 将其初始采样次数设置为100,当业务请求次数累计到初始采样次数值100时,服务器采集业务请求数据;对于业务请求量很低、重要的、请求出现异常或者超时的业务,比如用户登录这种业务操作,为防止遗漏重要信息,可以将初始采样次数设置为1,即全采样模式,业务请求一次采集一次,保证跟踪到有价值的信息,具体此处不做限定。
203、接收业务请求,得到接收的业务请求的操作名称;
服务器接收调用链的业务请求,该业务请求包括请求参数,服务器根据预置算法解析该请求参数,得到接收的业务请求的操作名称,服务器根据接收的业务请求的操作名称识别hash表。
需要说明的是,该接收的业务请求的操作名称的命名规则与通过配置文件设置的hash表的业务操作名称以及hash表的业务操作名称的命名规则保持一致,命名规则能准确表述或者标识业务操作,例如,服务器使用业务请求名称userlogin和userlogout分别表示用户登录系统和用户退出系统的业务操作请求,也可以使用login和logout进行标识,具体此处不做限定。
204、判断hash表的业务操作名称中是否存在接收的业务请求的操作名称;
服务器判断hash表的业务操作名称中是否存在接收的业务请求的操作名称,具体的,服务器根据接收的业务请求的操作名称查询hash表,得到查询结果,若查询结果为空,则确定hash表的业务操作名称中存在接收的业务请求的操作名称;若查询结果不为空,则确定hash表的业务操作名称中不存在接收的业务请求的操作名称。
205、若hash表的业务操作名称中不存在接收的业务请求的操作名称,则根据预置的采样频率进行采样;
若hash表的业务操作名称中不存在接收的业务请求的操作名称,则服务器根据预置的采样频率进行采样,该预置的采样频率是全局的,例如,该预置的采样频率为百分之一,表示在单位时间内,业务请求一百次,采集一次。
可选的,服务器将该业务操作名称设置为键,将预置的采样频率和业务请求次数设置为该业务操作名称的值,写入hash表,动态扩展以及维护该hash表,则可以对每一个业务请求都进行采样频率的自定义,形成一种细粒度的采 样频率。
206、若hash表的业务操作名称中存在接收的业务请求的操作名称,则调整hash表的初始业务请求次数,得到目标业务请求次数;
若hash表的业务操作名称中存在接收的业务请求的业务操作名称,则服务器调整hash表的初始业务请求次数,得到目标业务请求次数。具体的,服务器根据hash表的业务操作名称对hash表的初始业务请求次数进行加1,例如,hash表的初始业务请求次数原始值为0,当服务器根据hash表的业务操作名称对hash表的初始业务请求次数进行加1,则相应hash表的目标业务请求次数为1。
207、判断hash表的目标业务请求次数是否大于或者等于hash表的初始采样次数;
服务器判断hash表的目标业务请求次数是否大于或者等于hash表的初始采样次数。具体的,服务器根据hash表的业务操作名称查询hash表,得到hash表的目标业务请求次数和hash表的初始采样次数,服务器根据该hash表的目标业务请求次数和hash表的初始采样次数进行差运算,得到计算结果,若计算结果大于或者等于0,则hash表的目标业务请求次数大于或者等于hash表的初始采样次数;若计算结果小于0,则hash表的目标业务请求次数小于hash表的初始采样次数。例如,hash表的初始采样次数为100,若hash表的目标业务请求次数为100,则服务器确定hash表的目标业务请求次数大于或者等于hash表的初始采样次数;若hash表的目标业务请求次数为99,则服务器确定hash表的目标业务请求次数小于hash表的初始采样次数。
208、若hash表的目标业务请求次数大于或者等于hash表的初始采样次数,则采集接收的业务请求;
若hash表的目标业务请求次数大于或者等于hash表的初始采样次数,则服务器采集接收的业务请求。服务器采集该业务请求,并发送该业务请求的监控数据,该业务请求生成一个全局的链路标识traceid,通过traceid可以串联起整个调用链,一个traceid代表一次调用链请求,不同的业务请求对应不同的traceid,该traceid会在该业务请求的整个调用网络中传递。
进一步的,服务器采集业务请求后,还要根据该业务请求的操作名称设置 hash表的目标业务请求次数为0。需要说明的是,服务器每次采集业务请求后,都要设置hash表的目标业务请求次数为0,便于进行下一次业务请求的采样。
209、若hash表的目标业务请求次数小于hash表的初始采样次数,则丢弃接收的业务请求。
若hash表的目标业务请求次数小于hash表的初始采样次数,则服务器丢弃接收的业务请求。具体的,服务器等待下一次业务请求,重复以上203至209步骤。
本申请实施例中,基于hash表的方式设置业务操作名称、初始业务请求次数和初始采样次数,根据目标业务请求次数和初始采样次数进行比较,确定是否采集业务请求,实现对全链路数据的自定义采样。基于hash表的方式对全链路数据进行采样,根据业务调用频率设计一种细粒度的自定义采样策略,该自定义采样策略对调用频率低的业务采用全采样和增加采样频率,调用频率高的业务设置不同的采样频率,提高全链路监控系统性能。
上面对本申请实施例中基于hash表的全链路数据采样方法进行了描述,下面对本申请实施例中基于hash表的全链路数据采样装置进行描述,请参阅图3,本申请实施例中基于hash表的全链路数据采样装置一个实施例包括:
初始化单元301,用于在调用链入口初始化哈希hash表,hash表的键为业务操作名称,hash表的值包括初始业务请求次数和初始采样次数;
第一判断单元302,用于判断hash表的业务操作名称中是否存在接收的业务请求的操作名称;
第一处理单元303,若hash表的业务操作名称中存在接收的业务请求的操作名称,则用于调整hash表的初始业务请求次数,得到目标业务请求次数;
第二判断单元304,用于判断hash表的目标业务请求次数是否大于或者等于hash表的初始采样次数;
采集单元305,若hash表的目标业务请求次数大于或者等于hash表的初始采样次数,则用于采集接收的业务请求。
本申请实施例中,基于hash表的方式设置预置的业务操作名称、业务请求次数和预置的采样次数,根据业务请求次数和预置的采样次数进行比较,实现对全链路数据的自定义采样。基于hash表的方式对全链路数据进行采样, 根据业务调用频率设计一种细粒度的自定义采样策略,该自定义采样策略对调用频率低的业务采用全采样和增加采样频率,调用频率高的业务设置不同的采样频率,提高全链路监控系统性能。
请参阅图4,本申请实施例中基于hash表的全链路数据采样装置的另一个实施例包括:
初始化单元301,用于在调用链入口初始化哈希hash表,hash表的键为业务操作名称,hash表的值包括初始业务请求次数和初始采样次数;
第一判断单元302,用于判断hash表的业务操作名称中是否存在接收的业务请求的操作名称;
第一处理单元303,若hash表的业务操作名称中存在接收的业务请求的操作名称,则用于调整hash表的初始业务请求次数,得到目标业务请求次数;
第二判断单元304,用于判断hash表的目标业务请求次数是否大于或者等于hash表的初始采样次数;
采集单元305,若hash表的目标业务请求次数大于或者等于hash表的初始采样次数,则用于采集接收的业务请求。
可选的,初始化单元301还可以具体用于:
在调用链入口调用预设的哈希hash表,hash表包括键和值;
通过配置文件将设置好的业务操作名称作为hash表的键,将设置好的初始业务请求次数和初始采样次数作为hash表的值。
可选的,第一判断单元302还可以具体用于:
接收业务请求,业务请求包括请求参数;
解析请求参数,得到接收的业务请求的操作名称;
根据接收的业务请求的操作名称查询hash表,得到查询结果;
若查询结果不为空,则确定hash表的业务操作名称中存在接收的业务请求的操作名称;
若查询结果为空,则确定hash表的业务操作名称中不存在接收的业务请求的操作名称。
可选的,第一处理单元303还可以具体用于:
若hash表的业务操作名称中存在接收的业务请求的操作名称,则根据业 务请求的操作名称对hash表的初始业务请求次数进行加1,得到目标业务请求次数。
可选的,第二判断单元304还可以具体用于:
根据hash表的业务操作名称查询hash表,得到hash表的目标业务请求次数和hash表的初始采样次数;
根据hash表的目标业务请求次数和hash表的初始采样次数进行差运算,得到计算结果;
若计算结果大于或者等于0,则确定hash表的目标业务请求次数大于或者等于hash表的初始采样次数;
若计算结果小于0,则确定hash表的目标业务请求次数小于hash表的初始采样次数。
可选的,基于hash表的全链路数据采样装置还可以进一步包括:
第二处理单元306,若hash表的业务操作名称中不存在接收的业务请求的操作名称,则用于根据预置的采样频率进行采样。
可选的,基于hash表的全链路数据采样装置还可以进一步包括:
清零单元307,用于根据业务请求的操作名称设置hash表的业务请求次数为0。
本申请实施例中,基于hash表的方式设置业务操作名称、初始业务请求次数和初始采样次数,根据业务请求得到目标业务请求次数,根据目的业务请求次数和初始采样次数进行比较,确定是否采集业务请求,实现对全链路数据的自定义采样。基于hash表的方式对全链路数据进行采样,根据业务调用频率设计一种细粒度的自定义采样策略,该自定义采样策略对调用频率低的业务采用全采样和增加采样频率,调用频率高的业务设置不同的采样频率,提高全链路监控系统性能。
上面图3和图4从模块化功能实体的角度对本申请实施例中的基于hash表的全链路数据采样装置进行详细描述,下面从硬件处理的角度对本申请实施例中基于hash表的全链路数据采样设备进行详细描述。
图5是本申请实施例提供的一种基于hash表的全链路数据采样设备的结构示意图,该基于hash表的全链路数据采样设备500可因配置或性能不同而 产生比较大的差异,可以包括一个或一个以上处理器(central processing units,CPU)501(例如,一个或一个以上处理器)和存储器509,一个或一个以上存储应用程序507或数据506的存储介质508(例如一个或一个以上海量存储设备)。其中,存储器509和存储介质508可以是短暂存储或持久存储。存储在存储介质508的程序可以包括一个或一个以上模块(图示没标出),每个模块可以包括对基于hash表的全链路数据采样设备中的一系列指令操作。更进一步地,处理器501可以设置为与存储介质508通信,在基于hash表的全链路数据采样设备500上执行存储介质508中的一系列指令操作。
基于hash表的全链路数据采样设备500还可以包括一个或一个以上电源502,一个或一个以上有线或无线网络接口503,一个或一个以上输入输出接口504,和/或,一个或一个以上操作系统505,例如Windows Serve,Mac OS X,Unix,Linux,FreeBSD等等。本领域技术人员可以理解,图5示出的基于hash表的全链路数据采样设备结构并不构成对基于hash表的全链路数据采样设备的限定,可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件布置。
本申请还提供一种计算机可读存储介质,该计算机可读存储介质可以为非易失性计算机可读存储介质。计算机可读存储介质存储有计算机指令,当所述计算机指令在计算机上运行时,使得计算机执行如下步骤:
在调用链入口初始化哈希hash表,所述hash表的键为业务操作名称,所述hash表的值包括初始业务请求次数和初始采样次数;
判断所述hash表的业务操作名称中是否存在接收的业务请求的操作名称;
若所述hash表的业务操作名称中存在所述接收的业务请求的操作名称,则调整所述hash表的初始业务请求次数,得到目标业务请求次数;
判断所述hash表的目标业务请求次数是否大于或者等于所述hash表的初始采样次数;
若所述hash表的目标业务请求次数大于或者等于所述hash表的初始采样次数,则采集所述接收的业务请求。
所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,上述描述的系统,装置和单元的具体工作过程,可以参考前述方法实施例中的对应过程, 在此不再赘述。
在本申请所提供的几个实施例中,应该理解到,所揭露的系统,装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,所述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。
以上所述,以上实施例仅用以说明本申请的技术方案,而非对其限制;尽管参照前述实施例对本申请进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本申请各实施例技术方案的精神和范围。
Claims (20)
- 一种基于hash表的全链路数据采样方法,包括:在调用链入口初始化哈希hash表,所述hash表的键为业务操作名称,所述hash表的值包括初始业务请求次数和初始采样次数;判断所述hash表的业务操作名称中是否存在接收的业务请求的操作名称;若所述hash表的业务操作名称中存在所述接收的业务请求的操作名称,则调整所述hash表的初始业务请求次数,得到目标业务请求次数;判断所述hash表的目标业务请求次数是否大于或者等于所述hash表的初始采样次数;若所述hash表的目标业务请求次数大于或者等于所述hash表的初始采样次数,则采集所述接收的业务请求。
- 根据权利要求1所述的基于hash表的全链路数据采样方法,所述在调用链入口初始化哈希hash表,所述hash表的键为业务操作名称,所述hash表的值包括初始业务请求次数和初始采样次数包括:在所述调用链入口调用预设的哈希hash表,所述hash表包括键和值;通过配置文件将设置好的业务操作名称作为所述hash表的键,将设置好的初始业务请求次数和初始采样次数作为所述hash表的值。
- 根据权利要求1所述的基于hash表的全链路数据采样方法,所述判断所述hash表的业务操作名称中是否存在接收的业务请求的操作名称包括:接收所述业务请求,所述业务请求包括请求参数;解析所述请求参数,得到所述接收的业务请求的操作名称;根据所述接收的业务请求的操作名称查询所述hash表,得到查询结果;若所述查询结果不为空,则确定所述hash表的业务操作名称中存在所述接收的业务请求的操作名称;若所述查询结果为空,则确定所述hash表的业务操作名称中不存在所述接收的业务请求的操作名称。
- 根据权利要求1所述的基于hash表的全链路数据采样方法,所述若所述hash表的业务操作名称中存在所述接收的业务请求的操作名称,则调整所述hash表的初始业务请求次数,得到目标业务请求次数包括:若所述hash表的业务操作名称中存在所述接收的业务请求的操作名称,则根据所述业务请求的操作名称对所述hash表的初始业务请求次数进行加1,得到目标业务请求次数。
- 根据权利要求1所述的基于hash表的全链路数据采样方法,所述判断所述hash表的目标业务请求次数是否大于或者等于所述hash表的初始采样次数包括:根据所述hash表的业务操作名称查询所述hash表,得到所述hash表的目标业务请求次数和所述hash表的初始采样次数;根据所述hash表的目标业务请求次数和所述hash表的初始采样次数进行差运算,得到计算结果;若所述计算结果大于或者等于0,则确定所述hash表的目标业务请求次数大于或者等于所述hash表的初始采样次数;若所述计算结果小于0,则确定所述hash表的目标业务请求次数小于所述hash表的初始采样次数。
- 根据权利要求1所述的基于hash表的全链路数据采样方法,所述判断所述hash表的业务操作名称中是否存在接收的业务请求的操作名称之后,所述基于hash表的全链路数据采样方法还包括:若所述hash表的业务操作名称中不存在所述接收的业务请求的操作名称,则根据预置的采样频率进行采样。
- 根据权利要求1所述的基于hash表的全链路数据采样方法,所述若所述hash表的目标业务请求次数大于或者等于所述hash表的初始采样次数,则采集所述业务请求之后,所述基于hash表的全链路数据采样方法还包括:根据所述接收的业务请求的操作名称设置所述hash表的目标业务请求次数为0。
- 一种基于hash表的全链路数据采样装置,所述全链路数据采样装置包括:初始化单元,用于在调用链入口初始化哈希hash表,所述hash表的键为业务操作名称,所述hash表的值包括初始业务请求次数和初始采样次数;第一判断单元,用于判断所述hash表的业务操作名称中是否存在接收的业务请求的操作名称;第一处理单元,若所述hash表的业务操作名称中存在所述接收的业务请求的操作名称,则用于调整所述hash表的初始业务请求次数,得到目标业务请求次数;第二判断单元,用于判断所述hash表的目标业务请求次数是否大于或者等于所述hash表的初始采样次数;采集单元,若所述hash表的目标业务请求次数大于或者等于所述hash表的初始采样次数,则用于采集所述接收的业务请求。
- 根据权利要求8所述的基于hash表的全链路数据采样装置,所述初始化单元具体用于:在所述调用链入口调用预设的哈希hash表,所述hash表包括键和值;通过配置文件将设置好的业务操作名称作为所述hash表的键,将设置好的初始业务请求次数和初始采样次数作为所述hash表的值。
- 根据权利要求8所述的基于hash表的全链路数据采样装置,所述第一判断单元具体用于:接收所述业务请求,所述业务请求包括请求参数;解析所述请求参数,得到所述接收的业务请求的操作名称;根据所述接收的业务请求的操作名称查询所述hash表,得到查询结果;若所述查询结果不为空,则确定所述hash表的业务操作名称中存在所述 接收的业务请求的操作名称;若所述查询结果为空,则确定所述hash表的业务操作名称中不存在所述接收的业务请求的操作名称。
- 根据权利要求8所述的基于hash表的全链路数据采样装置,所述第一处理单元具体用于:若所述hash表的业务操作名称中存在所述接收的业务请求的操作名称,则根据所述业务请求的操作名称对所述hash表的初始业务请求次数进行加1,得到目标业务请求次数。
- 根据权利要求8所述的基于hash表的全链路数据采样装置,所述第二判断单元具体用于:根据所述hash表的业务操作名称查询所述hash表,得到所述hash表的目标业务请求次数和所述hash表的初始采样次数;根据所述hash表的目标业务请求次数和所述hash表的初始采样次数进行差运算,得到计算结果;若所述计算结果大于或者等于0,则确定所述hash表的目标业务请求次数大于或者等于所述hash表的初始采样次数;若所述计算结果小于0,则确定所述hash表的目标业务请求次数小于所述hash表的初始采样次数。
- 根据权利要求8所述的基于hash表的全链路数据采样装置,所述基于hash表的全链路数据采样装置还包括:第二处理单元,若所述hash表的业务操作名称中不存在所述接收的业务请求的操作名称,则用于根据预置的采样频率进行采样。
- 根据权利要求8所述的基于hash表的全链路数据采样装置,所述基于hash表的全链路数据采样装置还包括:清零单元,用于根据所述接收的业务请求的操作名称设置所述hash表的 目标业务请求次数为0。
- 一种基于hash表的全链路数据采样设备,包括存储器、处理器及存储在所述存储器上并可在所述处理器上运行的计算机程序,所述处理器执行所述计算机程序时实现如下步骤:在调用链入口初始化哈希hash表,所述hash表的键为业务操作名称,所述hash表的值包括初始业务请求次数和初始采样次数;判断所述hash表的业务操作名称中是否存在接收的业务请求的操作名称;若所述hash表的业务操作名称中存在所述接收的业务请求的操作名称,则调整所述hash表的初始业务请求次数,得到目标业务请求次数;判断所述hash表的目标业务请求次数是否大于或者等于所述hash表的初始采样次数;若所述hash表的目标业务请求次数大于或者等于所述hash表的初始采样次数,则采集所述接收的业务请求。
- 根据权利要求15所述的基于hash表的全链路数据采样设备,所述处理器执行所述计算机程序实现所述在调用链入口初始化哈希hash表,所述hash表的键为业务操作名称,所述hash表的值包括初始业务请求次数和初始采样次数时,包括以下步骤:在所述调用链入口调用预设的哈希hash表,所述hash表包括键和值;通过配置文件将设置好的业务操作名称作为所述hash表的键,将设置好的初始业务请求次数和初始采样次数作为所述hash表的值。
- 根据权利要求15所述的基于hash表的全链路数据采样设备,所述处理器执行所述计算机程序实现所述判断所述hash表的业务操作名称中是否存在接收的业务请求的操作名称时,包括以下步骤:接收所述业务请求,所述业务请求包括请求参数;解析所述请求参数,得到所述接收的业务请求的操作名称;根据所述接收的业务请求的操作名称查询所述hash表,得到查询结果;若所述查询结果不为空,则确定所述hash表的业务操作名称中存在所述接收的业务请求的操作名称;若所述查询结果为空,则确定所述hash表的业务操作名称中不存在所述接收的业务请求的操作名称。
- 根据权利要求15所述的基于hash表的全链路数据采样设备,所述处理器执行所述计算机程序实现所述若所述hash表的业务操作名称中存在所述接收的业务请求的操作名称,则调整所述hash表的初始业务请求次数,得到目标业务请求次数时,包括以下步骤:若所述hash表的业务操作名称中存在所述接收的业务请求的操作名称,则根据所述业务请求的操作名称对所述hash表的初始业务请求次数进行加1,得到目标业务请求次数。
- 根据权利要求15所述的基于hash表的全链路数据采样设备,所述处理器执行所述计算机程序实现所述判断所述hash表的目标业务请求次数是否大于或者等于所述hash表的初始采样次数时,包括以下步骤:根据所述hash表的业务操作名称查询所述hash表,得到所述hash表的目标业务请求次数和所述hash表的初始采样次数;根据所述hash表的目标业务请求次数和所述hash表的初始采样次数进行差运算,得到计算结果;若所述计算结果大于或者等于0,则确定所述hash表的目标业务请求次数大于或者等于所述hash表的初始采样次数;若所述计算结果小于0,则确定所述hash表的目标业务请求次数小于所述hash表的初始采样次数。
- 一种计算机可读存储介质,所述计算机可读存储介质中存储计算机指令,当所述计算机指令在计算机上运行时,使得计算机执行如下步骤:在调用链入口初始化哈希hash表,所述hash表的键为业务操作名称,所 述hash表的值包括初始业务请求次数和初始采样次数;判断所述hash表的业务操作名称中是否存在接收的业务请求的操作名称;若所述hash表的业务操作名称中存在所述接收的业务请求的操作名称,则调整所述hash表的初始业务请求次数,得到目标业务请求次数;判断所述hash表的目标业务请求次数是否大于或者等于所述hash表的初始采样次数;若所述hash表的目标业务请求次数大于或者等于所述hash表的初始采样次数,则采集所述接收的业务请求。
Applications Claiming Priority (2)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201910524131.2 | 2019-06-18 | ||
| CN201910524131.2A CN110401579B (zh) | 2019-06-18 | 2019-06-18 | 基于hash表的全链路数据采样方法、装置、设备及存储介质 |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| WO2020252896A1 true WO2020252896A1 (zh) | 2020-12-24 |
Family
ID=68324159
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| PCT/CN2019/102472 Ceased WO2020252896A1 (zh) | 2019-06-18 | 2019-08-26 | 基于hash表的全链路数据采样方法、装置、设备及存储介质 |
Country Status (2)
| Country | Link |
|---|---|
| CN (1) | CN110401579B (zh) |
| WO (1) | WO2020252896A1 (zh) |
Cited By (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN113986955A (zh) * | 2021-11-01 | 2022-01-28 | 华青融天(北京)软件股份有限公司 | 业务链的确定方法、装置、电子设备及介质 |
| CN115037653A (zh) * | 2022-06-28 | 2022-09-09 | 北京奇艺世纪科技有限公司 | 业务流量监控方法、装置、电子设备和存储介质 |
Families Citing this family (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN111586092A (zh) * | 2020-03-25 | 2020-08-25 | 深圳壹账通智能科技有限公司 | 全链路监控方法、系统及cat客户端 |
| CN111478806B (zh) * | 2020-04-02 | 2022-10-14 | 聚好看科技股份有限公司 | 一种链路追踪采样方法及系统 |
| CN111460510B (zh) * | 2020-04-17 | 2022-04-12 | 支付宝(杭州)信息技术有限公司 | 基于隐私保护确定相同业务数据的方法及装置 |
| CN115580607A (zh) * | 2022-10-13 | 2023-01-06 | 国家体育总局体育彩票管理中心 | 彩票系统链路监控方法、装置及系统 |
Citations (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20160142369A1 (en) * | 2014-11-18 | 2016-05-19 | Alibaba Group Holding Limited | Service addressing in distributed environment |
| CN108183927A (zh) * | 2017-11-22 | 2018-06-19 | 链家网(北京)科技有限公司 | 一种分布式系统中链路调用的监控方法及系统 |
| CN109087055A (zh) * | 2018-06-06 | 2018-12-25 | 北京达佳互联信息技术有限公司 | 业务请求的控制方法和装置 |
| CN109697456A (zh) * | 2018-11-21 | 2019-04-30 | 华为技术有限公司 | 业务分析方法、装置、设备及存储介质 |
Family Cites Families (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US10476629B2 (en) * | 2017-05-02 | 2019-11-12 | Juniper Networks, Inc. | Performing upper layer inspection of a flow based on a sampling rate |
-
2019
- 2019-06-18 CN CN201910524131.2A patent/CN110401579B/zh active Active
- 2019-08-26 WO PCT/CN2019/102472 patent/WO2020252896A1/zh not_active Ceased
Patent Citations (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20160142369A1 (en) * | 2014-11-18 | 2016-05-19 | Alibaba Group Holding Limited | Service addressing in distributed environment |
| CN108183927A (zh) * | 2017-11-22 | 2018-06-19 | 链家网(北京)科技有限公司 | 一种分布式系统中链路调用的监控方法及系统 |
| CN109087055A (zh) * | 2018-06-06 | 2018-12-25 | 北京达佳互联信息技术有限公司 | 业务请求的控制方法和装置 |
| CN109697456A (zh) * | 2018-11-21 | 2019-04-30 | 华为技术有限公司 | 业务分析方法、装置、设备及存储介质 |
Non-Patent Citations (1)
| Title |
|---|
| LIU, XIAXIA ET AL.: "Design of a Full-Stack Monitoring Tool Based on APM", OPERATING SYSTEM, NETWORK SYSTEM AND SERVER TECHNOLOGY, 3 June 2019 (2019-06-03), ISSN: 1009-6833, DOI: 20200306173429A * |
Cited By (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN113986955A (zh) * | 2021-11-01 | 2022-01-28 | 华青融天(北京)软件股份有限公司 | 业务链的确定方法、装置、电子设备及介质 |
| CN113986955B (zh) * | 2021-11-01 | 2024-03-19 | 华青融天(北京)软件股份有限公司 | 业务链的确定方法、装置、电子设备及介质 |
| CN115037653A (zh) * | 2022-06-28 | 2022-09-09 | 北京奇艺世纪科技有限公司 | 业务流量监控方法、装置、电子设备和存储介质 |
| CN115037653B (zh) * | 2022-06-28 | 2023-10-13 | 北京奇艺世纪科技有限公司 | 业务流量监控方法、装置、电子设备和存储介质 |
Also Published As
| Publication number | Publication date |
|---|---|
| CN110401579A (zh) | 2019-11-01 |
| CN110401579B (zh) | 2022-08-23 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| US12212475B1 (en) | Applying updated configuration dynamically to remote capture agents | |
| US12204531B1 (en) | Dynamically modifying remote capture agent event stream destinations | |
| WO2020252896A1 (zh) | 基于hash表的全链路数据采样方法、装置、设备及存储介质 | |
| US10951474B2 (en) | Configuring event stream generation in cloud-based computing environments | |
| US10484250B2 (en) | Systems and methods for determining network configurations using historical and real-time network metrics | |
| US20150295775A1 (en) | Graphical configuration of event streams for network data capture and processing | |
| US20220286373A1 (en) | Scalable real time metrics management | |
| CN108156038B (zh) | 请求分发方法、装置、接入网关及存储介质 | |
| CN111124819A (zh) | 全链路监控的方法和装置 | |
| CN106464584B (zh) | 根据程序设计接口提供路由器信息 | |
| US11178160B2 (en) | Detecting and mitigating leaked cloud authorization keys | |
| CN111278047B (zh) | 非服务小区的csi的处理方法、系统、电子设备和介质 | |
| US12135627B1 (en) | Facilitating management of collection agents | |
| CN107809350A (zh) | 获取http服务器性能数据的方法和装置 | |
| US11902081B1 (en) | Managing collection agents via an agent controller | |
| EP3641222A1 (en) | Method, apparatus and system for monitoring data traffic | |
| US9367418B2 (en) | Application monitoring | |
| CN106100928A (zh) | 应用于数据中心的监控数据的传输方法和装置 | |
| US9521088B2 (en) | Dynamically determining how many network packets to process | |
| CN101533395B (zh) | 一种网络词库查询系统及其方法 | |
| WO2023157052A1 (ja) | 収集装置、収集方法および収集プログラム | |
| WO2025052428A1 (en) | Method and system for de-establishing network protocol connections |
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: 19933768 Country of ref document: EP Kind code of ref document: A1 |
|
| NENP | Non-entry into the national phase |
Ref country code: DE |
|
| 122 | Ep: pct application non-entry in european phase |
Ref document number: 19933768 Country of ref document: EP Kind code of ref document: A1 |