CN110071952B - Service call quantity control method and device - Google Patents

Service call quantity control method and device Download PDF

Info

Publication number
CN110071952B
CN110071952B CN201810068708.9A CN201810068708A CN110071952B CN 110071952 B CN110071952 B CN 110071952B CN 201810068708 A CN201810068708 A CN 201810068708A CN 110071952 B CN110071952 B CN 110071952B
Authority
CN
China
Prior art keywords
upstream service
service
strategy
policy
degradation
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.)
Active
Application number
CN201810068708.9A
Other languages
Chinese (zh)
Other versions
CN110071952A (en
Inventor
朱琳波
刘彧
黄齐辉
孙锦亮
孙悦
王添枝
于强强
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Jingdong Century Trading Co Ltd
Beijing Jingdong Shangke Information Technology Co Ltd
Original Assignee
Beijing Jingdong Century Trading Co Ltd
Beijing Jingdong Shangke Information Technology Co Ltd
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 Beijing Jingdong Century Trading Co Ltd, Beijing Jingdong Shangke Information Technology Co Ltd filed Critical Beijing Jingdong Century Trading Co Ltd
Priority to CN201810068708.9A priority Critical patent/CN110071952B/en
Publication of CN110071952A publication Critical patent/CN110071952A/en
Application granted granted Critical
Publication of CN110071952B publication Critical patent/CN110071952B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L47/00Traffic control in data switching networks
    • H04L47/10Flow control; Congestion control
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L47/00Traffic control in data switching networks
    • H04L47/10Flow control; Congestion control
    • H04L47/20Traffic policing
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/51Discovery or management thereof, e.g. service location protocol [SLP] or web services
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/60Scheduling or organising the servicing of application requests, e.g. requests for application data transmissions using the analysis and optimisation of the required network resources

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Telephonic Communication Services (AREA)

Abstract

本发明公开了一种服务调用量的控制方法和装置,涉及计算机技术领域。该方法的一具体实施方式包括:接收调用本地服务的用户请求;其中,所述本地服务依赖于至少一个上游服务;在所述用户请求正常调用所述本地服务时,利用预先存储的、所述至少一个上游服务中每一上游服务的当前调用量控制策略,确定所述用户请求是否正常调用该上游服务:若是,返回该上游服务的正常调用数据;否则,返回该上游服务的默认数据;根据每一上游服务返回的正常调用数据或默认数据生成响应信息向用户返回。该实施方式能够利用预先存储的每一上游服务的当前调用量控制策略,自动控制上游服务调用量,从而实现上游服务的自动降级或自动恢复。

The invention discloses a method and device for controlling the amount of service calls, and relates to the technical field of computers. A specific implementation of the method includes: receiving a user request to call a local service; wherein the local service depends on at least one upstream service; when the user requests to call the local service normally, using the pre-stored, the The current invocation volume control policy of each upstream service in at least one upstream service determines whether the user request calls the upstream service normally: if yes, returns the normal invocation data of the upstream service; otherwise, returns the default data of the upstream service; according to The normal call data or default data returned by each upstream service generates response information and returns it to the user. This embodiment can use the pre-stored current call volume control policy of each upstream service to automatically control the call volume of the upstream service, thereby realizing automatic degradation or automatic recovery of the upstream service.

Description

服务调用量的控制方法和装置Method and device for controlling service call volume

技术领域technical field

本发明涉及计算机技术领域,尤其涉及一种服务调用量的控制方法和装置。The invention relates to the field of computer technology, in particular to a method and device for controlling the amount of service calls.

背景技术Background technique

在计算机技术领域,需要服务端既能应对特定场景下短时间内涌入的大量请求带来的巨大负载,又能在一般负载情况下提供不间断的高可用服务。在实际应用中,一个本地服务往往依赖于多个上游服务,当上游服务性能变差、不可用或者无法支撑流量洪峰时,就需要提前或即时降级对应服务,而现有的降级操作一般都是由人工手动实现。In the field of computer technology, the server needs to be able to cope with the huge load brought by a large number of requests in a short period of time in a specific scenario, and to provide uninterrupted high-availability services under general load conditions. In practical applications, a local service often depends on multiple upstream services. When the performance of upstream services becomes poor, unavailable, or unable to support traffic peaks, it is necessary to downgrade the corresponding services in advance or immediately. The existing downgrade operations are generally Implemented manually.

在实现本发明的过程中,发明人发现现有技术至少存在以下问题:In the process of realizing the present invention, the inventor finds that there are at least the following problems in the prior art:

1.降级操作不够迅速。从服务出现问题,到开发人员收到业务报警,再到手动降级操作完毕,这个过程会产生较长时间的滞后,进而导致较多的服务不可用。出于同样的原因,恢复(从降级中恢复)操作也会产生较长时间的滞后,易造成服务资源的浪费。1. The downgrade operation is not fast enough. There will be a long time lag in the process from service problems to developers receiving business alarms to the completion of manual downgrade operations, which will lead to more services being unavailable. For the same reason, the recovery (recovery from degradation) operation also has a long time lag, which is easy to cause waste of service resources.

2.现有的降级与恢复只能进行全流量操作,无法进行部分流量的操作。这样,一些本可支撑较小流量的服务在面对较大流量时会被提前全流量降级,从而造成资源浪费;在降级一段时间之后,全流量恢复易产生冷启动问题。2. The existing downgrade and recovery can only perform full-flow operations, and cannot perform partial-flow operations. In this way, some services that can support relatively small traffic will be downgraded in advance with full traffic in the face of large traffic, resulting in waste of resources; after a period of downgrading, full traffic recovery will easily cause cold start problems.

3.在特定场景下,流量洪峰会在深夜或凌晨触发,这时需要额外安排人力提前进行降级操作,因此造成人力成本的增加。3. In a specific scenario, the traffic flood peak is triggered in the middle of the night or early in the morning. At this time, additional manpower needs to be arranged to perform the downgrade operation in advance, resulting in an increase in manpower costs.

发明内容Contents of the invention

有鉴于此,本发明实施例提供一种服务调用量的控制方法和装置,能够利用预先存储的每一上游服务的当前调用量控制策略,自动控制上游服务调用量,从而实现上游服务的自动降级或自动恢复。In view of this, the embodiments of the present invention provide a method and device for controlling the volume of service calls, which can use the pre-stored current call volume control strategy of each upstream service to automatically control the volume of upstream service calls, thereby realizing automatic downgrading of upstream services or automatic recovery.

为实现上述目的,根据本发明的一个方面,提供了一种服务调用量的控制方法。To achieve the above purpose, according to one aspect of the present invention, a method for controlling the amount of service calls is provided.

本发明实施例的服务调用量的控制方法包括:接收调用本地服务的用户请求;其中,所述本地服务依赖于至少一个上游服务;在所述用户请求正常调用所述本地服务时,利用预先存储的、所述至少一个上游服务中每一上游服务的当前调用量控制策略,确定所述用户请求是否正常调用该上游服务:若是,返回该上游服务的正常调用数据;否则,返回该上游服务的默认数据;以及,根据每一上游服务返回的正常调用数据或默认数据生成响应信息向用户返回。The method for controlling the amount of service calls in the embodiment of the present invention includes: receiving a user request to call a local service; wherein the local service depends on at least one upstream service; The current invocation volume control strategy of each upstream service in the at least one upstream service, determine whether the user request normally invokes the upstream service: if yes, return the normal invocation data of the upstream service; otherwise, return the upstream service Default data; and, generate response information to return to the user according to normal call data or default data returned by each upstream service.

可选地,所述方法进一步包括:为每一上游服务设置多条调用量控制策略;其中,所述多条调用量控制策略包括至少一条降级策略和至少一条恢复策略;在该上游服务处于全量降级状态时,选取该上游服务的一条恢复策略作为该上游服务的当前调用量控制策略并存储;在该上游服务不处于全量降级状态时,选取该上游服务的一条降级策略作为该上游服务的当前调用量控制策略并存储。Optionally, the method further includes: setting multiple call volume control policies for each upstream service; wherein, the multiple call volume control policies include at least one downgrade policy and at least one recovery policy; when the upstream service is at full volume In the degraded state, select a recovery policy of the upstream service as the current call volume control policy of the upstream service and store it; when the upstream service is not in a fully degraded state, select a degraded policy of the upstream service as the current Invoke the volume control strategy and store it.

可选地,所述降级策略包括:至少一条性能降级策略,每一降级策略均包含降级条件与调用量降级比例;以及,所述选取该上游服务的一条降级策略作为该上游服务的当前调用量控制策略包括:采集该上游服务的运行数据,统计所述运行数据获取该上游服务在当前统计周期的性能指标;在该上游服务的性能降级策略中,确定降级条件与当前统计周期的性能指标匹配的性能降级策略,将其作为该上游服务的初选调用量控制策略;将所述初选调用量控制策略中的调用量降级比例最大者确定为该上游服务的当前调用量控制策略。Optionally, the degradation strategy includes: at least one performance degradation strategy, each of which includes a degradation condition and a call volume degradation ratio; and, selecting a degradation policy of the upstream service as the current call volume of the upstream service The control strategy includes: collecting the operation data of the upstream service, counting the operation data to obtain the performance index of the upstream service in the current statistical cycle; in the performance degradation strategy of the upstream service, determining that the degradation condition matches the performance index of the current statistical cycle The performance degradation strategy for the upstream service is used as the primary call volume control strategy for the upstream service; and the one with the largest call volume degradation ratio among the primary call volume control strategies is determined as the current call volume control strategy for the upstream service.

可选地,所述降级策略进一步包括:至少一条可用率降级策略;以及,所述选取该上游服务的一条降级策略作为该上游服务的当前调用量控制策略包括:根据所述运行数据获取该上游服务在距当前时刻最近的多个统计周期的可用率指标;在该上游服务的可用率降级策略中,确定降级条件与所述可用率指标匹配的可用率降级策略,将其作为该上游服务的初选调用量控制策略。Optionally, the downgrading strategy further includes: at least one availability downgrading strategy; and, selecting a downgrading strategy of the upstream service as the current call volume control strategy of the upstream service includes: obtaining the upstream Availability indicators of the service in multiple statistical periods closest to the current moment; in the availability degradation strategy of the upstream service, determine the availability degradation strategy whose degradation condition matches the availability indicator, and use it as the availability degradation strategy of the upstream service Primary call volume control strategy.

可选地,所述降级策略进一步包括:至少一条定时降级策略,每一定时降级策略的降级条件为降级时间间隔;以及,所述选取该上游服务的一条降级策略作为该上游服务的当前调用量控制策略包括:在该上游服务的定时降级策略中,确定降级时间间隔含有当前时刻的定时降级策略,将其作为该上游服务的初选调用量控制策略。Optionally, the downgrading strategy further includes: at least one timing downgrading strategy, and the downgrading condition of each timing downgrading strategy is a downgrading time interval; and, selecting a downgrading strategy of the upstream service as the current call amount of the upstream service The control strategy includes: in the timing downgrading strategy of the upstream service, determine that the downgrading time interval includes the timing downgrading strategy at the current moment, and use it as the primary call volume control strategy of the upstream service.

可选地,所述至少一条恢复策略中的每一恢复策略均包含调用量降级比例,所述用户请求携带用户标识;以及,所述利用预先存储的、所述至少一个上游服务中每一上游服务的当前调用量控制策略,确定所述用户请求是否正常调用该上游服务包括:将所述用户标识转换为0与1之间的哈希值;在该哈希值小于当前调用量控制策略中的调用量降级比例时,控制该上游服务不向所述用户请求提供调用;在该哈希值不小于当前调用量控制策略中的调用量降级比例时,控制该上游服务向所述用户请求提供调用。Optionally, each recovery strategy in the at least one recovery strategy includes a call volume downgrade ratio, and the user request carries a user identifier; The current call volume control policy of the service, determining whether the user request calls the upstream service normally includes: converting the user ID into a hash value between 0 and 1; when the hash value is less than the current call volume control policy When the call volume downgrade ratio of , control the upstream service not to provide calls to the user request; when the hash value is not less than the call volume downgrade ratio in the current call volume control policy, control the upstream service to provide the user request with transfer.

可选地,所述方法进一步包括:预先存储所述本地服务的当前调用量控制策略;以及,所述用户请求正常调用所述本地服务包括:利用所述本地服务的当前调用量控制策略,确定所述用户请求正常调用所述本地服务。Optionally, the method further includes: pre-storing the current call volume control policy of the local service; and the user requesting to call the local service normally includes: using the current call volume control policy of the local service to determine The user requests to call the local service normally.

可选地,所述默认数据包括:该上游服务上一次返回的正常调用数据或空值;所述运行数据包括:该上游服务的每一调用状态以及每一响应时间;所述性能指标包括以下至少一种:响应时间百分线TP指标、响应时间最大值、响应时间平均值。Optionally, the default data includes: the normal invocation data or null value returned by the upstream service last time; the operation data includes: each invocation status and each response time of the upstream service; the performance indicators include the following At least one: response time percentage line TP index, response time maximum value, response time average value.

为实现上述目的,根据本发明的又一方面,提供了一种服务调用量的控制装置。To achieve the above object, according to another aspect of the present invention, a device for controlling the amount of service calls is provided.

本发明实施例的服务调用量的控制装置可包括:接收单元,可用于接收调用本地服务的用户请求;其中,所述本地服务依赖于至少一个上游服务;调用控制单元,可用于在所述用户请求正常调用所述本地服务时,利用预先存储的、所述至少一个上游服务中每一上游服务的当前调用量控制策略,确定所述用户请求是否正常调用该上游服务:若是,返回该上游服务的正常调用数据;否则,返回该上游服务的默认数据;响应单元,可用于根据每一上游服务返回的正常调用数据或默认数据生成响应信息向用户返回。The device for controlling the amount of service calls in the embodiment of the present invention may include: a receiving unit, configured to receive a user request for calling a local service; wherein, the local service depends on at least one upstream service; a call control unit, configured to When requesting to call the local service normally, use the pre-stored current call volume control policy of each upstream service in the at least one upstream service to determine whether the user request calls the upstream service normally: if so, return the upstream service otherwise, return the default data of the upstream service; the response unit can be used to generate response information to return to the user according to the normal call data or default data returned by each upstream service.

可选地,所述装置可进一步包括:当前策略获取单元,用于为每一上游服务设置多条调用量控制策略;其中,所述多条调用量控制策略包括至少一条降级策略和至少一条恢复策略;在该上游服务处于全量降级状态时,选取该上游服务的一条恢复策略作为该上游服务的当前调用量控制策略并存储;在该上游服务不处于全量降级状态时,选取该上游服务的一条降级策略作为该上游服务的当前调用量控制策略并存储。Optionally, the device may further include: a current policy acquisition unit, configured to set multiple call volume control policies for each upstream service; wherein, the multiple call volume control policies include at least one downgrading policy and at least one restoration policy strategy; when the upstream service is in the full degraded state, select a recovery strategy of the upstream service as the current call volume control strategy of the upstream service and store it; when the upstream service is not in the full degraded state, select a recovery strategy of the upstream service The downgrading policy is used as the current call volume control policy of the upstream service and stored.

可选地,所述降级策略包括:至少一条性能降级策略,每一降级策略均包含降级条件与调用量降级比例;以及,所述当前策略获取单元可进一步用于:采集该上游服务的运行数据,统计所述运行数据获取该上游服务在当前统计周期的性能指标;在该上游服务的性能降级策略中,确定降级条件与当前统计周期的性能指标匹配的性能降级策略,将其作为该上游服务的初选调用量控制策略;将所述初选调用量控制策略中的调用量降级比例最大者确定为该上游服务的当前调用量控制策略。Optionally, the degradation strategy includes: at least one performance degradation strategy, each of which includes a degradation condition and a call volume degradation ratio; and, the current policy acquisition unit can be further used to: collect the operation data of the upstream service , counting the operating data to obtain the performance index of the upstream service in the current statistical cycle; in the performance degradation strategy of the upstream service, determine the performance degradation strategy whose degradation condition matches the performance index of the current statistical cycle, and use it as the upstream service The primary call volume control strategy; determine the call volume reduction ratio among the primary call volume control strategies as the current call volume control strategy of the upstream service.

可选地,所述降级策略可进一步包括:至少一条可用率降级策略;以及,所述当前策略获取单元可进一步用于:根据所述运行数据获取该上游服务在距当前时刻最近的多个统计周期的可用率指标;在该上游服务的可用率降级策略中,确定降级条件与所述可用率指标匹配的可用率降级策略,将其作为该上游服务的初选调用量控制策略。Optionally, the degradation policy may further include: at least one availability rate degradation policy; and the current policy acquiring unit may be further configured to: acquire a plurality of statistics of the upstream service closest to the current moment according to the operation data A periodic availability rate index; in the availability rate degradation strategy of the upstream service, determine the availability rate degradation policy whose degradation condition matches the availability rate index, and use it as the primary call volume control strategy of the upstream service.

可选地,所述降级策略可进一步包括:至少一条定时降级策略,每一定时降级策略的降级条件为降级时间间隔;以及,所述当前策略获取单元可进一步用于:在该上游服务的定时降级策略中,确定降级时间间隔含有当前时刻的定时降级策略,将其作为该上游服务的初选调用量控制策略。Optionally, the downgrading strategy may further include: at least one timing downgrading strategy, and the downgrading condition of each timing downgrading strategy is a downgrading time interval; and, the current policy acquisition unit may be further used to: In the downgrade strategy, it is determined that the downgrade time interval contains the timed downgrade strategy at the current moment, and it is used as the primary call volume control strategy for the upstream service.

可选地,所述至少一条恢复策略中的每一恢复策略均包含调用量降级比例,所述用户请求携带用户标识;以及,所述调用控制单元可进一步用于:将所述用户标识转换为0与1之间的哈希值;在该哈希值小于当前调用量控制策略中的调用量降级比例时,控制该上游服务不向所述用户请求提供调用;在该哈希值不小于当前调用量控制策略中的调用量降级比例时,控制该上游服务向所述用户请求提供调用。Optionally, each recovery strategy in the at least one recovery strategy includes a call volume downgrade ratio, and the user request carries a user identifier; and, the call control unit may be further configured to: convert the user identifier into A hash value between 0 and 1; when the hash value is less than the call volume degradation ratio in the current call volume control policy, control the upstream service not to provide calls to the user request; when the hash value is not less than the current When the call volume reduction ratio in the call volume control strategy is used, the upstream service is controlled to provide calls to the user request.

可选地,所述当前策略获取单元可进一步用于:预先存储所述本地服务的当前调用量控制策略;以及,所述调用控制单元可进一步用于:利用所述本地服务的当前调用量控制策略,确定所述用户请求正常调用所述本地服务。Optionally, the current policy acquisition unit may be further configured to: pre-store the current call volume control policy of the local service; and the call control unit may be further used to: utilize the current call volume control policy of the local service A policy is used to determine that the user requests to call the local service normally.

可选地,所述默认数据包括:该上游服务上一次返回的正常调用数据或空值;所述运行数据包括:该上游服务的每一调用状态以及每一响应时间;所述性能指标包括以下至少一种:响应时间百分线TP指标、响应时间最大值、响应时间平均值。Optionally, the default data includes: the normal invocation data or null value returned by the upstream service last time; the operation data includes: each invocation status and each response time of the upstream service; the performance indicators include the following At least one: response time percentage line TP index, response time maximum value, response time average value.

为实现上述目的,根据本发明的又一方面,提供了一种电子设备。To achieve the above object, according to another aspect of the present invention, an electronic device is provided.

本发明的一种电子设备包括:一个或多个处理器;存储装置,用于存储一个或多个程序,当所述一个或多个程序被所述一个或多个处理器执行,使得所述一个或多个处理器实现本发明所提供的服务调用量的控制方法。An electronic device according to the present invention includes: one or more processors; storage means for storing one or more programs, when the one or more programs are executed by the one or more processors, so that the One or more processors implement the method for controlling the amount of service calls provided by the present invention.

为实现上述目的,根据本发明的再一方面,提供了一种计算机可读存储介质。To achieve the above purpose, according to still another aspect of the present invention, a computer-readable storage medium is provided.

本发明的一种计算机可读存储介质,其上存储有计算机程序,所述程序被处理器执行时实现本发明所提供的服务调用量的控制方法。A computer-readable storage medium of the present invention stores a computer program thereon, and when the program is executed by a processor, the method for controlling the amount of service calls provided by the present invention is realized.

根据本发明的技术方案,上述发明中的一个实施例具有如下优点或有益效果:通过为每一上游服务设置多条调用量控制策略,并根据实时采集的每一上游服务的运行数据获取其性能、可用率等运行指标,进而利用运行指标等参数从其调用量控制策略中确定当前调用量控制策略来调整降级或恢复的调用量比例,从而实现上游服务调用量的自动控制,提高系统的灵敏性、可用性以及服务资源利用率,克服了现有的手动操作滞后严重的缺陷;在本发明实施例中,为每一上游服务设置的调用量控制策略均可实现部分流量的降级或恢复,由此可解决现有技术中只能进行全流量操作的不足,提升资源利用率,避免产生冷启动问题;此外,在本发明实施例中,还可设置定时降级策略,在流量洪峰来临之前提前设置即可实现服务的自动降级,从而提高降级操作精度,减少人力成本。According to the technical solution of the present invention, one embodiment of the above invention has the following advantages or beneficial effects: by setting multiple call volume control strategies for each upstream service, and obtaining its performance according to the operating data of each upstream service collected in real time , availability rate and other operating indicators, and then use operating indicators and other parameters to determine the current call volume control strategy from its call volume control strategy to adjust the proportion of degraded or restored call volume, so as to realize automatic control of upstream service call volume and improve system sensitivity. performance, availability, and service resource utilization, overcoming the serious defect of the existing manual operation lag; This can solve the problem of only full-flow operation in the prior art, improve resource utilization, and avoid cold start problems; in addition, in the embodiment of the present invention, a timing downgrading strategy can also be set, which can be set in advance before the traffic flood peak The automatic downgrade of the service can be realized, thereby improving the accuracy of the downgrade operation and reducing labor costs.

上述的非惯用的可选方式所具有的进一步效果将在下文中结合具体实施方式加以说明。The further effects of the above-mentioned non-conventional alternatives will be described below in conjunction with specific embodiments.

附图说明Description of drawings

附图用于更好地理解本发明,不构成对本发明的不当限定。其中:The accompanying drawings are used to better understand the present invention, and do not constitute improper limitations to the present invention. in:

图1是根据本发明实施例的服务调用量的控制方法的主要步骤示意图;FIG. 1 is a schematic diagram of main steps of a method for controlling the amount of service calls according to an embodiment of the present invention;

图2是根据本发明第一实施例的服务调用量的控制方法的具体实现示意图;FIG. 2 is a schematic diagram of a specific implementation of a method for controlling the amount of service calls according to the first embodiment of the present invention;

图3是根据本发明第一实施例的服务调用量的控制方法的调用量控制策略配置示意图;FIG. 3 is a schematic diagram of configuration of a call volume control strategy of a service call volume control method according to the first embodiment of the present invention;

图4是根据本发明实施例的服务调用量的控制装置的主要部分示意图;FIG. 4 is a schematic diagram of main parts of a device for controlling the amount of service calls according to an embodiment of the present invention;

图5是根据本发明实施例可以应用于其中的示例性系统架构图;FIG. 5 is an exemplary system architecture diagram that can be applied thereto according to an embodiment of the present invention;

图6是用来实现本发明实施例的服务调用量的控制方法的电子设备的结构示意图。FIG. 6 is a schematic structural diagram of an electronic device used to implement the method for controlling the amount of service calls according to an embodiment of the present invention.

具体实施方式Detailed ways

以下结合附图对本发明的示范性实施例做出说明,其中包括本发明实施例的各种细节以助于理解,应当将它们认为仅仅是示范性的。因此,本领域普通技术人员应当认识到,可以对这里描述的实施例做出各种改变和修改,而不会背离本发明的范围和精神。同样,为了清楚和简明,以下的描述中省略了对公知功能和结构的描述。Exemplary embodiments of the present invention are described below in conjunction with the accompanying drawings, which include various details of the embodiments of the present invention to facilitate understanding, and they should be regarded as exemplary only. Accordingly, those of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the invention. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.

本发明实施例的技术方案通过为每一上游服务设置多条调用量控制策略,并根据实时采集的每一上游服务的运行数据获取其性能、可用率等运行指标,进而利用运行指标等参数从其调用量控制策略中确定当前调用量控制策略来调整降级或恢复的调用量比例,从而实现上游服务调用量的自动控制,提高系统的灵敏性、可用性以及服务资源利用率,克服了现有的手动操作滞后严重的缺陷;在本发明实施例中,为每一上游服务设置的调用量控制策略均可实现部分流量的降级或恢复,由此可解决现有技术中只能进行全流量操作的不足,提升资源利用率,避免产生冷启动问题;此外,在本发明实施例中,还可设置定时降级策略,在流量洪峰来临之前提前设置即可实现服务的自动降级,从而提高降级操作精度,减少人力成本。In the technical solution of the embodiment of the present invention, multiple call volume control strategies are set for each upstream service, and operating indicators such as performance and availability are obtained according to the operating data of each upstream service collected in real time, and then parameters such as operating indicators are used to obtain In its call volume control strategy, the current call volume control strategy is determined to adjust the proportion of downgraded or restored calls, so as to realize the automatic control of the upstream service call volume, improve the sensitivity, availability and service resource utilization of the system, and overcome the existing The serious defect of manual operation lagging; in the embodiment of the present invention, the call volume control strategy set for each upstream service can realize the degradation or recovery of part of the flow, thus solving the problem of only full flow operation in the prior art Insufficient, improve resource utilization and avoid cold start problems; in addition, in the embodiment of the present invention, a timing downgrading strategy can also be set, and the automatic downgrading of services can be realized by setting in advance before the traffic flood peak, thereby improving the accuracy of downgrading operations. Reduce labor costs.

需要指出的是,在不冲突的情况下,本发明的实施例以及实施例中的技术特征可以相互结合。It should be noted that, in the case of no conflict, the embodiments of the present invention and the technical features in the embodiments can be combined with each other.

图1是根据本发明实施例的服务调用量的控制方法的主要步骤示意图。Fig. 1 is a schematic diagram of main steps of a method for controlling the amount of service calls according to an embodiment of the present invention.

如图1所示,本发明实施例的服务调用量的控制方法可执行以下步骤:As shown in Figure 1, the method for controlling the amount of service calls in the embodiment of the present invention may perform the following steps:

步骤S101:本地服务器接收调用本地服务的用户请求。Step S101: the local server receives a user request for invoking a local service.

在本发明实施例中,用户请求用于向本地服务器请求本地服务器中设置的本地服务,本地服务器在接收到用户请求之后,往往需要调用本地服务依赖的至少一个上游服务,并根据上游服务返回的数据进行响应。其中,用户请求中可携带用户标识,用户标记可以是用户的手机号,用户手机的国际移动设备身份码IMEI(International Mobile EquipmentIdentity)等。In the embodiment of the present invention, the user request is used to request the local server from the local server for the local service set in the local server. After receiving the user request, the local server often needs to call at least one upstream service that the local service depends on, and according to the data in response. Wherein, the user identification may be carried in the user request, and the user identifier may be the user's mobile phone number, the International Mobile Equipment Identity (IMEI) of the user's mobile phone, and the like.

步骤S102:在用户请求正常调用本地服务时,本地服务器利用预先存储的、至少一个上游服务中每一上游服务的当前调用量控制策略,确定用户请求是否正常调用该上游服务:若是,返回该上游服务的正常调用数据;否则,返回该上游服务的默认数据。Step S102: When the user requests to call the local service normally, the local server determines whether the user requests to call the upstream service normally by using the pre-stored current call volume control strategy of each upstream service in at least one upstream service: if so, return the upstream service The normal invocation data of the service; otherwise, the default data of the upstream service is returned.

在本步骤中,本地服务器预先存储每一上游服务的当前调用量控制策略,该当前调用量控制策略是根据该上游服务的实时运行情况确定的,用于对上游服务进行自动降级或恢复。其中,服务降级指的是:当服务器压力剧增时,根据当前业务情况及访问流量对某服务进行流量限制的操作,服务恢复指的是:当某服务处于全流量降级状态一段时间之后,对其恢复一定比例的访问流量的操作。In this step, the local server pre-stores the current call volume control policy of each upstream service, the current call volume control policy is determined according to the real-time operation of the upstream service, and is used to automatically downgrade or restore the upstream service. Among them, service degradation refers to: when the server pressure increases sharply, the operation of restricting the traffic of a service according to the current business situation and access traffic, service recovery refers to: when a service is in the full traffic degraded state for a period of time, It restores a certain percentage of access traffic operations.

实际应用中,本地服务器通过以下步骤确定每一上游服务的当前调用量控制策略:In practical applications, the local server determines the current call volume control strategy for each upstream service through the following steps:

1.为每一上游服务设置多条调用量控制策略;其中,多条调用量控制策略包括至少一条降级策略和至少一条恢复策略,每一降级策略均包含降级条件与调用量降级比例,每一恢复策略均包含恢复条件与调用量检测比例。1. Set up multiple call volume control strategies for each upstream service; among them, multiple call volume control policies include at least one downgrade strategy and at least one recovery strategy, each downgrade strategy includes downgrade conditions and call volume downgrade ratios, each The recovery strategies all include the recovery condition and call volume detection ratio.

具体地,降级条件指的是降级策略的触发条件,调用量降级比例指的是执行降级策略时降级的服务调用量的比例。一般地,调用量降级比例为0与1之间(即不小于0且不大于1)的数值。Specifically, the downgrading condition refers to the triggering condition of the downgrading policy, and the invocation volume downgrading ratio refers to the proportion of degraded service invocation volume when the downgrading policy is executed. Generally, the calling amount downgrading ratio is a value between 0 and 1 (that is, not less than 0 and not greater than 1).

例如:某上游服务的某降级策略为:TP90大于1000毫秒时,自动降级20%的流量。其中,TP90是一种响应时间的百分线TP(Top Percentile)指标,其物理含义为:将该上游服务在统计周期内的多个响应时间从小到大排序,位于第90%的响应时间。同样的,TP50指的是将该上游服务在统计周期内的多个响应时间从小到大排序,位于第50%的响应时间。在上述降级策略中,降级条件为:TP90大于1000毫秒,调用量降级比例为20%,若该降级策略作为该上游服务的当前调用量控制策略,其可控制该上游服务对20%的访问流量不提供调用,对80%的访问流量提供调用。For example: a downgrade policy of an upstream service is: when TP90 is greater than 1000 milliseconds, 20% of the traffic will be downgraded automatically. Among them, TP90 is a response time percentage line TP (Top Percentile) index, and its physical meaning is: sort the multiple response times of the upstream service within the statistical period from small to large, and rank at the 90th percentile response time. Similarly, TP50 refers to the multiple response times of the upstream service within the statistical period, sorted from small to large, and the response time that is at the 50th percentile. In the above downgrade strategy, the downgrade condition is: TP90 is greater than 1000 milliseconds, and the call volume downgrade ratio is 20%. If the downgrade policy is used as the current call volume control strategy of the upstream service, it can control the upstream service to 20% of the access traffic Calls are not provided, and calls are provided for 80% of the access traffic.

在本发明实施例中,每一上游服务的降级策略可包括:性能降级策略、可用率降级策略以及定时降级策略。其中,性能降级策略的降级条件为上游服务的性能指标,如:TP50、TP90、TP99、TP999、响应时间平均值、响应时间最大值等,上例中的降级策略“TP90大于1000毫秒时,自动降级20%的流量”即为性能降级策略。In the embodiment of the present invention, the degradation policy of each upstream service may include: a performance degradation policy, an availability rate degradation policy, and a timing degradation policy. Among them, the degradation condition of the performance degradation policy is the performance index of the upstream service, such as: TP50, TP90, TP99, TP999, the average response time, the maximum response time, etc., the degradation policy in the above example "when TP90 is greater than 1000 milliseconds, automatically Downgrade 20% of traffic" is the performance downgrade strategy.

可用率降级策略的降级条件为上游服务的可用率指标,具体应用中,上游服务在某统计周期的可用率为该统计周期内上游服务的正常调用总数(即成功调用总数)与调用总数之商。例如:以下的降级策略即为可用率降级策略:当服务可用率连续3次小于50%时,自动降级40%的流量。The downgrading condition of the availability downgrading policy is the availability index of the upstream service. In a specific application, the availability rate of the upstream service in a certain statistical period is the quotient of the total number of normal calls (that is, the total number of successful calls) and the total number of calls of the upstream service in the statistical period. . For example: the following downgrading policy is the availability downgrading policy: when the service availability is less than 50% for three consecutive times, 40% of the traffic will be automatically downgraded.

定时降级策略的降级条件为降级时间间隔,即触发降级操作的预设时间间隔。例如:以下的降级策略即为定时时间间隔:从2017-10-2723:55:00~2017-10-28 00:05:00时间范围内,自动降级80%的流量,其表示:在2017年10月27日23点55分到2018年0点05分的时间间隔内,对80%的访问流量进行降级,其中的“2017-10-2723:55:00~2017-10-28 00:05:00”即为降级时间间隔。The downgrade condition of the scheduled downgrade policy is the downgrade time interval, which is the preset time interval for triggering downgrade operations. For example: the following downgrade policy is a time interval: from 2017-10-27 23:55:00 to 2017-10-28 00:05:00, automatically downgrade 80% of the traffic, which means: in 2017 During the time interval from 23:55 on October 27 to 0:05 in 2018, 80% of the access traffic will be downgraded, among which "2017-10-27 23:55:00~2017-10-28 00:05 :00" is the downgrade interval.

在本步骤中,恢复条件指的是该上游服务处于全量降级(即针对全部访问流量进行降级)状态时触发恢复策略的条件,调用量检测比例是指执行恢复策略时初始启动的服务调用量比例。一般地,调用量检测比例为0与1之间的数值。可以理解的是,同一恢复策略中的调用量检测比例与调用量降级比例的和为1。通过设置调用量检测比例可避免上游服务在全流量降级与全流量恢复这两种状态之间不断交替,还可避免冷启动问题的发生。In this step, the recovery condition refers to the condition that triggers the recovery strategy when the upstream service is in the state of full downgrade (that is, downgrades all access traffic), and the call volume detection ratio refers to the service call volume ratio initially started when the recovery strategy is executed . Generally, the calling amount detection ratio is a value between 0 and 1. It can be understood that the sum of the call volume detection ratio and the call volume degradation ratio in the same recovery strategy is 1. By setting the call volume detection ratio, it is possible to prevent upstream services from alternating between full-flow degradation and full-flow recovery, and to avoid cold start problems.

例如:某上游服务的某恢复策略为:全流量自动降级10分钟后,打开5%的检验流量。在该恢复策略中,恢复条件为:全流量自动降级10分钟,调用量检测比例为5%,调用量降级比例为95%,若该恢复策略作为该上游服务的当前调用量控制策略,其可控制该上游服务对95%的访问流量不提供调用,对5%的访问流量提供调用。For example, a certain recovery strategy of an upstream service is: after 10 minutes of automatic downgrade of full traffic, open 5% of inspection traffic. In this recovery strategy, the recovery conditions are: full traffic is automatically downgraded for 10 minutes, the call volume detection ratio is 5%, and the call volume downgrade ratio is 95%. If this recovery strategy is used as the current call volume control strategy of the upstream service, it can The upstream service is controlled not to provide calls to 95% of the access traffic, and to provide calls to 5% of the access traffic.

2.在上游服务处于全量降级状态时,选取上游服务的一条恢复策略作为上游服务的当前调用量控制策略并存储;在上游服务不处于全量降级状态时,选取上游服务的一条降级策略作为上游服务的当前调用量控制策略并存储。2. When the upstream service is in the full degraded state, select a recovery policy of the upstream service as the current call volume control strategy of the upstream service and store it; when the upstream service is not in the full degraded state, select a degraded policy of the upstream service as the upstream service The current call volume control strategy and store it.

较佳地,在本发明实施例中,如果上游服务处于全量降级状态,则根据预设规则从至少一条恢复策略中选取一条作为当前调用量控制策略,并将其存储。如果上游服务不是处于全量降级状态,则可根据以下步骤从至少一条降级策略中选取上游服务的当前调用量控制策略:Preferably, in the embodiment of the present invention, if the upstream service is in a fully degraded state, one of at least one recovery strategy is selected as the current call volume control strategy according to preset rules, and stored. If the upstream service is not in the full degraded state, you can select the current call volume control policy of the upstream service from at least one degraded policy according to the following steps:

(1)采集上游服务的运行数据,统计运行数据获取上游服务在当前统计周期的性能指标;在该上游服务的性能降级策略中,确定降级条件与当前统计周期的性能指标匹配的性能降级策略,将其作为该上游服务的初选调用量控制策略。(1) Collect the operation data of the upstream service, and collect the operation data to obtain the performance index of the upstream service in the current statistical cycle; in the performance degradation strategy of the upstream service, determine the performance degradation strategy whose degradation condition matches the performance index of the current statistical cycle, Use it as the primary call volume control strategy for the upstream service.

较佳地,上游服务的运行数据可包括:上游服务的每一调用状态以及每一响应时间,其中的调用状态指的是上游服务的每一次调用是正常调用(即成功调用)还是失败调用。通过对当前统计周期的运行数据进行统计,可获得上游服务在当前统计周期的性能指标,之后可将降级条件匹配于当前统计周期性能指标的降级策略确定为上游服务的初选调用量控制策略。Preferably, the running data of the upstream service may include: each invocation status and each response time of the upstream service, wherein the invocation status refers to whether each invocation of the upstream service is a normal invocation (ie a successful invocation) or a failed invocation. By counting the running data of the current statistical period, the performance indicators of the upstream service in the current statistical period can be obtained, and then the degradation policy whose degradation condition matches the performance indicators of the current statistical period can be determined as the primary call volume control strategy of the upstream service.

(2)采集上游服务的运行数据,根据运行数据获取上游服务在距当前时刻最近的多个统计周期的可用率指标;在上游服务的可用率降级策略中,确定降级条件与可用率指标匹配的可用率降级策略,将其作为该上游服务的初选调用量控制策略。(2) Collect the operation data of the upstream service, and obtain the availability rate index of the upstream service in the nearest statistical period according to the operation data; in the availability rate downgrading strategy of the upstream service, determine whether the downgrade condition matches the availability rate index Availability downgrading strategy, which is used as the primary call volume control strategy for the upstream service.

其中,上述多个统计周期为距当前时刻最近的多个连续的统计周期。实际应用中,可针对上述多个统计周期的运行数据进行统计,得到每一统计周期的可用率指标,并将降级条件匹配于上述可用率指标的降级策略确定为上游服务的初选调用量控制策略。Wherein, the above-mentioned multiple statistical periods are multiple continuous statistical periods closest to the current moment. In practical applications, statistics can be made on the operation data of the above-mentioned multiple statistical periods to obtain the availability rate index of each statistical cycle, and the downgrade policy whose downgrade condition matches the above-mentioned availability rate index can be determined as the primary call volume control of the upstream service Strategy.

(3)在该上游服务的定时降级策略中,确定降级时间间隔含有当前时刻(即当前时刻处于降级时间间隔内)的定时降级策略,将其作为该上游服务的初选调用量控制策略。(3) In the timing downgrading strategy of the upstream service, it is determined that the downgrading time interval contains the timing downgrading strategy of the current moment (that is, the current moment is within the downgrading time interval), and it is used as the primary call volume control strategy of the upstream service.

(4)将初选调用量控制策略中的调用量降级比例最大者确定为上游服务的当前调用量控制策略,并将该当前调用量控制策略存储。(4) Determining the one with the largest call volume reduction ratio among the primary call volume control strategies as the current call volume control strategy of the upstream service, and storing the current call volume control strategy.

可以理解的是,初选调用量控制策略可以从性能降级策略、可用率降级策略以及定时降级策略中的一种或两种中确定,本发明对此不作限制。It can be understood that the primary call volume control strategy may be determined from one or two of the performance degradation strategy, the availability ratio degradation strategy, and the timing degradation strategy, which is not limited in the present invention.

通过以上步骤,本发明可根据采集的运行数据、运行指标及当前时刻确定对应于上游服务实时状态的降级策略,利用该降级策略可实现上游服务的自动迅速降级。Through the above steps, the present invention can determine the degrading strategy corresponding to the real-time status of the upstream service according to the collected operating data, operating indicators and current time, and the automatic and rapid degrading of the upstream service can be realized by using the degrading strategy.

在步骤S102中,本地服务器可利用上游服务的当前调用量控制策略来判断用户请求是否正常调用该上游服务。具体地,本地服务器可通过以下步骤进行判断:In step S102, the local server may use the current call volume control policy of the upstream service to determine whether the user request calls the upstream service normally. Specifically, the local server can judge through the following steps:

1.将用户请求中携带的用户标识转换为0与1之间的哈希值。1. Convert the user ID carried in the user request into a hash value between 0 and 1.

2.比较该哈希值与当前调用量控制策略中调用量降级比例的大小:如果该哈希值小于上述调用量降级比例,则控制该上游服务不向用户请求提供调用,返回上游服务的默认数据;如果该哈希值不小于上述调用量降级比例,则控制该上游服务向用户请求提供调用,返回上游服务的正常调用数据。其中,默认数据指的是上游服务上一次返回的正常调用数据或者空值。2. Compare the hash value with the call volume downgrade ratio in the current call volume control strategy: if the hash value is smaller than the above call volume downgrade ratio, control the upstream service not to provide calls to user requests, and return to the default value of the upstream service data; if the hash value is not less than the above call reduction ratio, control the upstream service to provide calls to the user request, and return the normal call data of the upstream service. Among them, the default data refers to the normal call data or null value returned by the upstream service last time.

作为一个优选方案,在步骤S102中,可在本地服务器存储每一本地服务的当前调用量控制策略。与上游服务的当前调用量控制策略相似,本地服务的当前调用量控制策略也是从预先确定的本地服务的调用量控制策略中确定,其调用量控制策略也可包括降级策略与恢复策略,其降级策略也可包括性能降级策略、可用率降级策略以及定时降级策略。在本地服务不处于全量降级状态时,也是通过以下的类似步骤进行当前调用量控制策略的确定:As a preferred solution, in step S102, the current calling amount control policy of each local service may be stored in the local server. Similar to the current call volume control strategy of the upstream service, the current call volume control strategy of the local service is also determined from the predetermined local service call volume control strategy, and its call volume control strategy can also include a downgrade strategy and recovery strategy. Policies may also include performance degradation policies, availability rate degradation policies, and timed degradation policies. When the local service is not in the full degraded state, the current call volume control strategy is also determined through the following similar steps:

1.采集本地服务的运行数据,统计得到其运行指标,根据运行指标和当前时刻从其性能降级策略、可用率降级策略以及定时降级策略中确定本地服务的初选调用量控制策略。1. Collect the operation data of the local service, and obtain its operation indicators through statistics. According to the operation indicators and the current moment, determine the primary call volume control strategy of the local service from its performance degradation strategy, availability rate degradation strategy, and timing degradation strategy.

2.将初选调用量控制策略中的调用量降级比例最大者确定为本地服务的当前调用量控制策略,并将该当前调用量控制策略存储。2. Determine the current call volume control strategy of the local service as the current call volume control strategy of the local service, and store the current call volume control strategy among the primary call volume control strategies.

之后,可利用本地服务的当前调用量控制策略,判断用户请求是否正常调用本地服务。本地服务对于用户请求的上述判断过程与上游服务相同,此处不再赘述。在得到判断结果后,如果本地服务向用户请求提供正常调用,则进而尝试调用上游服务;如果本地服务不向用户请求提供调用,则向用户返回本地服务的默认数据。Afterwards, the current call volume control policy of the local service can be used to determine whether the user request calls the local service normally. The above judgment process of the local service for the user request is the same as that of the upstream service, and will not be repeated here. After getting the judgment result, if the local service requests the user to provide a normal call, it will then try to call the upstream service; if the local service does not provide the call to the user request, then return the default data of the local service to the user.

步骤S103:根据每一上游服务返回的正常调用数据或默认数据生成响应信息向用户返回。Step S103: Generate response information and return it to the user according to the normal call data or default data returned by each upstream service.

在本步骤中,本地服务可将每一上游服务返回的数据整合,根据整合后的数据生成响应信息向用户返回。In this step, the local service can integrate the data returned by each upstream service, and generate response information based on the integrated data to return to the user.

图2是根据本发明第一实施例的服务调用量的控制方法的具体实现示意图。Fig. 2 is a schematic diagram of a specific realization of the method for controlling the amount of service calls according to the first embodiment of the present invention.

如图2所示,本实施例的服务调用量的控制方法可由本地监控模块、上游监控模块、数据监控中心、配置中心、报警提醒模块、通知模块、缓存模块、降级服务模块、实时接口服务模块交互得以实现。As shown in Figure 2, the method for controlling the amount of service calls in this embodiment can be composed of a local monitoring module, an upstream monitoring module, a data monitoring center, a configuration center, an alarm reminder module, a notification module, a cache module, a degraded service module, and a real-time interface service module interaction is achieved.

具体地,本地监控模块用于采集本地服务的调用状态、响应时间等运行数据,本地服务处于图2中的实时接口服务模块内部。上游监控模块用于采集上游服务的运行数据。数据监控中心用于收集由本地监控模块和上游监控模块反馈的实时运行数据,并统计得到性能指标、可用率指标等运行指标。Specifically, the local monitoring module is used to collect operating data such as calling status and response time of local services, and the local services are inside the real-time interface service module in FIG. 2 . The upstream monitoring module is used to collect the operation data of upstream services. The data monitoring center is used to collect the real-time operation data fed back by the local monitoring module and the upstream monitoring module, and obtain the operation indicators such as performance indicators and availability indicators through statistics.

配置中心负责本地服务与上游服务所有的调用量控制策略的配置,其按照更新频率定时读取数据监控中心的各项运行指标,从降级条件或恢复条件匹配的调用量控制策略中确定当前调用量控制策略,并将当前调用量控制策略更新到缓存模块中,同时向通知模块发送更新消息。此外,如果当前调用量控制策略改变,则通过报警提醒模块进行报警。The configuration center is responsible for the configuration of all call volume control strategies for local services and upstream services. It regularly reads the various operating indicators of the data monitoring center according to the update frequency, and determines the current call volume from the call volume control strategy that matches the degradation condition or recovery condition. control strategy, and update the current call volume control strategy to the cache module, and send an update message to the notification module at the same time. In addition, if the current calling amount control strategy changes, an alarm will be issued through the alarm reminder module.

图3是根据本发明第一实施例的服务调用量的控制方法的调用量控制策略配置示意图。Fig. 3 is a schematic diagram of configuration of a call volume control policy in a method for controlling service call volume according to a first embodiment of the present invention.

如图3所示,在配置中心可配置本地服务或上游服务的配置名称作为服务标识,可设置配置值与自动降级策略更新频率,可配置至少一条性能降级策略、可用率降级策略、定时降级策略以及恢复策略。通过上述配置,可实现服务调用量的高灵敏性控制。As shown in Figure 3, the configuration name of the local service or upstream service can be configured as the service identifier in the configuration center, the configuration value and the update frequency of the automatic downgrade policy can be set, and at least one performance downgrade policy, availability downgrade policy, and timing downgrade policy can be configured and recovery strategies. Through the above configuration, highly sensitive control of service call volume can be realized.

缓存模块负责存储配置中心确定的当前调用量控制策略,并将当前调用量控制策略提供于降级服务模块访问。通知模块用于接收配置中心发送的更新消息,并通过zookeeper(一种分布式应用程序协调服务)将更新消息同步到降级服务模块。The cache module is responsible for storing the current call volume control policy determined by the configuration center, and providing the current call volume control policy to the downgrade service module for access. The notification module is used to receive the update message sent by the configuration center, and synchronize the update message to the degraded service module through zookeeper (a distributed application coordination service).

降级服务模块在接收到更新消息后,从缓存模块中读取当前调用量控制策略,并存储在降级服务模块的本地缓存中。同时降级服务模块为实时接口服务模块提供服务,根据实时接口服务模块发送的用户标识以及服务标识,利用其存储的对应于该服务标识的当前调用量控制策略判断是否提供服务调用。After receiving the update message, the degraded service module reads the current call volume control policy from the cache module and stores it in the local cache of the degraded service module. At the same time, the degraded service module provides services for the real-time interface service module. According to the user identification and service identification sent by the real-time interface service module, it judges whether to provide service calls by using its stored current call volume control strategy corresponding to the service identification.

实时接口服务模块负责接收用户请求,并在其后调用降级服务模块,根据降级服务模块的判断结果确定是否调用服务。The real-time interface service module is responsible for receiving user requests, and then calls the downgrade service module, and determines whether to call the service according to the judgment result of the downgrade service module.

在本实施例中,服务调用量的自动控制主要依靠数据监控中心统计的运行指标、配置中心策略的定时更新、以及服务调用——数据监控——策略更新——调用量控制的调整闭环。调用量控制策略的更新逻辑主要发生在配置中心和降级服务模块,二者对实时接口服务模块透明,因此对实时接口服务模块的性能几乎没有影响。此外,各种配置数据都存储在服务器本地,因此降级服务模块仍为轻量级服务。因此,本实施例提供的服务调用量的控制方法可在对服务性能几无影响的前提下,实现服务调用量的自动控制,并具有较高的系统灵敏性、可用性及服务资源利用率。In this embodiment, the automatic control of the service call volume mainly relies on the running indicators counted by the data monitoring center, the regular update of the policy of the configuration center, and the adjustment closed loop of service call-data monitoring-policy update-call volume control. The update logic of the call volume control strategy mainly occurs in the configuration center and the downgrade service module, both of which are transparent to the real-time interface service module, so they have almost no impact on the performance of the real-time interface service module. In addition, various configuration data are stored locally on the server, so the degraded service module is still a lightweight service. Therefore, the method for controlling the amount of service calls provided in this embodiment can realize automatic control of the amount of service calls without affecting service performance, and has high system sensitivity, availability, and service resource utilization.

在本发明实施例的技术方案中,通过为每一上游服务设置多条调用量控制策略,并根据实时采集的每一上游服务的运行数据获取其性能、可用率等运行指标,进而利用运行指标等参数从其调用量控制策略中确定当前调用量控制策略来调整降级或恢复的调用量比例,从而实现上游服务调用量的自动控制,提高系统的灵敏性、可用性以及服务资源利用率,克服了现有的手动操作滞后严重的缺陷;在本发明实施例中,为每一上游服务设置的调用量控制策略均可实现部分流量的降级或恢复,由此可解决现有技术中只能进行全流量操作的不足,提升资源利用率,避免产生冷启动问题;此外,在本发明实施例中,还可设置定时降级策略,在流量洪峰来临之前提前设置即可实现服务的自动降级,从而提高降级操作精度,减少人力成本。In the technical solution of the embodiment of the present invention, by setting multiple call volume control strategies for each upstream service, and obtaining operating indicators such as performance and availability rate according to the operating data of each upstream service collected in real time, and then using the operating indicators Determine the current call volume control strategy from its call volume control strategy to adjust the proportion of downgraded or restored calls, so as to realize the automatic control of the upstream service call volume, improve the system's sensitivity, availability and service resource utilization, and overcome the The existing manual operation lags serious defects; in the embodiment of the present invention, the call volume control strategy set for each upstream service can realize the degradation or recovery of part of the traffic, thus solving the problem that only full traffic can only be performed in the prior art. Insufficient traffic operation can improve resource utilization and avoid cold start problems; in addition, in the embodiment of the present invention, a timing downgrading strategy can also be set, which can be set in advance before the traffic flood peak to realize automatic service downgrading, thereby improving downgrading Operational precision, reducing labor costs.

图4是本发明实施例的服务调用量的控制装置的主要部分示意图。Fig. 4 is a schematic diagram of main parts of the device for controlling the amount of service calls according to the embodiment of the present invention.

如图4所示,本发明实施例的服务调用量的控制装置400可包括:接收单元401、调用控制单元402以及响应单元403。其中:As shown in FIG. 4 , the apparatus 400 for controlling the amount of service calls in the embodiment of the present invention may include: a receiving unit 401 , a calling control unit 402 and a responding unit 403 . in:

接收单元401可用于接收调用本地服务的用户请求;其中,所述本地服务依赖于至少一个上游服务;The receiving unit 401 may be configured to receive a user request for invoking a local service; wherein the local service depends on at least one upstream service;

调用控制单元402可用于在所述用户请求正常调用所述本地服务时,利用预先存储的、所述至少一个上游服务中每一上游服务的当前调用量控制策略,确定所述用户请求是否正常调用该上游服务:若是,返回该上游服务的正常调用数据;否则,返回该上游服务的默认数据;The call control unit 402 may be configured to determine whether the user request calls the local service normally by using a pre-stored current call volume control strategy for each upstream service in the at least one upstream service The upstream service: if yes, return the normal call data of the upstream service; otherwise, return the default data of the upstream service;

响应单元403可用于根据每一上游服务返回的正常调用数据或默认数据生成响应信息向用户返回。The response unit 403 may be configured to generate response information to return to the user according to normal call data or default data returned by each upstream service.

在本发明实施例中,所述装置400可进一步包括:当前策略获取单元,其用于为每一上游服务设置多条调用量控制策略;其中,所述多条调用量控制策略包括至少一条降级策略和至少一条恢复策略;在该上游服务处于全量降级状态时,选取该上游服务的一条恢复策略作为该上游服务的当前调用量控制策略并存储;在该上游服务不处于全量降级状态时,选取该上游服务的一条降级策略作为该上游服务的当前调用量控制策略并存储。In the embodiment of the present invention, the device 400 may further include: a current policy acquisition unit, configured to set multiple call volume control policies for each upstream service; wherein, the multiple call volume control policies include at least one downgrade strategy and at least one recovery strategy; when the upstream service is in the full degraded state, select a recovery strategy of the upstream service as the current call volume control strategy of the upstream service and store it; when the upstream service is not in the full degraded state, select A degrading policy of the upstream service is used as the current call volume control policy of the upstream service and stored.

实际应用中,所述降级策略可包括:至少一条性能降级策略,每一降级策略均包含降级条件与调用量降级比例。所述当前策略获取单元可进一步用于:采集该上游服务的运行数据,统计所述运行数据获取该上游服务在当前统计周期的性能指标;在该上游服务的性能降级策略中,确定降级条件与当前统计周期的性能指标匹配的性能降级策略,将其作为该上游服务的初选调用量控制策略;将所述初选调用量控制策略中的调用量降级比例最大者确定为该上游服务的当前调用量控制策略。In practical applications, the degradation strategy may include: at least one performance degradation strategy, and each degradation strategy includes a degradation condition and a call volume degradation ratio. The current policy acquisition unit may be further used to: collect the operation data of the upstream service, and collect the operation data to obtain the performance index of the upstream service in the current statistical cycle; in the performance degradation strategy of the upstream service, determine the degradation condition and The performance degradation strategy matched by the performance index of the current statistical cycle is used as the primary call volume control strategy of the upstream service; the one with the largest call volume degradation ratio among the primary call volume control strategies is determined as the current upstream service Call volume control strategy.

具体应用中,所述降级策略可进一步包括:至少一条可用率降级策略。所述当前策略获取单元可进一步用于:根据所述运行数据获取该上游服务在距当前时刻最近的多个统计周期的可用率指标;在该上游服务的可用率降级策略中,确定降级条件与所述可用率指标匹配的可用率降级策略,将其作为该上游服务的初选调用量控制策略。In a specific application, the degradation policy may further include: at least one availability rate degradation policy. The current policy obtaining unit may be further configured to: obtain the availability rate indicators of the upstream service in the nearest statistical periods according to the operation data; in the availability rate degradation strategy of the upstream service, determine the degradation condition and The availability rate degradation policy matched by the availability rate index is used as the primary call volume control policy of the upstream service.

实际应用场景中,所述降级策略可进一步包括:至少一条定时降级策略,每一定时降级策略的降级条件为降级时间间隔。所述当前策略获取单元可进一步用于:在该上游服务的定时降级策略中,确定降级时间间隔含有当前时刻的定时降级策略,将其作为该上游服务的初选调用量控制策略。In an actual application scenario, the downgrading strategy may further include: at least one timing downgrading strategy, and the downgrading condition of each timing downgrading strategy is a downgrading time interval. The current policy acquisition unit may be further configured to: in the timing downgrade policy of the upstream service, determine that the downgrade time interval includes the timing downgrade policy at the current moment, and use it as the primary call volume control strategy of the upstream service.

较佳地,所述至少一条恢复策略中的每一恢复策略均包含调用量降级比例,所述用户请求携带用户标识。所述调用控制单元402可进一步用于:将所述用户标识转换为0与1之间的哈希值;在该哈希值小于当前调用量控制策略中的调用量降级比例时,控制该上游服务不向所述用户请求提供调用;在该哈希值不小于当前调用量控制策略中的调用量降级比例时,控制该上游服务向所述用户请求提供调用。Preferably, each recovery strategy in the at least one recovery strategy includes a call volume degradation ratio, and the user request carries a user identifier. The call control unit 402 may be further configured to: convert the user identifier into a hash value between 0 and 1; The service does not request to provide calls to the user; when the hash value is not less than the call volume reduction ratio in the current call volume control policy, control the upstream service to request to provide calls to the user.

作为一个优选方案,所述当前策略获取单元可进一步用于:预先存储所述本地服务的当前调用量控制策略。所述调用控制单元402可进一步用于:利用所述本地服务的当前调用量控制策略,确定所述用户请求正常调用所述本地服务。As a preferred solution, the current policy acquisition unit may be further configured to: pre-store the current call volume control policy of the local service. The call control unit 402 may be further configured to: use the current call volume control policy of the local service to determine that the user requests to call the local service normally.

此外,在本发明实施例中,所述默认数据包括:该上游服务上一次返回的正常调用数据或空值;所述运行数据包括:该上游服务的每一调用状态以及每一响应时间;所述性能指标包括以下至少一种:响应时间百分线TP指标、响应时间最大值、响应时间平均值。In addition, in the embodiment of the present invention, the default data includes: the normal call data or null value returned by the upstream service last time; the running data includes: each call status and each response time of the upstream service; The performance index includes at least one of the following: response time percentage line TP index, response time maximum value, and response time average value.

在本发明实施例的技术方案中,通过为每一上游服务设置多条调用量控制策略,并根据实时采集的每一上游服务的运行数据获取其性能、可用率等运行指标,进而利用运行指标等参数从其调用量控制策略中确定当前调用量控制策略来调整降级或恢复的调用量比例,从而实现上游服务调用量的自动控制,提高系统的灵敏性、可用性以及服务资源利用率,克服了现有的手动操作滞后严重的缺陷;在本发明实施例中,为每一上游服务设置的调用量控制策略均可实现部分流量的降级或恢复,由此可解决现有技术中只能进行全流量操作的不足,提升资源利用率,避免产生冷启动问题;此外,在本发明实施例中,还可设置定时降级策略,在流量洪峰来临之前提前设置即可实现服务的自动降级,从而提高降级操作精度,减少人力成本。In the technical solution of the embodiment of the present invention, by setting multiple call volume control strategies for each upstream service, and obtaining operating indicators such as performance and availability rate according to the operating data of each upstream service collected in real time, and then using the operating indicators Determine the current call volume control strategy from its call volume control strategy to adjust the proportion of downgraded or restored calls, so as to realize the automatic control of the upstream service call volume, improve the system's sensitivity, availability and service resource utilization, and overcome the The existing manual operation lags serious defects; in the embodiment of the present invention, the call volume control strategy set for each upstream service can realize the degradation or recovery of part of the traffic, thus solving the problem that only full traffic can only be performed in the prior art. Insufficient traffic operation can improve resource utilization and avoid cold start problems; in addition, in the embodiment of the present invention, a timing downgrading strategy can also be set, which can be set in advance before the traffic flood peak to realize automatic service downgrading, thereby improving downgrading Operational precision, reducing labor costs.

图5示出了可以应用本发明实施例的服务调用量的控制方法或服务调用量的控制装置的示例性系统架构500。Fig. 5 shows an exemplary system architecture 500 to which the method for controlling the amount of service calls or the device for controlling the amount of service calls according to the embodiments of the present invention can be applied.

如图5所示,系统架构500可以包括终端设备501、502、503,网络504和服务器505(此架构仅仅是示例,具体架构中包含的组件可以根据申请具体情况调整)。网络504用以在终端设备501、502、503和服务器505之间提供通信链路的介质。网络504可以包括各种连接类型,例如有线、无线通信链路或者光纤电缆等等。As shown in Fig. 5, the system architecture 500 may include terminal devices 501, 502, 503, a network 504 and a server 505 (this architecture is only an example, and the components contained in the specific architecture can be adjusted according to the specific conditions of the application). The network 504 is used as a medium for providing communication links between the terminal devices 501 , 502 , 503 and the server 505 . Network 504 may include various connection types, such as wires, wireless communication links, or fiber optic cables, among others.

用户可以使用终端设备501、502、503通过网络504与服务器505交互,以接收或发送消息等。终端设备501、502、503上可以安装有各种通讯客户端应用,例如购物类应用、网页浏览器应用、搜索类应用、即时通信工具、邮箱客户端、社交平台软件等(仅为示例)。Users can use terminal devices 501 , 502 , 503 to interact with server 505 through network 504 to receive or send messages and the like. Various communication client applications can be installed on the terminal devices 501, 502, and 503, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social platform software, etc. (just for example).

终端设备501、502、503可以是具有显示屏并且支持网页浏览的各种电子设备,包括但不限于智能手机、平板电脑、膝上型便携计算机和台式计算机等等。The terminal devices 501, 502, 503 may be various electronic devices with display screens and supporting web browsing, including but not limited to smart phones, tablet computers, laptop computers, desktop computers and the like.

服务器505可以是提供各种服务的服务器,例如对用户利用终端设备501、502、503所浏览的购物类网站提供支持的后台管理服务器(仅为示例)。后台管理服务器可以对接收到的产品信息查询请求等数据进行分析等处理,并将处理结果(例如目标推送信息、产品信息--仅为示例)反馈给终端设备。The server 505 may be a server that provides various services, such as a background management server that provides support for shopping websites browsed by users using the terminal devices 501 , 502 , 503 (just an example). The background management server can analyze and process the received data such as product information query requests, and feed back the processing results (such as target push information, product information—just an example) to the terminal device.

需要说明的是,本发明实施例所提供的服务调用量的控制方法一般由服务器505执行,相应地,服务调用量的控制装置一般设置于服务器505中。It should be noted that the method for controlling the amount of service calls provided by the embodiment of the present invention is generally executed by the server 505 , and correspondingly, the device for controlling the amount of service calls is generally set in the server 505 .

应该理解,图5中的终端设备、网络和服务器的数目仅仅是示意性的。根据实现需要,可以具有任意数目的终端设备、网络和服务器。It should be understood that the numbers of terminal devices, networks and servers in Fig. 5 are only illustrative. According to the implementation needs, there can be any number of terminal devices, networks and servers.

本发明还提供了一种电子设备。本发明实施例的电子设备包括:一个或多个处理器;存储装置,用于存储一个或多个程序,当所述一个或多个程序被所述一个或多个处理器执行,使得所述一个或多个处理器实现本发明所提供的服务调用量的控制方法。The invention also provides an electronic device. The electronic device in the embodiment of the present invention includes: one or more processors; a storage device for storing one or more programs, when the one or more programs are executed by the one or more processors, so that the One or more processors implement the method for controlling the amount of service calls provided by the present invention.

下面参考图6,其示出了适于用来实现本发明实施例的电子设备的计算机系统600的结构示意图。图6示出的电子设备仅仅是一个示例,不应对本发明实施例的功能和使用范围带来任何限制。Referring now to FIG. 6 , it shows a schematic structural diagram of a computer system 600 suitable for implementing an electronic device according to an embodiment of the present invention. The electronic device shown in FIG. 6 is only an example, and should not limit the functions and scope of use of this embodiment of the present invention.

如图6所示,计算机系统600包括中央处理单元(CPU)601,其可以根据存储在只读存储器(ROM)602中的程序或者从存储部分608加载到随机访问存储器(RAM)603中的程序而执行各种适当的动作和处理。在RAM603中,还存储有计算机系统600操作所需的各种程序和数据。CPU601、ROM 602以及RAM 603通过总线604彼此相连。输入/输出(I/O)接口605也连接至总线604。As shown in FIG. 6 , a computer system 600 includes a central processing unit (CPU) 601 that can be programmed according to a program stored in a read-only memory (ROM) 602 or a program loaded from a storage section 608 into a random-access memory (RAM) 603 Instead, various appropriate actions and processes are performed. In the RAM 603, various programs and data necessary for the operation of the computer system 600 are also stored. The CPU 601 , ROM 602 , and RAM 603 are connected to each other via a bus 604 . An input/output (I/O) interface 605 is also connected to the bus 604 .

以下部件连接至I/O接口605:包括键盘、鼠标等的输入部分606;包括诸如阴极射线管(CRT)、液晶显示器(LCD)等以及扬声器等的输出部分607;包括硬盘等的存储部分608;以及包括诸如LAN卡、调制解调器等的网络接口卡的通信部分609。通信部分609经由诸如因特网的网络执行通信处理。驱动器610也根据需要连接至I/O接口605。可拆卸介质611,诸如磁盘、光盘、磁光盘、半导体存储器等等,根据需要安装在驱动器610上,以便从其上读出的计算机程序根据需要被安装入存储部分608。The following components are connected to the I/O interface 605: an input section 606 including a keyboard, a mouse, etc.; an output section 607 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker; a storage section 608 including a hard disk, etc. and a communication section 609 including a network interface card such as a LAN card, a modem, or the like. The communication section 609 performs communication processing via a network such as the Internet. A drive 610 is also connected to the I/O interface 605 as needed. A removable medium 611 such as a magnetic disk, optical disk, magneto-optical disk, semiconductor memory, etc. is mounted on the drive 610 as necessary so that a computer program read therefrom is installed into the storage section 608 as necessary.

特别地,根据本发明公开的实施例,上文的主要步骤图描述的过程可以被实现为计算机软件程序。例如,本发明实施例包括一种计算机程序产品,其包括承载在计算机可读介质上的计算机程序,该计算机程序包含用于执行主要步骤图所示的方法的程序代码。在上述实施例中,该计算机程序可以通过通信部分609从网络上被下载和安装,和/或从可拆卸介质611被安装。在该计算机程序被中央处理单元601执行时,执行本发明的系统中限定的上述功能。In particular, according to the disclosed embodiments of the present invention, the process described in the main step diagram above can be implemented as a computer software program. For example, an embodiment of the present invention includes a computer program product, which includes a computer program carried on a computer-readable medium, where the computer program includes program codes for executing the method shown in the main step diagram. In the above-described embodiments, the computer program can be downloaded and installed from the network via the communication section 609, and/or installed from the removable medium 611. When this computer program is executed by the central processing unit 601, the above-mentioned functions defined in the system of the present invention are performed.

需要说明的是,本发明所示的计算机可读介质可以是计算机可读信号介质或者计算机可读存储介质或者是上述两者的任意组合。计算机可读存储介质例如可以是——但不限于——电、磁、光、电磁、红外线、或半导体的系统、装置或器件,或者任意以上的组合。计算机可读存储介质的更具体的例子可以包括但不限于:具有一个或多个导线的电连接、便携式计算机磁盘、硬盘、随机访问存储器(RAM)、只读存储器(ROM)、可擦式可编程只读存储器(EPROM或闪存)、光纤、便携式紧凑磁盘只读存储器(CD-ROM)、光存储器件、磁存储器件、或者上述的任意合适的组合。在本发明中,计算机可读存储介质可以是任何包含或存储程序的有形介质,该程序可以被指令执行系统、装置或者器件使用或者与其结合使用。在本发明中,计算机可读信号介质可以包括在基带中或者作为载波一部分传播的数据信号,其中承载了计算机可读的程序代码。这种传播的数据信号可以采用多种形式,包括但不限于电磁信号、光信号或上述任意合适的组合。计算机可读信号介质还可以是计算机可读存储介质以外的任何计算机可读介质,该计算机可读介质可以发送、传播或者传输用于由指令执行系统、装置或者器件使用或者与其结合使用的程序。计算机可读介质上包含的程序代码可以用任何适当的介质传输,包括但不限于:无线、电线、光缆、RF等等,或者上述的任意合适的组合。It should be noted that the computer-readable medium shown in the present invention may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. A computer readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or device, or any combination thereof. More specific examples of computer-readable storage media may include, but are not limited to, electrical connections with one or more wires, portable computer diskettes, hard disks, random access memory (RAM), read-only memory (ROM), erasable Programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination of the above. In the present invention, a computer-readable storage medium may be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. In the present invention, a computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code therein. Such propagated data signals may take many forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the foregoing. A computer readable signal medium may also be any computer readable medium other than a computer readable storage medium that can transmit, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.

附图中的流程图和框图,图示了按照本发明各种实施例的系统、方法和计算机程序产品的可能实现的体系架构、功能和操作。在这点上,流程图或框图中的每个方框可以代表一个模块、程序段、或代码的一部分,上述模块、程序段、或代码的一部分包含一个或多个用于实现规定的逻辑功能的可执行指令。也应当注意,在有些作为替换的实现中,方框中所标注的功能也可以以不同于附图中所标注的顺序发生。例如,两个接连地表示的方框实际上可以基本并行地执行,它们有时也可以按相反的顺序执行,这根据所涉及的功能而定。也要注意的是,框图或流程图中的每个方框、以及框图或流程图中的方框的组合,可以用执行规定的功能或操作的专用的基于硬件的系统来实现,或者可以用专用硬件与计算机指令的组合来实现。The flowchart and block diagrams in the Figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present invention. In this regard, each block in a flowchart or block diagram may represent a module, program segment, or portion of code that includes one or more logical functions for implementing specified executable instructions. It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or they may sometimes be executed in the reverse order, depending upon the functionality involved. It should also be noted that each block in the block diagrams or flowchart illustrations, and combinations of blocks in the block diagrams or flowchart illustrations, can be implemented by a dedicated hardware-based system that performs the specified function or operation, or can be implemented by a A combination of dedicated hardware and computer instructions.

描述于本发明实施例中所涉及到的单元可以通过软件的方式实现,也可以通过硬件的方式来实现。所描述的单元也可以设置在处理器中,例如,可以描述为:一种处理器包括接收单元、调用控制单元以及响应单元。其中,这些单元的名称在某种情况下并不构成对该单元本身的限定,例如,接收单元还可以被描述为“向调用控制单元提供用户请求的单元”。The units involved in the description in the embodiments of the present invention may be implemented by means of software or by means of hardware. The described units may also be set in a processor, for example, it may be described as: a processor includes a receiving unit, a calling control unit, and a responding unit. Wherein, the names of these units do not limit the unit itself under certain circumstances, for example, the receiving unit may also be described as "a unit that provides user requests to the calling control unit".

作为另一方面,本发明还提供了一种计算机可读介质,该计算机可读介质可以是上述实施例中描述的设备中所包含的;也可以是单独存在,而未装配入该设备中的。上述计算机可读介质承载有一个或者多个程序,当上述一个或者多个程序被该设备执行时,使得该设备执行的步骤包括:接收调用本地服务的用户请求;其中,所述本地服务依赖于至少一个上游服务;在所述用户请求正常调用所述本地服务时,利用预先存储的、所述至少一个上游服务中每一上游服务的当前调用量控制策略,确定所述用户请求是否正常调用该上游服务:若是,返回该上游服务的正常调用数据;否则,返回该上游服务的默认数据;以及,根据每一上游服务返回的正常调用数据或默认数据生成响应信息向用户返回。As another aspect, the present invention also provides a computer-readable medium. The computer-readable medium may be contained in the device described in the above embodiments; . The above computer-readable medium bears one or more programs, and when the one or more programs are executed by the device, the steps performed by the device include: receiving a user request for invoking a local service; wherein the local service depends on At least one upstream service; when the user requests to call the local service normally, determine whether the user request calls the local service normally by using a pre-stored current call volume control strategy for each upstream service in the at least one upstream service Upstream service: if yes, return the normal call data of the upstream service; otherwise, return the default data of the upstream service; and generate response information according to the normal call data or default data returned by each upstream service and return it to the user.

根据本发明实施例的技术方案,通过为每一上游服务设置多条调用量控制策略,并根据实时采集的每一上游服务的运行数据获取其性能、可用率等运行指标,进而利用运行指标等参数从其调用量控制策略中确定当前调用量控制策略来调整降级或恢复的调用量比例,从而实现上游服务调用量的自动控制,提高系统的灵敏性、可用性以及服务资源利用率,克服了现有的手动操作滞后严重的缺陷;在本发明实施例中,为每一上游服务设置的调用量控制策略均可实现部分流量的降级或恢复,由此可解决现有技术中只能进行全流量操作的不足,提升资源利用率,避免产生冷启动问题;此外,在本发明实施例中,还可设置定时降级策略,在流量洪峰来临之前提前设置即可实现服务的自动降级,从而提高降级操作精度,减少人力成本。According to the technical solution of the embodiment of the present invention, by setting multiple call volume control strategies for each upstream service, and obtaining its performance, availability and other operating indicators according to the operating data of each upstream service collected in real time, and then using the operating indicators, etc. Parameters determine the current call volume control strategy from its call volume control strategy to adjust the proportion of downgraded or restored calls, thereby realizing automatic control of upstream service calls, improving system sensitivity, availability, and service resource utilization, and overcoming existing problems. Some manual operations have a serious lagging defect; in the embodiment of the present invention, the call volume control strategy set for each upstream service can realize the degradation or recovery of part of the traffic, thus solving the problem of only full traffic in the prior art Insufficient operation can improve resource utilization and avoid cold start problems; in addition, in the embodiment of the present invention, a timing downgrading strategy can also be set, which can be set in advance before the traffic flood peak to realize automatic service downgrading, thereby improving downgrading operation Accuracy, reduce labor cost.

上述具体实施方式,并不构成对本发明保护范围的限制。本领域技术人员应该明白的是,取决于设计要求和其他因素,可以发生各种各样的修改、组合、子组合和替代。任何在本发明的精神和原则之内所作的修改、等同替换和改进等,均应包含在本发明保护范围之内。The above specific implementation methods do not constitute a limitation to the protection scope of the present invention. It should be apparent to those skilled in the art that various modifications, combinations, sub-combinations and substitutions may occur depending on design requirements and other factors. Any modifications, equivalent replacements and improvements made within the spirit and principles of the present invention shall be included within the protection scope of the present invention.

Claims (18)

1. A method for controlling a service call amount, comprising:
setting a plurality of call quantity control strategies for each upstream service on which the local service depends; wherein the plurality of call volume control policies includes at least one demotion policy, each demotion policy including a demotion condition to a corresponding call volume demotion ratio;
receiving a user request for calling the local service;
when the user requests to normally call the local service, determining whether the user requests to normally call the upstream service by using a pre-stored current call quantity control strategy of each upstream service in the at least one upstream service: if yes, returning the normal calling data of the upstream service; otherwise, returning default data of the upstream service; in the case that the current call volume control policy of any upstream service is a degradation policy, the current call volume control policy of the upstream service is selected from a plurality of call volume control policies set for the upstream service according to operation data of the upstream service or current time;
And generating response information according to the normal call data or default data returned by each upstream service and returning the response information to the user.
2. The method of claim 1, wherein the plurality of call volume control policies further comprises at least one restoration policy;
when the upstream service is in a full-scale degradation state, selecting a recovery strategy of the upstream service as a current call volume control strategy of the upstream service and storing the recovery strategy; and when the upstream service is not in the full-volume degradation state, selecting and storing a degradation strategy of the upstream service as a current call volume control strategy of the upstream service.
3. The method of claim 2, wherein the downgrade policy comprises: at least one performance downgrade policy, each downgrade policy including a downgrade condition to call volume downgrade ratio; and selecting a demotion policy of the upstream service as a current call volume control policy of the upstream service includes:
collecting operation data of the upstream service, and counting the operation data to obtain performance indexes of the upstream service in a current counting period;
in the performance degradation strategy of the upstream service, determining a performance degradation strategy with degradation conditions matched with the performance index of the current statistical period, and taking the performance degradation strategy as a primary call quantity control strategy of the upstream service; and determining the largest calling quantity degradation proportion in the initially selected calling quantity control strategy as the current calling quantity control strategy of the upstream service.
4. The method of claim 3, wherein the downgrade policy further comprises: at least one availability downgrade policy; and selecting a demotion policy of the upstream service as a current call volume control policy of the upstream service includes:
acquiring an availability index of the upstream service in a plurality of statistical periods nearest to the current moment according to the operation data;
and determining an availability degradation strategy with degradation conditions matched with the availability index from the availability degradation strategies of the upstream service, and taking the availability degradation strategy as a primary call volume control strategy of the upstream service.
5. The method of claim 4, wherein the downgrade policy further comprises: at least one timing downgrade strategy, the downgrade condition of each timing downgrade strategy is a downgrade time interval; and selecting a demotion policy of the upstream service as a current call volume control policy of the upstream service includes:
and determining that the degradation time interval contains the timing degradation strategy of the current moment in the timing degradation strategy of the upstream service, and taking the timing degradation strategy as the initial call quantity control strategy of the upstream service.
6. The method of any of claims 3-5, wherein each of the at least one recovery policy includes a call volume degradation ratio, the user request carrying a user identification; and determining whether the user request normally invokes each of the at least one upstream service using a pre-stored current invocation quantity control policy for the upstream service, comprising:
Converting the user identification into a hash value between 0 and 1;
when the hash value is smaller than the calling quantity degradation proportion in the current calling quantity control strategy, controlling the upstream service not to provide calling for the user request;
and controlling the upstream service to provide calling for the user request when the hash value is not smaller than the calling degradation proportion in the current calling quantity control strategy.
7. The method according to claim 1, wherein the method further comprises: pre-storing a current call volume control strategy of the local service; and the user requesting normal invocation of the local service includes:
and determining that the user requests to normally call the local service by using the current call quantity control strategy of the local service.
8. The method of claim 6, wherein the default data comprises: the upstream service returns the last time normal call data or null value; the operation data includes: each call state and each response time of the upstream service; the performance index includes at least one of: response time percentage TP indicator, response time maximum value, response time average value.
9. A control device for a service call amount, comprising:
the current strategy acquisition unit is used for setting a plurality of call quantity control strategies for each upstream service on which the local service depends; wherein the plurality of call volume control policies includes at least one demotion policy, each demotion policy including a demotion condition to a corresponding call volume demotion ratio;
a receiving unit, configured to receive a user request for invoking the local service;
a call control unit, configured to determine, when the user requests to call the local service normally, whether the user requests to call the upstream service normally, by using a pre-stored current call volume control policy of each upstream service in the at least one upstream service: if yes, returning the normal calling data of the upstream service; otherwise, returning default data of the upstream service; in the case that the current call volume control policy of any upstream service is a degradation policy, the current call volume control policy of the upstream service is selected from a plurality of call volume control policies set for the upstream service according to operation data of the upstream service or current time;
and the response unit is used for generating response information according to the normal call data or default data returned by each upstream service and returning the response information to the user.
10. The apparatus of claim 9, wherein the plurality of call volume control policies further comprises at least one recovery policy; and, the current policy obtaining unit is further configured to:
when the upstream service is in a full-scale degradation state, selecting a recovery strategy of the upstream service as a current call volume control strategy of the upstream service and storing the recovery strategy; and when the upstream service is not in the full-volume degradation state, selecting and storing a degradation strategy of the upstream service as a current call volume control strategy of the upstream service.
11. The apparatus of claim 10, wherein the downgrade policy comprises: at least one performance downgrade policy, each downgrade policy including a downgrade condition to call volume downgrade ratio; the method comprises the steps of,
the current policy obtaining unit is further configured to: collecting operation data of the upstream service, and counting the operation data to obtain performance indexes of the upstream service in a current counting period; in the performance degradation strategy of the upstream service, determining a performance degradation strategy with degradation conditions matched with the performance index of the current statistical period, and taking the performance degradation strategy as a primary call quantity control strategy of the upstream service; and determining the largest calling quantity degradation proportion in the initially selected calling quantity control strategy as the current calling quantity control strategy of the upstream service.
12. The apparatus of claim 11, wherein the downgrade policy further comprises: at least one availability downgrade policy; the method comprises the steps of,
the current policy obtaining unit is further configured to: acquiring an availability index of the upstream service in a plurality of statistical periods nearest to the current moment according to the operation data; and determining an availability degradation strategy with degradation conditions matched with the availability index from the availability degradation strategies of the upstream service, and taking the availability degradation strategy as a primary call volume control strategy of the upstream service.
13. The apparatus of claim 12, wherein the downgrade policy further comprises: at least one timing downgrade strategy, the downgrade condition of each timing downgrade strategy is a downgrade time interval; the method comprises the steps of,
the current policy obtaining unit is further configured to: and determining that the degradation time interval contains the timing degradation strategy of the current moment in the timing degradation strategy of the upstream service, and taking the timing degradation strategy as the initial call quantity control strategy of the upstream service.
14. The apparatus of any of claims 11-13, wherein each of the at least one recovery policy includes a call volume degradation ratio, the user request carrying a user identification; the method comprises the steps of,
The call control unit is further configured to: converting the user identification into a hash value between 0 and 1; when the hash value is smaller than the calling quantity degradation proportion in the current calling quantity control strategy, controlling the upstream service not to provide calling for the user request; and controlling the upstream service to provide calling for the user request when the hash value is not smaller than the calling degradation proportion in the current calling quantity control strategy.
15. The apparatus of claim 9, wherein the current policy acquisition unit is further to: pre-storing a current call volume control strategy of the local service; the method comprises the steps of,
the call control unit is further configured to: and determining that the user requests to normally call the local service by using the current call quantity control strategy of the local service.
16. The apparatus of claim 14, wherein the default data comprises: the upstream service returns the last time normal call data or null value; the operation data includes: each call state and each response time of the upstream service; the performance index includes at least one of: response time percentage TP indicator, response time maximum value, response time average value.
17. An electronic device, comprising:
one or more processors;
storage means for storing one or more programs,
when executed by the one or more processors, causes the one or more processors to implement the method of any of claims 1-8.
18. A computer readable storage medium, on which a computer program is stored, characterized in that the program, when being executed by a processor, implements the method according to any of claims 1-8.
CN201810068708.9A 2018-01-24 2018-01-24 Service call quantity control method and device Active CN110071952B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810068708.9A CN110071952B (en) 2018-01-24 2018-01-24 Service call quantity control method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810068708.9A CN110071952B (en) 2018-01-24 2018-01-24 Service call quantity control method and device

Publications (2)

Publication Number Publication Date
CN110071952A CN110071952A (en) 2019-07-30
CN110071952B true CN110071952B (en) 2023-08-08

Family

ID=67365503

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810068708.9A Active CN110071952B (en) 2018-01-24 2018-01-24 Service call quantity control method and device

Country Status (1)

Country Link
CN (1) CN110071952B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111131058B (en) * 2019-11-25 2023-06-30 泰康保险集团股份有限公司 Access quantity control method and device
CN113778730B (en) * 2021-01-28 2024-04-05 北京京东乾石科技有限公司 Service degradation method and device for distributed system
CN112965836B (en) * 2021-03-04 2024-04-23 北京百度网讯科技有限公司 Service control method, device, electronic device and readable storage medium

Citations (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102365631A (en) * 2009-01-28 2012-02-29 海德沃特合作I有限公司 Verifiable device assisted service policy implementation
CN103370903A (en) * 2010-11-17 2013-10-23 阿尔卡特朗讯 Method and system for client recovery strategy in a redundant server configuration
CN103428241A (en) * 2012-05-18 2013-12-04 中兴通讯股份有限公司 Method and system for deploying services
WO2016046545A1 (en) * 2014-09-26 2016-03-31 Silverstring Ltd. Disaster recovery system
CN105656962A (en) * 2014-11-11 2016-06-08 阿里巴巴集团控股有限公司 Service calling method and device
CN105872028A (en) * 2016-03-25 2016-08-17 努比亚技术有限公司 Server, client, and access policy management method
CN106294073A (en) * 2016-08-15 2017-01-04 合智能科技(深圳)有限公司 Service calling method and device
CN106487708A (en) * 2015-08-25 2017-03-08 阿里巴巴集团控股有限公司 Network access request control method and device
CN107196785A (en) * 2017-03-31 2017-09-22 北京奇艺世纪科技有限公司 The method and device that back-end services degrade automatically
CN107454004A (en) * 2016-05-30 2017-12-08 阿里巴巴集团控股有限公司 A kind of flow control methods and device
CN107547744A (en) * 2017-08-31 2018-01-05 广东欧珀移动通信有限公司 Resource allocation method and Related product
CN107592219A (en) * 2017-09-04 2018-01-16 北京潘达互娱科技有限公司 Service degradation processing method and processing device

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8176180B2 (en) * 2007-06-04 2012-05-08 International Business Machines Corporation Dynamically matching data service capabilities to data service level objectives

Patent Citations (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102365631A (en) * 2009-01-28 2012-02-29 海德沃特合作I有限公司 Verifiable device assisted service policy implementation
CN103370903A (en) * 2010-11-17 2013-10-23 阿尔卡特朗讯 Method and system for client recovery strategy in a redundant server configuration
CN103428241A (en) * 2012-05-18 2013-12-04 中兴通讯股份有限公司 Method and system for deploying services
WO2016046545A1 (en) * 2014-09-26 2016-03-31 Silverstring Ltd. Disaster recovery system
CN105656962A (en) * 2014-11-11 2016-06-08 阿里巴巴集团控股有限公司 Service calling method and device
CN106487708A (en) * 2015-08-25 2017-03-08 阿里巴巴集团控股有限公司 Network access request control method and device
CN105872028A (en) * 2016-03-25 2016-08-17 努比亚技术有限公司 Server, client, and access policy management method
CN107454004A (en) * 2016-05-30 2017-12-08 阿里巴巴集团控股有限公司 A kind of flow control methods and device
CN106294073A (en) * 2016-08-15 2017-01-04 合智能科技(深圳)有限公司 Service calling method and device
CN107196785A (en) * 2017-03-31 2017-09-22 北京奇艺世纪科技有限公司 The method and device that back-end services degrade automatically
CN107547744A (en) * 2017-08-31 2018-01-05 广东欧珀移动通信有限公司 Resource allocation method and Related product
CN107592219A (en) * 2017-09-04 2018-01-16 北京潘达互娱科技有限公司 Service degradation processing method and processing device

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
"流水线Web服务器KETA服务器KETA上QoS控制机制的研究与实现";刘进元;《中国优秀硕士学位论文全文数据库 信息科技辑》;20061015;全文 *

Also Published As

Publication number Publication date
CN110071952A (en) 2019-07-30

Similar Documents

Publication Publication Date Title
CN111124819B (en) Method and device for full link monitoring
CN111131058B (en) Access quantity control method and device
US7984161B2 (en) Optimizing mobile device synchronization with multiple data sources
US9207983B2 (en) Methods for adapting application services based on current server usage and devices thereof
CN113517985B (en) File data processing method and device, electronic equipment and computer readable medium
CN113760982A (en) A data processing method and device
CN108616429A (en) A kind of reconnection method and equipment of Push Service
CN109936613A (en) Disaster recovery method and device applied to server
CN110071952B (en) Service call quantity control method and device
CN113535313B (en) A pop-up window display method and device
CN113656239B (en) Monitoring method, device and computer program product for middleware
CN120342963A (en) A method, device, electronic device and storage medium for fusing
CN109428926A (en) A kind of method and apparatus of scheduler task node
CN117851182A (en) CMDB-based Kubernetes resource monitoring method and system
CN115242799B (en) Data reporting method, device, equipment, storage medium and program product
CN105262634A (en) Monitoring threshold generation method, device and system
CN112910855A (en) Sample message processing method and device
WO2024066374A1 (en) Service degradation method and apparatus, device, computer-readable medium and program product
CN114374657B (en) Data processing method and device
CN113778730B (en) Service degradation method and device for distributed system
CN115543416A (en) A configuration update method, device, electronic equipment and storage medium
US20180123866A1 (en) Method and apparatus for determining event level of monitoring result
CN116521639A (en) Log data processing method, electronic equipment and computer readable medium
CN116362731A (en) A business processing method, device, electronic device, and computer-readable medium
CN110493291A (en) A method and device for processing HTTP requests

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant