CN117692518A - Service scheduling method, device, equipment and storage medium - Google Patents
Service scheduling method, device, equipment and storage medium Download PDFInfo
- Publication number
- CN117692518A CN117692518A CN202311796310.4A CN202311796310A CN117692518A CN 117692518 A CN117692518 A CN 117692518A CN 202311796310 A CN202311796310 A CN 202311796310A CN 117692518 A CN117692518 A CN 117692518A
- Authority
- CN
- China
- Prior art keywords
- business
- service
- result
- buffer
- data
- 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.)
- Pending
Links
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/50—Network services
- H04L67/60—Scheduling or organising the servicing of application requests, e.g. requests for application data transmissions using the analysis and optimisation of the required network resources
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/50—Network services
- H04L67/56—Provisioning of proxy services
- H04L67/568—Storing data temporarily at an intermediate stage, e.g. caching
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/50—Network services
- H04L67/60—Scheduling or organising the servicing of application requests, e.g. requests for application data transmissions using the analysis and optimisation of the required network resources
- H04L67/63—Routing a service request depending on the request content or context
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
本发明公开了一种服务调度方法、装置、设备及存储介质,该方法包括:当接收到业务端处理业务数据的业务请求时,在缓冲区中查询是否存在外部服务处理业务数据得到的业务结果;若是,则将缓冲区中的业务结果发送至业务端;若否,则依据业务请求调用外部服务处理业务数据;等待外部服务处理业务数据得到的业务结果;若等待业务结果超时,则将失败信息发送至业务端,以使业务端触发处理相同业务数据的业务请求,以及,继续等待业务结果;若超时后等待到业务结果,则在缓冲区中存储业务结果。实现了慢响应,针对业务端多次的业务请求,均实现一次的调度外部服务的操作,大大提高了资源的利用效率,减轻了系统的负担。
The invention discloses a service scheduling method, device, equipment and storage medium. The method includes: when receiving a business request for a business end to process business data, querying in the buffer whether there is a business result obtained by an external service processing the business data. ; If yes, send the business result in the buffer to the business end; if not, call the external service to process the business data according to the business request; wait for the business result obtained by the external service to process the business data; if the wait for the business result times out, it will fail The information is sent to the business end, so that the business end triggers a business request to process the same business data, and continues to wait for the business result; if the business result is waited for after timeout, the business result is stored in the buffer. Slow response is achieved. For multiple business requests from the business end, external service operations are scheduled once, which greatly improves resource utilization efficiency and reduces the burden on the system.
Description
技术领域Technical field
本发明涉及网络通信的技术领域,尤其涉及一种服务调度方法、装置、设备及存储介质。The present invention relates to the technical field of network communications, and in particular, to a service scheduling method, device, equipment and storage medium.
背景技术Background technique
在系统集群中,经常请求为系统集群提供的外部服务,以实现某些业务,例如,身份认证、绑定银行卡、使用其他系统的账号跨域登录,等等。In the system cluster, external services provided for the system cluster are often requested to implement certain services, such as identity authentication, binding bank cards, cross-domain login using accounts of other systems, etc.
这些外部服务可能存在不稳定性、也可能调用其他系统造成延迟,这些因素均有可能对系统集群的性能产生负面影响,在系统集群存在大量并发的请求时,负面影响尤为明显。These external services may be unstable or may call other systems to cause delays. These factors may have a negative impact on the performance of the system cluster. The negative impact is particularly obvious when there are a large number of concurrent requests in the system cluster.
为了保障系统集群的性能,目前多使用限流算法、负载均衡算法等方式对请求进行削峰,对于单一的请求,大多是设置超时机制,在超时时,结束请求。In order to ensure the performance of the system cluster, current limiting algorithms, load balancing algorithms and other methods are currently used to cut the peak of requests. For a single request, a timeout mechanism is mostly set, and when the timeout occurs, the request is terminated.
但是,结束请求意味着系统集群、外部服务的操作无效,浪费资源,并且,后续重新发起相同的请求时,系统集群、外部服务重复相同的操作,增加了负担,导致请求的响应效率较低。However, ending the request means that the operations of the system cluster and external services are invalid and waste resources. Moreover, when the same request is subsequently re-initiated, the system cluster and external services repeat the same operations, which increases the burden and results in low response efficiency to the request.
发明内容Contents of the invention
本发明提供了一种服务调度方法、装置、设备及存储介质,以解决如何提高调用外部服务的效率的问题。The present invention provides a service scheduling method, device, equipment and storage medium to solve the problem of how to improve the efficiency of calling external services.
根据本发明的一方面,提供了一种服务调度方法,包括:According to one aspect of the present invention, a service scheduling method is provided, including:
当接收到业务端处理业务数据的业务请求时,在缓冲区中查询是否存在外部服务处理所述业务数据得到的业务结果;When receiving a service request for the business end to process business data, query in the buffer whether there is a business result obtained by the external service processing the business data;
若是,则将所述缓冲区中的所述业务结果发送至所述业务端;If so, send the business result in the buffer to the business end;
若否,则依据所述业务请求调用外部服务处理所述业务数据;If not, call an external service to process the business data according to the business request;
等待所述外部服务处理所述业务数据得到的业务结果;Waiting for the business results obtained by the external service from processing the business data;
若等待所述业务结果超时,则将失败信息发送至所述业务端,以使所述业务端触发处理相同所述业务数据的业务请求,以及,继续等待所述业务结果;If waiting for the service result times out, send failure information to the business end, so that the business end triggers a service request to process the same service data, and continues to wait for the service result;
若超时后等待到所述业务结果,则在所述缓冲区中存储所述业务结果。If the service result is waited for after timeout, the service result is stored in the buffer.
根据本发明的另一方面,提供了一种服务调度装置,包括:According to another aspect of the present invention, a service scheduling device is provided, including:
缓冲区查询模块,用于当接收到业务端处理业务数据的业务请求时,在缓冲区中查询是否存在外部服务处理所述业务数据得到的业务结果;若是,则执行业务结果发送模块,若否,则执行服务调用模块;The buffer query module is used to query in the buffer whether there is a business result obtained by the external service processing the business data when receiving a service request from the business end to process the business data; if so, execute the business result sending module, if not , then execute the service calling module;
业务结果发送模块,用于将所述缓冲区中的所述业务结果发送至所述业务端;A business result sending module, configured to send the business result in the buffer to the business end;
服务调用模块,用于依据所述业务请求调用外部服务处理所述业务数据;A service calling module, used to call external services to process the business data according to the business request;
业务结果等待模块,用于等待所述外部服务处理所述业务数据得到的业务结果;A business result waiting module, used to wait for the business results obtained by the external service from processing the business data;
失败处理模块,用于若等待所述业务结果超时,则将失败信息发送至所述业务端,以使所述业务端触发处理相同所述业务数据的业务请求,以及,继续等待所述业务结果;A failure processing module, configured to send failure information to the business end if waiting for the business result times out, so that the business end triggers processing of a business request for the same business data, and continues to wait for the business result. ;
业务结果存储模块,用于若超时后等待到所述业务结果,则在所述缓冲区中存储所述业务结果。The service result storage module is configured to store the service result in the buffer if the service result is waited for after a timeout.
根据本发明的另一方面,提供了一种电子设备,所述电子设备包括:According to another aspect of the present invention, an electronic device is provided, the electronic device including:
至少一个处理器;以及at least one processor; and
与所述至少一个处理器通信连接的存储器;其中,a memory communicatively connected to the at least one processor; wherein,
所述存储器存储有可被所述至少一个处理器执行的计算机程序,所述计算机程序被所述至少一个处理器执行,以使所述至少一个处理器能够执行本发明任一实施例所述的服务调度方法。The memory stores a computer program that can be executed by the at least one processor, and the computer program is executed by the at least one processor, so that the at least one processor can execute the method described in any embodiment of the present invention. Service scheduling methods.
根据本发明的另一方面,提供了一种计算机可读存储介质,所述计算机可读存储介质存储有计算机程序,所述计算机程序用于使处理器执行时实现本发明任一实施例所述的服务调度方法。According to another aspect of the present invention, a computer-readable storage medium is provided. The computer-readable storage medium stores a computer program. The computer program is used to implement any embodiment of the present invention when executed by a processor. service scheduling method.
在本实施例中,当接收到业务端处理业务数据的业务请求时,在缓冲区中查询是否存在外部服务处理业务数据得到的业务结果;若是,则将缓冲区中的业务结果发送至业务端;若否,则依据业务请求调用外部服务处理业务数据;等待外部服务处理业务数据得到的业务结果;若等待业务结果超时,则将失败信息发送至业务端,以使业务端触发处理相同业务数据的业务请求,以及,继续等待业务结果;若超时后等待到业务结果,则在缓冲区中存储业务结果。在初次请求超时时,主动断开请求,避免长时间等待远程调度外部服务的响应,可以保障响应的效率,减少业务端与外部服务的耦合度,削弱外部服务对业务端的影响,而异步保持外部服务处理业务数据,并将外部服务处理业务数据得到的业务结果保存到缓冲区,使得再次请求时,快速获取响应的业务结果,实现了慢响应,针对业务端多次的业务请求,均实现一次的调度外部服务的操作,大大提高了资源的利用效率,减轻了系统的负担。In this embodiment, when receiving a service request for the business end to process business data, the buffer is queried to see if there is a business result obtained by the external service processing the business data; if so, the business result in the buffer is sent to the business end. ; If not, call the external service to process the business data according to the business request; wait for the business result obtained by the external service to process the business data; if the waiting for the business result times out, send the failure information to the business end so that the business end triggers the processing of the same business data business request, and continue to wait for the business result; if the business result is waited for after timeout, the business result is stored in the buffer. When the initial request times out, actively disconnect the request to avoid long waiting for the response of the remote dispatch external service. This can ensure the efficiency of the response, reduce the coupling between the business end and the external service, weaken the impact of the external service on the business end, and maintain the external service asynchronously. The service processes business data and saves the business results obtained by the external service processing business data into the buffer, so that when the request is made again, the response business results can be obtained quickly, realizing slow response, and achieving one time for multiple business requests from the business end. The operation of scheduling external services greatly improves the efficiency of resource utilization and reduces the burden on the system.
应当理解,本部分所描述的内容并非旨在标识本发明的实施例的关键或重要特征,也不用于限制本发明的范围。本发明的其它特征将通过以下的说明书而变得容易理解。It should be understood that what is described in this section is not intended to identify key or important features of the embodiments of the invention, nor is it intended to limit the scope of the invention. Other features of the present invention will become easily understood from the following description.
附图说明Description of the drawings
为了更清楚地说明本发明实施例中的技术方案,下面将对实施例描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings needed to be used in the description of the embodiments will be briefly introduced below. Obviously, the drawings in the following description are only some embodiments of the present invention. For those of ordinary skill in the art, other drawings can also be obtained based on these drawings without exerting creative efforts.
图1是根据本发明实施例一提供的一种服务调度方法的流程图;Figure 1 is a flow chart of a service scheduling method provided according to Embodiment 1 of the present invention;
图2是根据本发明实施例一提供的一种削峰器的结构示意图;Figure 2 is a schematic structural diagram of a peak clipper provided according to Embodiment 1 of the present invention;
图3是根据本发明实施例二提供的一种服务调度装置的结构示意图;Figure 3 is a schematic structural diagram of a service scheduling device provided according to Embodiment 2 of the present invention;
图4是根据本发明实施例三提供的一种电子设备的结构示意图。FIG. 4 is a schematic structural diagram of an electronic device according to Embodiment 3 of the present invention.
具体实施方式Detailed ways
为了使本技术领域的人员更好地理解本发明方案,下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本发明一部分的实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都应当属于本发明保护的范围。In order to enable those skilled in the art to better understand the solutions of the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only These are some embodiments of the present invention, rather than all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts should fall within the scope of protection of the present invention.
需要说明的是,本发明的说明书和权利要求书及上述附图中的术语“第一”、“第二”等是用于区别类似的对象,而不必用于描述特定的顺序或先后次序。应该理解这样使用的数据在适当情况下可以互换,以便这里描述的本发明的实施例能够涵盖除了在这里图示或描述的那些以外的顺序实施。此外,术语“包括”和“具有”以及他们的任何变形,意图在于覆盖不排他的包含,例如,包含了一系列步骤或单元的过程、方法、系统、产品或设备不必限于清楚地列出的那些步骤或单元,而是可包括没有清楚地列出的或对于这些过程、方法、产品或设备固有的其它步骤或单元。It should be noted that the terms "first", "second", etc. in the description and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It is to be understood that the figures so used are interchangeable under appropriate circumstances so that the embodiments of the invention described herein are capable of encompassing sequential implementations in addition to those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, e.g., a process, method, system, product, or apparatus that encompasses a series of steps or units and need not be limited to those explicitly listed. Those steps or elements may instead include other steps or elements not expressly listed or inherent to the process, method, product or apparatus.
实施例一Embodiment 1
图1为本发明实施例一提供的一种服务调度方法的流程图,本实施例可适用于使用异步超时控制机制(Asynchronous Timeout Control Mechanism)处理业务端调度外部服务的情况,该方法可以由服务调度装置来执行,该服务调度装置可以采用硬件和/或软件的形式实现,该服务调度装置可配置于电子设备中。如图1所示,该方Figure 1 is a flow chart of a service scheduling method provided by Embodiment 1 of the present invention. This embodiment can be applied to the situation where the business end schedules external services using an asynchronous timeout control mechanism (Asynchronous Timeout Control Mechanism). This method can be used by the service The service scheduling device can be implemented in the form of hardware and/or software, and the service scheduling device can be configured in an electronic device. As shown in Figure 1, this method
法包括:Laws include:
步骤101、当接收到业务端处理业务数据的业务请求时,在缓冲区中查询是否存在外部服务处理业务数据得到的业务结果;若是,则执行步骤102,若否,则执行步骤103。Step 101: When receiving a service request from the business end to process business data, query the buffer to see if there is a business result obtained by processing the business data by an external service; if yes, execute step 102; if not, execute step 103.
如图2所示,在系统集群(尤其为分布式系统)中具有业务端(又称业务系统)与削峰器,在系统集群外部具有多个服务(即外部服务),这些外部服务可以以API(ApplicationProgramming Interface,应用程序编程接口)的形式暴露给多个业务端。As shown in Figure 2, there are business terminals (also called business systems) and peak clippers in the system cluster (especially distributed systems), and there are multiple services (ie external services) outside the system cluster. These external services can be It is exposed to multiple business ends in the form of API (Application Programming Interface, application programming interface).
其中,各个业务端是负责系统集群中一个或多个业务的代码的集合,削峰器以中间件等形式设置在业务端与外部服务之间,削峰器既独立于业务端、也独立于外部服务,削峰器是部分或全部业务端的公共服务,支持复用,提供标准、统一的公共服务,可以为部分或全部业务端提供调度部分或全部外部服务的功能,达到削峰的目的。Among them, each business end is a collection of codes responsible for one or more businesses in the system cluster. The peak clipper is set between the business end and external services in the form of middleware. The peak clipper is independent of both the business end and the external service. External services, peak clippers are public services for some or all business ends. They support reuse and provide standard and unified public services. They can provide the function of scheduling some or all external services for some or all business ends to achieve the purpose of peak clipping.
削峰器屏蔽了不同外部服务在底层通信的API接口的差异,实现互操作,为业务端提供通信支持,减少业务端的开发工作量,缩短业务端的开发时间。Peak Clipper shields the differences in the underlying communication API interfaces of different external services, achieves interoperability, provides communication support for the business end, reduces the development workload of the business end, and shortens the development time of the business end.
在削峰器中设置有调度器,调度器以线程等方式实现,由于调度器在削峰器中发挥主体调度的作用,因而调度器又称为主线程。A scheduler is provided in the peak clipper, and the scheduler is implemented in the form of threads. Since the scheduler plays the main scheduling role in the peak clipper, the scheduler is also called the main thread.
调度器可以接收业务端在处理业务数据时的业务请求,该业务请求用于请求相应的外部服务处理业务数据,得到业务结果。The scheduler can receive business requests from the business end when processing business data. The business requests are used to request corresponding external services to process business data and obtain business results.
示例性地,对于身份认证的业务,业务数据为用户的身份信息(如姓名、证件类型、证件号码等),身份信息由用户提供给系统集群,系统集群将身份信息分配给负责身份认证的业务端,该业务端调用负责身份认证的外部服务对用户的身份信息进行认证。For example, for the identity authentication business, the business data is the user's identity information (such as name, certificate type, certificate number, etc.). The identity information is provided by the user to the system cluster, and the system cluster allocates the identity information to the business responsible for identity authentication. The business end calls the external service responsible for identity authentication to authenticate the user's identity information.
进一步地,部分业务端可能部署在第三方的云端上,按照云端的规范,业务端在实现某些业务时,统一调用云端提供的外部服务,该外部服务再次调用独立于云端的、提供该业务的系统,使得调度的链路较长,不可预测性较大,容易发生服务质量异常、超时等情况。Furthermore, some business terminals may be deployed on a third-party cloud. According to cloud specifications, when implementing certain services, the business terminals uniformly call external services provided by the cloud. The external services again call independent cloud services that provide the business. The system makes the scheduled link longer, more unpredictable, and prone to abnormal service quality, timeout, etc.
对此,本实施例提供异步超时控制机制,在削峰器中设置有缓冲区(buffer),缓冲区在内存空间中为削峰器预留的的存储空间,这些存储空间用来异步缓冲外部服务处理业务数据得到的业务结果。In this regard, this embodiment provides an asynchronous timeout control mechanism. A buffer is provided in the peak clipper. The buffer is a storage space reserved for the peak clipper in the memory space. These storage spaces are used to asynchronously buffer external data. The business results obtained by services processing business data.
调度器可接收到业务端处理业务数据的业务请求,该业务请求可能是业务端首次请求处理业务数据,也可能是业务端非首次请求处理相同的业务数据,调度器并不关心该业务请求的情况,均可以在缓冲区中查询是否存在处理业务数据得到的业务结果。The scheduler can receive a business request from the business end to process business data. The business request may be the first time the business end requests to process business data, or it may be a non-first time request from the business end to process the same business data. The scheduler does not care about the business request. In any case, you can query the buffer to see whether there are business results obtained by processing business data.
在具体实现中,业务端按照削峰器的规范,在生成业务请求时,使用MD5(MessageDigest Algorithm 5,信息摘要算法)、SHA(Secure Hash Algorithm,安全散列算法)等算法依据业务数据生成唯一的唯一标识值,并将业务数据与唯一标识值写入业务请求中。In the specific implementation, the business end follows the specifications of the peak clipper and uses algorithms such as MD5 (MessageDigest Algorithm 5, message digest algorithm) and SHA (Secure Hash Algorithm, secure hash algorithm) to generate a unique message based on the business data when generating a service request. unique identification value, and write the business data and unique identification value into the business request.
此外,缓冲区中存储标识值与业务结果(数据载荷)构成的双列集合队列。In addition, the buffer stores a double-column collection queue composed of identification value and business result (data load).
那么,调度器可以在业务请求中指定的位置读取依据业务数据生成的业务标识值,在缓冲区中以业务标识值为索引,查询是否存在外部服务处理业务数据得到的业务结果,即,遍历缓冲区中存储的业务标识,判断缓冲区中存储的业务标识与当前业务请求的业务标识是否相同。Then, the scheduler can read the business identification value generated based on the business data at the location specified in the business request, use the business identification value as an index in the buffer, and query whether there is a business result obtained by the external service processing the business data, that is, traverse The service identifier stored in the buffer is used to determine whether the service identifier stored in the buffer is the same as the service identifier of the current service request.
如果缓冲区中存储的某个业务标识与当前业务请求的业务标识相同,则可以确定在缓冲区中存在外部服务处理业务数据得到的业务结果,即,该业务标识值为索引对应的业务结果为外部服务处理业务数据得到的业务结果。If a business ID stored in the buffer is the same as the business ID of the current business request, it can be determined that there is a business result obtained by the external service processing the business data in the buffer, that is, the business result corresponding to the index value of the business ID is Business results obtained by external services processing business data.
如果缓冲区中存储的任一业务标识与当前业务请求的业务标识相同,则可以确定在缓冲区中不存在外部服务处理业务数据得到的业务结果。If any service identifier stored in the buffer is the same as the service identifier of the current service request, it can be determined that there is no business result obtained by the external service processing the business data in the buffer.
步骤102、将缓冲区中的业务结果发送至业务端。Step 102: Send the business results in the buffer to the business end.
如图2所示,如果在缓冲区中查询到存在外部服务处理业务数据得到的业务结果,则调度器可以从缓冲区中读取外部服务处理业务数据得到的业务结果,以及,将该业务结果发送至业务端。As shown in Figure 2, if the business result obtained by the external service processing the business data is found in the buffer, the scheduler can read the business result obtained by the external service processing the business data from the buffer, and add the business result Send to business end.
步骤103、依据业务请求调用外部服务处理业务数据。Step 103: Call an external service to process the business data according to the business request.
如图2所示,如果在缓冲区中未查询到存在外部服务处理业务数据得到的业务结果,则调度器可以依据业务请求调用相应的外部服务处理业务端提交的业务数据。As shown in Figure 2, if the business results obtained by the external service processing business data are not found in the buffer, the scheduler can call the corresponding external service according to the business request to process the business data submitted by the business end.
在具体实现中,在削峰器中设置有线程池(thread pool),线程池是一种线程使用模式。调度器作为监督管理者,可以并发向线程池分发调用外部服务的任务,而线程池维护着多个线程,等待着监督管理者分配调用外部服务的任务,相对于调度器(主线程)而言,线程池维护着的线程可以称为子线程。In the specific implementation, a thread pool is set up in the peak clipper. The thread pool is a thread usage mode. As a supervisory manager, the scheduler can concurrently distribute tasks for calling external services to the thread pool, and the thread pool maintains multiple threads, waiting for the supervisory manager to assign tasks for calling external services. Compared with the scheduler (main thread) , the threads maintained by the thread pool can be called child threads.
使用线程池调度外部服务,可以避免在处理短时间任务时创建与销毁线程的代价,不仅能够保证内核的充分利用,还能防止过分调度,满足大量并发的业务请求。Using the thread pool to schedule external services can avoid the cost of creating and destroying threads when processing short-term tasks. It not only ensures full utilization of the core, but also prevents over-scheduling and meets a large number of concurrent business requests.
调度器可以在业务请求中读取外部服务的服务标识信息(如ID、API的名称等)与业务数据,从线程池中为当前的业务数据(以业务标识信息表示)分配一个子线程,考虑到不同外部服务使用不同的协议通信,例如,HTTP(Hypertext Transfer Protocol,超文本传输协议),gRPC(Remote Procedure Call,远程过程调用协议),或者其他协议,在线程池中可以维护外部服务与协议之间的关系。The scheduler can read the service identification information (such as ID, API name, etc.) and business data of the external service in the business request, and allocate a sub-thread from the thread pool to the current business data (represented by business identification information). Consider Use different protocols to communicate with different external services, such as HTTP (Hypertext Transfer Protocol, Hypertext Transfer Protocol), gRPC (Remote Procedure Call, Remote Procedure Call Protocol), or other protocols. External services and protocols can be maintained in the thread pool. The relationship between.
那么,可以调用子线程依据服务标识信息使用与外部服务适配的协议、将业务数据发送至外部服务(API接口)处理。Then, you can call the sub-thread to use the protocol adapted to the external service based on the service identification information to send the business data to the external service (API interface) for processing.
步骤104、等待外部服务处理业务数据得到的业务结果。Step 104: Wait for the business results obtained by the external service from processing the business data.
如图2所示,调度器在依据业务请求调用外部服务处理业务数据的同时,可以在预设的等待时间内等待外部服务处理业务数据得到的业务结果。As shown in Figure 2, while the scheduler calls an external service to process the business data according to the business request, it can wait for the business results obtained by the external service to process the business data within a preset waiting time.
在具体实现中,在削峰器中设置有峰值计时器,峰值计时器可以实现调度器的部分职能,以此实现慢响应。In the specific implementation, a peak timer is set in the peak clipper, and the peak timer can realize some functions of the scheduler to achieve slow response.
不同的外部服务的性能和稳定性均有一定差异,因此,可以预先依据外部服务的调度信息对其设定一个合理的等待时间,作为超时水位(Timeout Watermark)。Different external services have certain differences in performance and stability. Therefore, a reasonable waiting time can be set in advance based on the scheduling information of the external service as the timeout watermark.
那么,调度器可以在业务请求中读取外部服务的服务标识信息,依据服务标识信息查询为外部服务配置的等待时间,将等待时间发送至峰值计时器进行计时。Then, the scheduler can read the service identification information of the external service in the business request, query the waiting time configured for the external service based on the service identification information, and send the waiting time to the peak timer for timing.
在峰值计时器计时期间,调度器可以等待外部服务处理业务数据得到的业务结果,即,等待子线程返回外部服务处理业务数据得到的业务结果。During the peak timer timing, the scheduler can wait for the business results obtained by the external service processing the business data, that is, waiting for the child thread to return the business results obtained by the external service processing the business data.
步骤105、若等待业务结果超时,则将失败信息发送至业务端,以使业务端再次触发处理相同业务数据的业务请求,以及,继续等待业务结果。Step 105: If the wait for the service result times out, the failure information is sent to the business end, so that the business end triggers a service request to process the same service data again, and continues to wait for the service result.
如图2所示,如果调度器在超时前等待到外部服务处理业务数据得到的业务结果,即,子线程在到达等待时间之前向调度器返回外部服务处理业务数据得到的业务结果,则调度器可以将业务结果发送至业务端。As shown in Figure 2, if the scheduler waits for the business results obtained by the external service processing the business data before timeout, that is, the child thread returns the business results obtained by the external service processing the business data to the scheduler before reaching the waiting time, then the scheduler Business results can be sent to the business end.
在本实施例提供异步超时控制机制中,在异步操作中引入一种超时机制,如果调度器等待外部服务处理业务数据得到的业务结果超时,即,子线程在到达等待时间时,未向调度器返回外部服务处理业务数据得到的业务结果,则调度器可以中断等待,将失败信息(表示调用外部服务失败的状态码)发送至业务端,防止业务请求因长时间未完成而导致业务端的性能下降,保证对业务端的响应不受外部服务的影响。In the asynchronous timeout control mechanism provided in this embodiment, a timeout mechanism is introduced in the asynchronous operation. If the scheduler times out while waiting for the business results obtained by the external service to process the business data, that is, the child thread does not report to the scheduler when the waiting time is reached. If the business results obtained by the external service processing business data are returned, the scheduler can interrupt the waiting and send the failure information (status code indicating the failure to call the external service) to the business end to prevent the performance of the business end from being degraded due to unfinished business requests for a long time. , ensuring that the response to the business end is not affected by external services.
进一步而言,中断业务端的业务请求是逻辑中上的操作,子线程仍然保持调度外部服务的操作,削峰器仍然继续等待外部服务处理业务数据得到的业务结果。Furthermore, interrupting the business request of the business end is a logical operation. The sub-thread still maintains the operation of scheduling external services, and the peak clipper still continues to wait for the business results obtained by the external service processing business data.
业务端在接收到失败信息时,可以按照自身的代码逻辑,决定是否再次触发处理相同业务数据的业务请求。When the business end receives the failure information, it can decide whether to trigger the business request to process the same business data again according to its own code logic.
在触发处理相同业务数据的业务请求的次数到达阈值、与外部服务无关的业务操作发生错误、业务被中断等情况下,可以决定不触发处理相同业务数据的业务请求,此时,生成警报信息,提示运维人员处理异常。When the number of business requests triggered to process the same business data reaches the threshold, an error occurs in a business operation unrelated to external services, or the business is interrupted, you can decide not to trigger a business request to process the same business data. At this time, an alarm message is generated. Prompt operation and maintenance personnel to handle exceptions.
在触发处理相同业务数据的业务请求的次数未到达阈值、与外部服务无关的业务操作正常、业务正常等情况下,可以决定触发处理相同业务数据的业务请求,此时,业务端可以按照自身的代码逻辑决定触发处理相同业务数据的业务请求的时机,在到达该时机时,依据相同业务数据生成新的业务请求,并将新的业务请求发送至削峰器。When the number of business requests triggered to process the same business data has not reached the threshold, the business operations unrelated to external services are normal, the business is normal, etc., you can decide to trigger the business requests to process the same business data. At this time, the business end can follow its own The code logic determines the timing of triggering the processing of business requests with the same business data. When the timing is reached, a new business request is generated based on the same business data, and the new business request is sent to the peak clipper.
在具体实现中,若调度器接收到峰值计时器计时结束的消息,表示等待超时,则调度器可以将等待业务结果的任务挂载至峰值计时器,此时,调度器将发送至线程池调度外部服务处理业务数据的任务通知峰值计时器,以及,通知线程池修改调度外部服务处理业务数据的任务,将监督管理者修改为峰值计时器,峰值计时器维护调度外部服务处理业务数据的任务,继续等待外部服务处理业务数据得到的业务结果,即,继续等待子线程返回外部服务处理业务数据得到的业务结果。In a specific implementation, if the scheduler receives a message that the peak timer has expired, indicating that the wait has timed out, the scheduler can mount the task waiting for the business result to the peak timer. At this time, the scheduler will send it to the thread pool for scheduling. The task of external service processing business data notifies the peak timer, and notifies the thread pool to modify and schedule the task of external service processing business data. Modify the supervisory manager to the peak timer, and the peak timer maintains and schedules the task of external service processing business data. Continue to wait for the business results obtained by the external service processing the business data, that is, continue to wait for the sub-thread to return the business results obtained by the external service processing the business data.
此外,调度器可以将失败信息发送至业务端,以使业务端结束调用外部服务、继续执行业务操作,以及,在完成部分或全部业务操作(表示到达时机)时、触发处理相同业务数据的业务请求。In addition, the scheduler can send failure information to the business end, so that the business end ends calling external services, continues to perform business operations, and, when part or all of the business operations are completed (indicating the arrival time), triggers a business that processes the same business data. ask.
一般情况下,不同的业务端实现的业务中业务操作较多,调用外部服务是该业务中的其中一个业务操作,业务端在接收到失败信息时,可以挂起与外部服务相关的业务操作、暂停执行,而继续执行与外部服务无关的业务操作,在等待外部服务处理业务数据的同时,完成一些前置的业务操作,提高处理业务的效率。Generally speaking, there are many business operations in the business implemented by different business ends. Calling external services is one of the business operations in this business. When the business end receives the failure information, it can suspend the business operations related to the external services. Pause execution and continue to execute business operations unrelated to external services. While waiting for external services to process business data, complete some pre-processing business operations to improve the efficiency of business processing.
步骤106、若超时后等待到业务结果,则在缓冲区中存储业务结果。Step 106: If the service result is waited for after timeout, the service result is stored in the buffer.
如图2所示,如果在超时后等待到外部服务处理业务数据得到的业务结果,即,等待到子线程返回外部服务处理业务数据得到的业务结果,此时,可以在缓冲区中存储业务结果,等待业务端下一次请求处理相同的业务数据时,直接返回相应的业务结果,实现慢响应。As shown in Figure 2, if you wait for the business result obtained by the external service processing the business data after the timeout, that is, wait until the sub-thread returns the business result obtained by the external service processing the business data, at this time, the business result can be stored in the buffer , when waiting for the next request from the business end to process the same business data, the corresponding business results will be directly returned to achieve slow response.
在具体实现中,在峰值计时器接收到子线程返回的、外部服务处理业务数据得到的业务结果时,可以触发为缓冲区配置的钩子函数(Hook Function),从而执行钩子函数、通过事件回调(Event Callback)的方式在缓冲区中存储业务结果。In a specific implementation, when the peak timer receives the business results returned by the child thread and obtained by the external service processing business data, the hook function (Hook Function) configured for the buffer can be triggered, thereby executing the hook function and passing the event callback ( Event Callback) method to store business results in the buffer.
其中,钩子函数是指预先定义好的可在特定事件或状态发生时被调用的函数,通常用于扩展或定制削峰器的行为(如在缓冲区中存储业务结果)。Among them, the hook function refers to a predefined function that can be called when a specific event or state occurs. It is usually used to extend or customize the behavior of the peak clipper (such as storing business results in the buffer).
事件回调是指在异步操作完成后,通过触发预定义的回调函数来通知相关模块或对象(即缓冲区),以执行特定的逻辑或操作(即存储业务结果)。Event callback refers to notifying relevant modules or objects (i.e., buffers) by triggering a predefined callback function to perform specific logic or operations (i.e., storing business results) after the asynchronous operation is completed.
在存储业务结果时,可以查询业务请求中依据业务数据生成的业务标识值,在缓冲区中以业务标识值为索引存储业务结果,便于辨别业务数据与业务结果之间的关系。When storing business results, you can query the business identification value generated based on the business data in the business request, and store the business results in the buffer with the business identification value as an index, making it easy to identify the relationship between the business data and the business results.
进一步地,本实施例中可以使用观察者模式(Observer Pattern)实现异步响应回调的机制。Furthermore, in this embodiment, the Observer Pattern can be used to implement an asynchronous response callback mechanism.
其中,观察者模式是一种设计模式,用于定义一对多的依赖关系,当一个对象的状态发生变化时,所有依赖于它的对象都得到通知并被自动更新。Among them, the observer pattern is a design pattern used to define a one-to-many dependency relationship. When the state of an object changes, all objects that depend on it are notified and automatically updated.
在观察者模式中,可以定义主题接口,主题接口包括注册观察者、移除观察者、通知观察者以及发起异步请求的方法。In the observer pattern, you can define a topic interface, which includes methods for registering observers, removing observers, notifying observers, and initiating asynchronous requests.
在观察者模式中,可以定义观察者接口,观察者接口包含一个更新方法,用于在主题的状态改变时接收通知。In the observer pattern, you can define an observer interface, which contains an update method to receive notifications when the state of the topic changes.
在观察者模式中,可以定义主题类,当外部服务成功响应时,通知内部维护的观察者,并将调度线程归还线程池。In the observer pattern, you can define a topic class. When the external service responds successfully, the internally maintained observer will be notified and the scheduled thread will be returned to the thread pool.
在观察者模式中,可以定义观察者类,实现观察者接口,定义在主题状态改变时如何更新自身。In the observer pattern, you can define an observer class, implement the observer interface, and define how to update itself when the subject state changes.
在具体实现中,可以预先启动观察者模式,以调用主题类将峰值计时器定义为主题、调用观察者接口在缓冲区中定义观察者、调用主题接口将观察者注册到主题中。In the specific implementation, the observer mode can be started in advance to call the topic class to define the peak timer as the topic, call the observer interface to define the observer in the buffer, and call the topic interface to register the observer into the topic.
在峰值计时器接收到子线程返回的、外部服务处理业务数据得到的业务结果(表示主题状态改变)时,调用观察者中的发布者,向观察者发布接收到业务结果的消息。When the peak timer receives the business result returned by the child thread and obtained by the external service processing the business data (indicating the topic status change), the publisher in the observer is called to publish the message of the received business result to the observer.
在观察者中使用更新方法接收到该消息时,触发观察者中的钩子函数,从而执行钩子函数、通过事件回调的方式在缓冲区中存储业务结果。When the message is received using the update method in the observer, the hook function in the observer is triggered, thereby executing the hook function and storing the business results in the buffer through event callbacks.
在本实施例中,当接收到业务端处理业务数据的业务请求时,在缓冲区中查询是否存在外部服务处理业务数据得到的业务结果;若是,则将缓冲区中的业务结果发送至业务端;若否,则依据业务请求调用外部服务处理业务数据;等待外部服务处理业务数据得到的业务结果;若等待业务结果超时,则将失败信息发送至业务端,以使业务端触发处理相同业务数据的业务请求,以及,继续等待业务结果;若超时后等待到业务结果,则在缓冲区中存储业务结果。在初次请求超时时,主动断开请求,避免长时间等待远程调度外部服务的响应,可以保障响应的效率,减少业务端与外部服务的耦合度,削弱外部服务对业务端的影响,而异步保持外部服务处理业务数据,并将外部服务处理业务数据得到的业务结果保存到缓冲区,使得再次请求时,快速获取响应的业务结果,实现了慢响应,针对业务端多次的业务请求,均实现一次的调度外部服务的操作,大大提高了资源的利用效率,减轻了系统的负担。In this embodiment, when receiving a service request for the business end to process business data, the buffer is queried to see if there is a business result obtained by the external service processing the business data; if so, the business result in the buffer is sent to the business end. ; If not, call the external service to process the business data according to the business request; wait for the business result obtained by the external service to process the business data; if the waiting for the business result times out, send the failure information to the business end so that the business end triggers the processing of the same business data business request, and continue to wait for the business result; if the business result is waited for after timeout, the business result is stored in the buffer. When the initial request times out, actively disconnect the request to avoid long waiting for the response of the remote dispatch external service. This can ensure the efficiency of the response, reduce the coupling between the business end and the external service, weaken the impact of the external service on the business end, and maintain the external service asynchronously. The service processes business data and saves the business results obtained by the external service processing business data into the buffer, so that when the request is made again, the response business results can be obtained quickly, realizing slow response, and achieving one time for multiple business requests from the business end. The operation of scheduling external services greatly improves the efficiency of resource utilization and reduces the burden on the system.
实施例二Embodiment 2
图3为本发明实施例二提供的一种服务调度装置的结构示意图。Figure 3 is a schematic structural diagram of a service scheduling device provided in Embodiment 2 of the present invention.
如图3所示,该装置包括:As shown in Figure 3, the device includes:
缓冲区查询模块301,用于当接收到业务端处理业务数据的业务请求时,在缓冲区中查询是否存在外部服务处理所述业务数据得到的业务结果;若是,则执行业务结果发送模块302,若否,则执行服务调用模块303;The buffer query module 301 is used to query in the buffer whether there is a business result obtained by the external service processing the business data when receiving a service request from the business end to process the business data; if so, execute the business result sending module 302, If not, execute the service calling module 303;
业务结果发送模块302,用于将所述缓冲区中的所述业务结果发送至所述业务端;The business result sending module 302 is used to send the business result in the buffer to the business end;
服务调用模块303,用于依据所述业务请求调用外部服务处理所述业务数据;The service calling module 303 is used to call external services to process the business data according to the business request;
业务结果等待模块304,用于等待所述外部服务处理所述业务数据得到的业务结果;The business result waiting module 304 is used to wait for the business result obtained by the external service from processing the business data;
失败处理模块305,用于若等待所述业务结果超时,则将失败信息发送至所述业务端,以使所述业务端触发处理相同所述业务数据的业务请求,以及,继续等待所述业务结果;The failure processing module 305 is configured to send failure information to the business end if waiting for the service result times out, so that the business end triggers processing of a service request for the same service data, and continues to wait for the service. result;
业务结果存储模块306,用于若超时后等待到所述业务结果,则在所述缓冲区中存储所述业务结果。The service result storage module 306 is configured to store the service result in the buffer if the service result is waited for after a timeout.
在本发明的一个实施例中,所述缓冲区查询模块301包括:In one embodiment of the present invention, the buffer query module 301 includes:
业务标识值读取模块,用于在所述业务请求中读取依据所述业务数据生成的业务标识值;A service identification value reading module, configured to read the service identification value generated based on the service data in the service request;
索引查询模块,用于在缓冲区中以所述业务标识值为索引,查询是否存在外部服务处理所述业务数据得到的业务结果;An index query module, used to use the business identification value as an index in the buffer to query whether there is a business result obtained by an external service processing the business data;
所述业务结果存储模块306包括:The business result storage module 306 includes:
业务标识值查询模块,用于查询所述业务请求中依据所述业务数据生成的业务标识值;A service identification value query module, used to query the service identification value generated based on the service data in the service request;
索引存储模块,用于在所述缓冲区中以所述业务标识值为索引存储所述业务结果。An index storage module, configured to store the service result in the buffer using the service identifier value as an index.
在本发明的一个实施例中,所述服务调用模块303包括:In one embodiment of the present invention, the service calling module 303 includes:
服务标识信息读取模块,用于在所述业务请求中读取外部服务的服务标识信息;A service identification information reading module, configured to read the service identification information of external services in the business request;
子线程分配模块,用于从线程池中为所述业务数据分配一个子线程;A sub-thread allocation module, used to allocate a sub-thread from the thread pool to the business data;
子线程调用模块,用于调用所述子线程依据所述服务标识信息使用与所述外部服务适配的协议、将所述业务数据发送至所述外部服务处理。A sub-thread calling module, configured to call the sub-thread to use a protocol adapted to the external service according to the service identification information to send the business data to the external service for processing.
在本发明的一个实施例中,所述业务结果等待模块304包括:In one embodiment of the present invention, the service result waiting module 304 includes:
服务标识信息读取模块,用于在所述业务请求中读取外部服务的服务标识信息;A service identification information reading module, configured to read the service identification information of external services in the business request;
等待时间查询模块,用于依据所述服务标识信息查询为所述外部服务配置的等待时间;A waiting time query module, configured to query the waiting time configured for the external service based on the service identification information;
计时通知模块,用于将所述等待时间发送至峰值计时器进行计时;Timing notification module, used to send the waiting time to the peak timer for timing;
计时等待模块,用于在计时期间,等待所述外部服务处理所述业务数据得到的业务结果。The timing waiting module is used to wait for the business result obtained by the external service from processing the business data during the timing period.
在本发明的一个实施例中,所述失败处理模块包括:In one embodiment of the present invention, the failure processing module includes:
任务挂载模块,用于若接收到所述峰值计时器计时结束的消息,则将等待所述业务结果的任务挂载至所述峰值计时器;A task mounting module, configured to mount a task waiting for the business result to the peak timer if a message indicating that the peak timer has ended is received;
失败信息发送模块,用于将失败信息发送至所述业务端,以使所述业务端结束调用所述外部服务、继续执行业务操作,以及,在完成部分或全部所述业务操作时、触发处理相同所述业务数据的业务请求。A failure information sending module, configured to send failure information to the business end, so that the business end ends calling the external service, continues to perform business operations, and triggers processing when part or all of the business operations are completed. Service requests for the same service data.
在本发明的一个实施例中,所述业务结果存储模块306包括:In one embodiment of the present invention, the business result storage module 306 includes:
钩子函数触发模块,用于在所述峰值计时器接收到所述业务结果时,触发为所述缓冲区配置的钩子函数;A hook function triggering module, configured to trigger the hook function configured for the buffer when the peak timer receives the business result;
钩子函数执行模块,用于执行所述钩子函数、在所述缓冲区中存储所述业务结果。A hook function execution module is used to execute the hook function and store the business results in the buffer.
在本发明的一个实施例中,所述钩子函数触发模块包括:In one embodiment of the present invention, the hook function triggering module includes:
观察者模式启动模块,用于启动观察者模式,以将所述峰值计时器定义为主题、在所述缓冲区中定义观察者、将所述观察者注册到所述主题中;Observer mode startup module, used to start the observer mode to define the peak timer as a topic, define an observer in the buffer, and register the observer into the topic;
消息发布模块,用于在所述峰值计时器接收到所述业务结果时,调用所述观察者中的发布者,向所述观察者发布接收到所述业务结果的消息;A message publishing module, configured to call the publisher among the observers when the peak timer receives the business result, and publish the message of receiving the business result to the observer;
观察者触发模块,用于在所述观察者中接收到所述消息时,触发所述观察者中的钩子函数。The observer trigger module is used to trigger the hook function in the observer when the message is received in the observer.
本发明实施例所提供的服务调度装置可执行本发明任意实施例所提供的服务调度方法,具备执行服务调度方法相应的功能模块和有益效果。The service scheduling device provided by the embodiment of the present invention can execute the service scheduling method provided by any embodiment of the present invention, and has corresponding functional modules and beneficial effects for executing the service scheduling method.
实施例三Embodiment 3
图4示出了可以用来实施本发明的实施例的电子设备10的结构示意图。电子设备旨在表示各种形式的数字计算机,诸如,膝上型计算机、台式计算机、工作台、个人数字助理、服务器、刀片式服务器、大型计算机、和其它适合的计算机。本文所示的部件、它们的连接和关系、以及它们的功能仅仅作为示例,并且不意在限制本文中描述的和/或者要求的本发明的实现。FIG. 4 shows a schematic structural diagram of an electronic device 10 that can be used to implement embodiments of the present invention. Electronic devices are intended to refer to various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The components shown herein, their connections and relationships, and their functions are examples only and are not intended to limit the implementation of the invention described and/or claimed herein.
如图4所示,电子设备10包括至少一个处理器11,以及与至少一个处理器11通信连接的存储器,如只读存储器(ROM)12、随机访问存储器(RAM)13等,其中,存储器存储有可被至少一个处理器执行的计算机程序,处理器11可以根据存储在只读存储器(ROM)12中的计算机程序或者从存储单元18加载到随机访问存储器(RAM)13中的计算机程序,来执行各种适当的动作和处理。在RAM 13中,还可存储电子设备10操作所需的各种程序和数据。处理器11、ROM 12以及RAM 13通过总线14彼此相连。输入/输出(I/O)接口15也连接至总线14。As shown in Figure 4, the electronic device 10 includes at least one processor 11, and a memory communicatively connected to the at least one processor 11, such as a read-only memory (ROM) 12, a random access memory (RAM) 13, etc., wherein the memory stores There is a computer program that can be executed by at least one processor. The processor 11 can perform the operation according to the computer program stored in the read-only memory (ROM) 12 or loaded from the storage unit 18 into the random access memory (RAM) 13. Perform various appropriate actions and processing. In the RAM 13, various programs and data required for the operation of the electronic device 10 can also be stored. The processor 11, the ROM 12 and the RAM 13 are connected to each other via the bus 14. An input/output (I/O) interface 15 is also connected to bus 14 .
电子设备10中的多个部件连接至I/O接口15,包括:输入单元16,例如键盘、鼠标等;输出单元17,例如各种类型的显示器、扬声器等;存储单元18,例如磁盘、光盘等;以及通信单元19,例如网卡、调制解调器、无线通信收发机等。通信单元19允许电子设备10通过诸如因特网的计算机网络和/或各种电信网络与其他设备交换信息/数据。Multiple components in the electronic device 10 are connected to the I/O interface 15, including: an input unit 16, such as a keyboard, a mouse, etc.; an output unit 17, such as various types of displays, speakers, etc.; a storage unit 18, such as a magnetic disk, an optical disk, etc. etc.; and communication unit 19, such as network card, modem, wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information/data with other devices through computer networks such as the Internet and/or various telecommunications networks.
处理器11可以是各种具有处理和计算能力的通用和/或专用处理组件。处理器11的一些示例包括但不限于中央处理单元(CPU)、图形处理单元(GPU)、各种专用的人工智能(AI)计算芯片、各种运行机器学习模型算法的处理器、数字信号处理器(DSP)、以及任何适当的处理器、控制器、微控制器等。处理器11执行上文所描述的各个方法和处理,如服务调度方法。Processor 11 may be a variety of general and/or special purpose processing components having processing and computing capabilities. Some examples of the processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, digital signal processing processor (DSP), and any appropriate processor, controller, microcontroller, etc. The processor 11 executes various methods and processes described above, such as the service scheduling method.
在一些实施例中,服务调度方法可被实现为计算机程序,其被有形地包含于计算机可读存储介质,例如存储单元18。在一些实施例中,计算机程序的部分或者全部可以经由ROM 12和/或通信单元19而被载入和/或安装到电子设备10上。当计算机程序加载到RAM 13并由处理器11执行时,可以执行上文描述的服务调度方法的一个或多个步骤。备选地,在其他实施例中,处理器11可以通过其他任何适当的方式(例如,借助于固件)而被配置为执行服务调度方法。In some embodiments, the service scheduling method may be implemented as a computer program, which is tangibly embodied in a computer-readable storage medium, such as the storage unit 18. In some embodiments, part or all of the computer program may be loaded and/or installed onto the electronic device 10 via the ROM 12 and/or the communication unit 19 . When the computer program is loaded into the RAM 13 and executed by the processor 11, one or more steps of the service scheduling method described above may be performed. Alternatively, in other embodiments, the processor 11 may be configured to perform the service scheduling method in any other suitable manner (eg, by means of firmware).
本文中以上描述的系统和技术的各种实施方式可以在数字电子电路系统、集成电路系统、场可编程门阵列(FPGA)、专用集成电路(ASIC)、专用标准产品(ASSP)、芯片上系统的系统(SOC)、负载可编程逻辑设备(CPLD)、计算机硬件、固件、软件、和/或它们的组合中实现。这些各种实施方式可以包括:实施在一个或者多个计算机程序中,该一个或者多个计算机程序可在包括至少一个可编程处理器的可编程系统上执行和/或解释,该可编程处理器可以是专用或者通用可编程处理器,可以从存储系统、至少一个输入装置、和至少一个输出装置接收数据和指令,并且将数据和指令传输至该存储系统、该至少一个输入装置、和该至少一个输出装置。Various implementations of the systems and techniques described above may be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on a chip implemented in a system (SOC), load programmable logic device (CPLD), computer hardware, firmware, software, and/or a combination thereof. These various embodiments may include implementation in one or more computer programs executable and/or interpreted on a programmable system including at least one programmable processor, the programmable processor The processor, which may be a special purpose or general purpose programmable processor, may receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device. An output device.
用于实施本发明的方法的计算机程序可以采用一个或多个编程语言的任何组合来编写。这些计算机程序可以提供给通用计算机、专用计算机或其他可编程数据处理装置的处理器,使得计算机程序当由处理器执行时使流程图和/或框图中所规定的功能/操作被实施。计算机程序可以完全在机器上执行、部分地在机器上执行,作为独立软件包部分地在机器上执行且部分地在远程机器上执行或完全在远程机器或服务器上执行。Computer programs for implementing the methods of the invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, such that the computer program, when executed by the processor, causes the functions/operations specified in the flowcharts and/or block diagrams to be implemented. A computer program may execute entirely on the machine, partly on the machine, as a stand-alone software package, partly on the machine and partly on a remote machine or entirely on the remote machine or server.
在本发明的上下文中,计算机可读存储介质可以是有形的介质,其可以包含或存储以供指令执行系统、装置或设备使用或与指令执行系统、装置或设备结合地使用的计算机程序。计算机可读存储介质可以包括但不限于电子的、磁性的、光学的、电磁的、红外的、或半导体系统、装置或设备,或者上述内容的任何合适组合。备选地,计算机可读存储介质可以是机器可读信号介质。机器可读存储介质的更具体示例会包括基于一个或多个线的电气连接、便携式计算机盘、硬盘、随机存取存储器(RAM)、只读存储器(ROM)、可擦除可编程只读存储器(EPROM或快闪存储器)、光纤、便捷式紧凑盘只读存储器(CD-ROM)、光学储存设备、磁储存设备、或上述内容的任何合适组合。In the context of this invention, a computer-readable storage medium may be a tangible medium that may contain or store a computer program for use by or in connection with an instruction execution system, apparatus, or device. Computer-readable storage media may include, but are not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or devices, or any suitable combination of the foregoing. Alternatively, the computer-readable storage medium may be a machine-readable signal medium. More specific examples of machine-readable storage media would include one or more wire-based electrical connections, laptop disks, hard drives, 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.
为了提供与用户的交互,可以在电子设备上实施此处描述的系统和技术,该电子设备具有:用于向用户显示信息的显示装置(例如,CRT(阴极射线管)或者LCD(液晶显示器)监视器);以及键盘和指向装置(例如,鼠标或者轨迹球),用户可以通过该键盘和该指向装置来将输入提供给电子设备。其它种类的装置还可以用于提供与用户的交互;例如,提供给用户的反馈可以是任何形式的传感反馈(例如,视觉反馈、听觉反馈、或者触觉反馈);并且可以用任何形式(包括声输入、语音输入或者、触觉输入)来接收来自用户的输入。To provide interaction with a user, the systems and techniques described herein may be implemented on an electronic device having a display device (eg, a CRT (cathode ray tube) or LCD (liquid crystal display)) for displaying information to the user monitor); and a keyboard and pointing device (e.g., a mouse or a trackball) through which a user can provide input to the electronic device. Other kinds of devices may also be used to provide interaction with the user; for example, the feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and may be provided in any form, including Acoustic input, voice input or tactile input) to receive input from the user.
可以将此处描述的系统和技术实施在包括后台部件的计算系统(例如,作为数据服务器)、或者包括中间件部件的计算系统(例如,应用服务器)、或者包括前端部件的计算系统(例如,具有图形用户界面或者网络浏览器的用户计算机,用户可以通过该图形用户界面或者该网络浏览器来与此处描述的系统和技术的实施方式交互)、或者包括这种后台部件、中间件部件、或者前端部件的任何组合的计算系统中。可以通过任何形式或者介质的数字数据通信(例如,通信网络)来将系统的部件相互连接。通信网络的示例包括:局域网(LAN)、广域网(WAN)、区块链网络和互联网。The systems and techniques described herein may be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., A user's computer having a graphical user interface or web browser through which the user can interact with implementations of the systems and technologies described herein), or including such backend components, middleware components, or any combination of front-end components in a computing system. The components of the system may be interconnected by any form or medium of digital data communication (eg, a communications network). Examples of communication networks include: local area network (LAN), wide area network (WAN), blockchain network, and the Internet.
计算系统可以包括客户端和服务器。客户端和服务器一般远离彼此并且通常通过通信网络进行交互。通过在相应的计算机上运行并且彼此具有客户端-服务器关系的计算机程序来产生客户端和服务器的关系。服务器可以是云服务器,又称为云计算服务器或云主机,是云计算服务体系中的一项主机产品,以解决了传统物理主机与VPS服务中,存在的管理难度大,业务扩展性弱的缺陷。Computing systems may include clients and servers. Clients and servers are generally remote from each other and typically interact over a communications network. The relationship of client and server is created by computer programs running on corresponding computers and having a client-server relationship with each other. The server can be a cloud server, also known as cloud computing server or cloud host. It is a host product in the cloud computing service system to solve the problems of difficult management and weak business scalability in traditional physical hosts and VPS services. defect.
实施例四Embodiment 4
本发明实施例还提供了一种计算机程序产品,该计算机程序产品包括计算机程序,该计算机程序在被处理器执行时实现如本发明任一实施例所提供的服务调度方法。An embodiment of the present invention also provides a computer program product. The computer program product includes a computer program. When executed by a processor, the computer program implements the service scheduling method provided by any embodiment of the present invention.
计算机程序产品在实现的过程中,可以以一种或多种程序设计语言或其组合来编写用于执行本发明操作的计算机程序代码,程序设计语言包括面向对象的程序设计语言,诸如Java、Smalltalk、C++,还包括常规的过程式程序设计语言,诸如“C”语言或类似的程序设计语言。程序代码可以完全地在用户计算机上执行、部分地在用户计算机上执行、作为一个独立的软件包执行、部分在用户计算机上部分在远程计算机上执行、或者完全在远程计算机或服务器上执行。在涉及远程计算机的情形中,远程计算机可以通过任意种类的网络——包括局域网(LAN)或广域网(WAN)—连接到用户计算机,或者,可以连接到外部计算机(例如利用因特网服务提供商来通过因特网连接)。During the implementation of the computer program product, computer program code for performing the operations of the present invention can be written in one or more programming languages or a combination thereof. Programming languages include object-oriented programming languages, such as Java, Smalltalk , C++, and also includes conventional procedural programming languages, such as the "C" language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In situations involving remote computers, the remote computer can be connected to the user's computer through any kind of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computer (such as an Internet service provider through Internet connection).
应该理解,可以使用上面所示的各种形式的流程,重新排序、增加或删除步骤。例如,本发明中记载的各步骤可以并行地执行也可以顺序地执行也可以不同的次序执行,只要能够实现本发明的技术方案所期望的结果,本文在此不进行限制。It should be understood that various forms of the process shown above may be used, with steps reordered, added or deleted. For example, each step described in the present invention can be executed in parallel, sequentially, or in different orders. As long as the desired results of the technical solution of the present invention can be achieved, there is no limitation here.
上述具体实施方式,并不构成对本发明保护范围的限制。本领域技术人员应该明白的是,根据设计要求和其他因素,可以进行各种修改、组合、子组合和替代。任何在本发明的精神和原则之内所作的修改、等同替换和改进等,均应包含在本发明保护范围之内。The above-mentioned specific embodiments do not constitute a limitation on the scope of the present invention. It will be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions are possible depending on design requirements and other factors. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention shall be included in the protection scope of the present invention.
Claims (10)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202311796310.4A CN117692518A (en) | 2023-12-25 | 2023-12-25 | Service scheduling method, device, equipment and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202311796310.4A CN117692518A (en) | 2023-12-25 | 2023-12-25 | Service scheduling method, device, equipment and storage medium |
Publications (1)
Publication Number | Publication Date |
---|---|
CN117692518A true CN117692518A (en) | 2024-03-12 |
Family
ID=90136989
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202311796310.4A Pending CN117692518A (en) | 2023-12-25 | 2023-12-25 | Service scheduling method, device, equipment and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN117692518A (en) |
-
2023
- 2023-12-25 CN CN202311796310.4A patent/CN117692518A/en active Pending
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN103092698B (en) | Cloud computing application automatic deployment system and method | |
CN110049113A (en) | Service message processing method and device | |
US9323591B2 (en) | Listening for externally initiated requests | |
CN112346834B (en) | Request processing method and device for database, electronic equipment and medium | |
CN111586140A (en) | Data interaction method and server | |
CN111200606A (en) | Deep learning model task processing method, system, server and storage medium | |
CN110851276A (en) | A service request processing method, device, server and storage medium | |
CN111343239B (en) | Communication request processing method, communication request processing device and transaction system | |
CN115964153A (en) | Asynchronous task processing method, device, equipment and storage medium | |
CN114697194B (en) | Blocking event notification method and device | |
CN112448977A (en) | System, method, apparatus and computer readable medium for assigning tasks | |
CN116048825A (en) | Container cluster construction method and system | |
CN117692518A (en) | Service scheduling method, device, equipment and storage medium | |
CN117176813A (en) | Method and device for processing service request | |
CN111752695B (en) | Offline method, device, equipment and storage medium | |
CN111274047A (en) | Information processing method, terminal, system, computer device and storage medium | |
CN114116203B (en) | Resource call control method, resource call control device and storage medium | |
CN107632893B (en) | Message queue processing method and device | |
CN115640100A (en) | Virtual machine information synchronization method and computer readable medium | |
CN114443325A (en) | Asynchronous retry method and system for abnormal interface call | |
CN114374657A (en) | Data processing method and device | |
CN107357663A (en) | The method and explorer of resource-sharing | |
CN101295269B (en) | A Method of Component Interaction Synchronization Based on Transaction | |
CN113741797B (en) | A data processing method and device | |
CN111625324A (en) | Method and device for processing request |
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 |