CN107479992A - A kind of method for processing business and device - Google Patents
A kind of method for processing business and device Download PDFInfo
- Publication number
- CN107479992A CN107479992A CN201710780194.5A CN201710780194A CN107479992A CN 107479992 A CN107479992 A CN 107479992A CN 201710780194 A CN201710780194 A CN 201710780194A CN 107479992 A CN107479992 A CN 107479992A
- Authority
- CN
- China
- Prior art keywords
- service
- subset
- business
- services
- response message
- 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
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/46—Multiprogramming arrangements
- G06F9/54—Interprogram communication
- G06F9/546—Message passing systems or structures, e.g. queues
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/46—Multiprogramming arrangements
- G06F9/54—Interprogram communication
- G06F9/547—Remote procedure calls [RPC]; Web services
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F2209/00—Indexing scheme relating to G06F9/00
- G06F2209/54—Indexing scheme relating to G06F9/54
- G06F2209/544—Remote
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Computer And Data Communications (AREA)
Abstract
本发明公开了一种业务处理方法,应用于第一进程,该方法包括以下步骤:接收第二进程发送的业务请求消息,根据业务请求消息,确定待处理的业务集合,在业务集合中确定待应答的第一业务子集,在对第一业务子集中的全部业务处理完成后,发送应答消息给第二进程。应用本发明实施例所提供的技术方案,第一进程在处理第二进程发送的业务请求消息的过程中,如果有待应答的业务,则优先处理业务集合中待应答业务组成的第一业务子集中的待应答业务,并在处理完第一业务子集中的业务后,发送应答消息给第二进程,以此来缩短第二进程等待应答消息的时间,加快第二进程处理业务的速度,提升用户体验。本发明还公开了一种业务处理装置,具有相应技术效果。
The invention discloses a service processing method, which is applied to a first process. The method comprises the following steps: receiving a service request message sent by a second process, determining a service set to be processed according to the service request message, and determining a service set to be processed in the service set The first service subset that responds sends a response message to the second process after processing all services in the first service subset. Applying the technical solution provided by the embodiment of the present invention, in the process of processing the service request message sent by the second process, if there is a service to be answered, the first process will preferentially process the first service subset composed of the services to be answered in the service set The business to be answered, and after processing the business in the first business subset, send a response message to the second process, so as to shorten the time for the second process to wait for the response message, speed up the processing speed of the second process, and improve user experience. The invention also discloses a business processing device, which has corresponding technical effects.
Description
技术领域technical field
本发明涉及计算机应用技术领域,特别是涉及一种业务处理方法及装置。The invention relates to the field of computer application technology, in particular to a business processing method and device.
背景技术Background technique
在计算机应用中,各个进程间进行业务交互、通信越来越频繁。In computer applications, business interaction and communication among various processes are becoming more and more frequent.
近年来,许多应用场景中进程在进行业务交互、通信时,可能会要求接收进程在处理完相应业务后,进行应答,发送进程可能需要接收到应答消息后才能执行后续操作。典型的应用场景,如分布式元数据集群中,当有元数据服务发生故障时,接替故障元数据服务的备份元数据服务需要接收到其他活跃元数据服务在处理完业务请求消息后,发送的ACK,才能执行后续操作。In recent years, when processes are interacting and communicating with each other in many application scenarios, the receiving process may be required to respond after processing the corresponding business, and the sending process may perform subsequent operations only after receiving the response message. In a typical application scenario, such as in a distributed metadata cluster, when a metadata service fails, the backup metadata service that replaces the failed metadata service needs to receive the message sent by other active metadata services after processing the business request message ACK to perform subsequent operations.
在需要接收进程进行应答的应用场景中,如果接收进程业务繁忙或者接收进程处理业务较慢,导致应答消息发送较慢,可能会引起发送进程的业务无法处理或者处理速度非常慢,影响用户体验。In the application scenario that requires the receiving process to respond, if the receiving process is busy or the receiving process is slow to process the business, the response message is sent slowly, which may cause the business of the sending process to be unable to process or the processing speed is very slow, affecting user experience.
综上所述,如何有效的加快进程处理业务的速度、提升用户体验等问题,是目前本领域技术人员急需解决的技术问题。To sum up, how to effectively speed up the speed of process processing and improve user experience is a technical problem urgently needed to be solved by those skilled in the art.
发明内容Contents of the invention
本发明的目的是提供一种业务处理方法及装置,以加快进程处理业务的速度,提升用户体验。The purpose of the present invention is to provide a business processing method and device, so as to speed up the process of processing business and improve user experience.
为解决上述技术问题,本发明提供如下技术方案:In order to solve the above technical problems, the present invention provides the following technical solutions:
一种业务处理方法,应用于第一进程,包括:A business processing method, applied to a first process, comprising:
接收第二进程发送的业务请求消息;receiving the service request message sent by the second process;
根据所述业务请求消息,确定待处理的业务集合;Determine the set of services to be processed according to the service request message;
在所述业务集合中确定待应答的第一业务子集;determining a first subset of services to be answered in the service set;
在对所述第一业务子集中的全部业务处理完成后,发送应答消息给所述第二进程。After all the services in the first service subset are processed, a response message is sent to the second process.
优选地,所述在所述业务集合中确定待应答的第一业务子集,包括:Preferably, the determining the first subset of services to be answered in the service set includes:
针对所述业务集合中的每一个业务,如果该业务为待应答的业务,则将该业务添加到第一业务子集中。For each service in the service set, if the service is a service to be answered, the service is added to the first service subset.
优选地,在所述发送应答消息给所述第二进程之后,或者,在所述发送应答消息给所述第二进程的同时,还包括:Preferably, after sending the response message to the second process, or while sending the response message to the second process, the method further includes:
处理所述业务集合中非所述第一业务子集的业务。Processing services in the service set that are not the first service subset.
优选地,在所述根据所述业务请求消息,确定待处理的业务集合之后、在所述业务集合中确定待应答的第一业务子集之前,还包括:Preferably, after determining the service set to be processed according to the service request message and before determining the first service subset to be answered in the service set, the method further includes:
判断目标性能参数值是否小于预设第一阈值;judging whether the target performance parameter value is less than a preset first threshold;
如果是,则执行所述在所述业务集合中确定待应答的第一业务子集的操作。If yes, perform the operation of determining the first service subset to be answered in the service set.
优选地,在判断所述目标性能参数值大于或等于所述第一阈值时,还包括:Preferably, when judging that the target performance parameter value is greater than or equal to the first threshold, it also includes:
处理完所述业务集合中的全部业务后,发送应答消息给所述第二进程。After processing all the services in the service set, send a response message to the second process.
一种业务处理装置,应用于第一进程,包括:A service processing device, applied to a first process, comprising:
业务请求消息接收模块,用于接收第二进程发送的业务请求消息;A service request message receiving module, configured to receive a service request message sent by the second process;
业务集合确定模块,用于根据所述业务请求消息,确定待处理的业务集合;A service set determination module, configured to determine a service set to be processed according to the service request message;
第一业务子集确定模块,用于在所述业务集合中确定待应答的第一业务子集;A first service subset determination module, configured to determine a first service subset to be answered in the service set;
应答消息发送模块,用于在对所述第一业务子集中的全部业务处理完成后,发送应答消息给所述第二进程。A response message sending module, configured to send a response message to the second process after processing all services in the first service subset is completed.
优选地,所述第一业务子集确定模块,具体用于:Preferably, the first business subset determination module is specifically used for:
针对所述业务集合中的每一个业务,如果该业务为待应答的业务,则将该业务添加到第一业务子集中。For each service in the service set, if the service is a service to be answered, the service is added to the first service subset.
优选地,还包括业务处理模块,用于:Preferably, a business processing module is also included for:
在所述发送应答消息给所述第二进程之后,或者,在所述发送应答消息给所述第二进程的同时,处理所述业务集合中非所述第一业务子集的业务。After the sending of the response message to the second process, or at the same time as the sending of the response message to the second process, the services in the service set that are not the first service subset are processed.
优选地,还包括判断模块,用于:Preferably, a judging module is also included for:
在所述根据所述业务请求消息,确定待处理的业务集合之后、在所述业务集合中确定待应答的第一业务子集之前,判断目标性能参数值是否小于预设第一阈值;After determining the service set to be processed according to the service request message and before determining the first service subset to be answered in the service set, judging whether the target performance parameter value is less than a preset first threshold;
如果是,则触发所述第一业务子集确定模块。If yes, trigger the first service subset determining module.
优选地,所述应答消息发送模块,还用于:Preferably, the response message sending module is also used for:
在判断所述目标性能参数值大于或等于所述第一阈值时,处理完所述业务集合中的全部业务后,发送应答消息给所述第二进程。When it is judged that the target performance parameter value is greater than or equal to the first threshold, after all services in the service set are processed, a response message is sent to the second process.
应用本发明实施例所提供的技术方案,第一进程接收第二进程发送的业务请求消息,根据业务请求消息,确定待处理的业务集合,在业务集合中确定待应答的第一业务子集,在对第一业务子集中的全部业务处理完成后,发送应答消息给第二进程。第一进程在处理第二进程发送的业务请求消息的过程中,如果有待应答的业务,则优先处理业务集合中待应答业务组成的第一业务子集中的待应答业务,并在处理完第一业务子集中的业务后,发送应答消息给第二进程,以此来缩短第二进程等待应答消息的时间,加快第二进程处理业务的速度,提升用户体验。Applying the technical solution provided by the embodiment of the present invention, the first process receives the service request message sent by the second process, determines the service set to be processed according to the service request message, and determines the first service subset to be answered in the service set, After processing all the services in the first service subset, a response message is sent to the second process. In the process of processing the service request message sent by the second process, if there is a business to be answered, the first process will give priority to the business to be answered in the first business subset composed of the business to be answered in the business set, and after processing the first After completing the business in the business subset, send a response message to the second process, so as to shorten the waiting time of the second process for the response message, speed up the processing speed of the second process, and improve user experience.
附图说明Description of drawings
为了更清楚地说明本发明实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings that need to be used in the description of the embodiments or the prior art. Obviously, the accompanying drawings in the following description are only These are some embodiments of the present invention. Those skilled in the art can also obtain other drawings based on these drawings without creative work.
图1为本发明实施例中一种业务处理方法的实施流程图;Fig. 1 is the implementation flowchart of a business processing method in the embodiment of the present invention;
图2为现有技术中元数据服务中的部分流程图;Fig. 2 is a partial flow chart of the metadata service in the prior art;
图3为应用本发明实施例提供的技术方案后的元数据服务中的部分流程图;Fig. 3 is a partial flow chart of the metadata service after applying the technical solution provided by the embodiment of the present invention;
图4为本发明实施例中一种业务处理装置的结构示意图。Fig. 4 is a schematic structural diagram of a service processing device in an embodiment of the present invention.
具体实施方式detailed description
本发明的核心是提供的一种业务处理方法,应用于第一进程。第一进程接收第二进程发送的业务请求消息,根据业务请求消息,确定待处理的业务集合,在业务集合中确定待应答的第一业务子集,在对第一业务子集中的全部业务处理完成后,发送应答消息给第二进程。可以缩短第二进程等待应答消息的时间,加快第二进程处理业务的速度,提升用户体验。The core of the present invention is to provide a business processing method, which is applied to the first process. The first process receives the service request message sent by the second process, determines the service set to be processed according to the service request message, determines the first service subset to be answered in the service set, and processes all the services in the first service subset After completion, send a reply message to the second process. The time for the second process to wait for a response message can be shortened, the speed of processing services by the second process can be accelerated, and user experience can be improved.
为了使本技术领域的人员更好地理解本发明方案,下面结合附图和具体实施方式对本发明作进一步的详细说明。显然,所描述的实施例仅仅是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。In order to enable those skilled in the art to better understand the solution of the present invention, the present invention will be further described in detail below in conjunction with the accompanying drawings and specific embodiments. Apparently, the described embodiments are only some of the embodiments of the present invention, but not all of them. Based on the embodiments of the present invention, all other embodiments obtained by persons of ordinary skill in the art without making creative efforts belong to the protection scope of the present invention.
请参考图1,图1为本发明实施例中一种业务处理方法的实施流程图,该方法包括以下步骤:Please refer to FIG. 1. FIG. 1 is an implementation flowchart of a business processing method in an embodiment of the present invention. The method includes the following steps:
S101、接收第二进程发送的业务请求消息。S101. Receive a service request message sent by a second process.
第二进程在处理业务过程中,可能需要和第一进程进行通信或交互。具体的,在第二进程当前时段业务繁忙,需要第一进程处理部分业务,分担业务压力,或,第二进程处理的当前业务需要第一进程提供支持,或,第二进程需要知道第一进程的状况等情况下,都可能需要和第一进程进行通信或交互。在这些情况下,第二进程可以向第一进程发送业务请求消息。其中,业务请求消息可以包括:请求类型、待处理的业务、针对每个业务的应答要求等。During business processing, the second process may need to communicate or interact with the first process. Specifically, the second process is busy with business during the current period, and the first process needs to process part of the business to share the business pressure, or, the current business processed by the second process needs the support of the first process, or, the second process needs to know the first process It may be necessary to communicate or interact with the first process in any situation. In these cases, the second process may send a service request message to the first process. Wherein, the service request message may include: request type, service to be processed, response requirements for each service, and the like.
第一进程接收到第二进程发送的业务请求消息后,可以执行步骤S102的操作。After the first process receives the service request message sent by the second process, it may perform the operation of step S102.
S102、根据业务请求消息,确定待处理的业务集合。S102. Determine a set of services to be processed according to the service request message.
第一进程可以根据业务请求消息,确定第二进程请求第一进程处理的业务,对第一进程而言,这些业务为待处理的业务。第一进程可以将待处理的业务构成的集合确定为待处理的业务集合,也就是说,业务集合包括了第二进程请求第一进程处理的所有业务。According to the service request message, the first process can determine the services requested by the second process to be processed by the first process. For the first process, these services are services to be processed. The first process may determine the set of services to be processed as the service set to be processed, that is, the service set includes all services requested by the second process to be processed by the first process.
S103、在业务集合中确定待应答的第一业务子集。S103. Determine a first subset of services to be answered in the service set.
第一进程将业务集合中业务进行拆分,将待应答的业务确定为第一业务子集中的业务。The first process splits the services in the service set, and determines the services to be answered as services in the first service subset.
在本发明的一个实施例中,步骤S103可以包括以下步骤:In one embodiment of the present invention, step S103 may include the following steps:
针对业务集合中的每一个业务,如果该业务为待应答的业务,则将该业务添加到第一业务子集中。For each service in the service set, if the service is a service to be answered, the service is added to the first service subset.
在本实施例中,可以预先设置一个判断业务是否为待应答的业务的规则,例如,判断业务的处理逻辑中是否有返回值,也可以根据业务请求消息中携带的针对每个业务的应答要求判断是否为待应答的业务,还可以是管理人员预先对每一个业务进行判断分类,形成判断标准。In this embodiment, a rule for judging whether a business is a business to be answered can be set in advance, for example, judging whether there is a return value in the processing logic of the business, or according to the response requirements for each business carried in the business request message To judge whether it is a service to be answered, the management personnel can also judge and classify each business in advance to form a judgment standard.
第一进程根据预先设置的判断业务是否为待应答的业务的规则,对业务集合中的每一个业务进行判断,如果该业务为待应答的业务,即表明该业务为第一进程在应答第二进程之前,必须完成的业务,则确定该业务为第一业务子集中的业务。The first process judges each business in the business set according to the preset rules for judging whether the business is a business to be answered. If the business is a business to be answered, it means that the business is the first process answering the second If the business must be completed before the process, it is determined that the business is a business in the first business subset.
S104、在对第一业务子集中的全部业务处理完成后,发送应答消息给第二进程。S104. After processing all the services in the first service subset, send a response message to the second process.
第一进程在处理完第一业务子集中的全部业务后,可以发送携带有待应答的业务的处理结果的应答消息给第二进程。第二进程接收到第一进程的应答消息后,可以执行后续操作。After processing all the services in the first service subset, the first process may send a response message carrying the processing results of the services to be responded to to the second process. After receiving the response message from the first process, the second process can perform subsequent operations.
在本发明的一个实施例中,在第一进程发送应答消息给第二进程之后,或者,在发送应答消息给第二进程的同时,还可以执行以下步骤:In one embodiment of the present invention, after the first process sends the response message to the second process, or while sending the response message to the second process, the following steps may also be performed:
处理业务集合中非第一业务子集的业务。Processing services other than the first service subset in the service set.
第一进程处理完第一业务子集中的内容后,或者,在发送应答消息给第二进程的同时,可以处理业务集合中非第一业务子集中的业务。After the first process finishes processing the content in the first service subset, or while sending a response message to the second process, it can process services in the service set that are not in the first service subset.
具体的,第一进程可以将业务集合中非第一业务子集的业务确定为第二业务子集中的业务,也就是说,第二业务子集是第一业务子集在业务集合中的补集。确定第二业务子集后,第一进程处理第二业务子集中的业务,即处理业务集合中未处理的业务。Specifically, the first process may determine services in the service set that are not in the first service subset as services in the second service subset, that is, the second service subset is the complement of the first service subset in the service set. set. After determining the second service subset, the first process processes services in the second service subset, that is, processes unprocessed services in the service set.
应用本发明实施例所提供的方法,第一进程接收第二进程发送的业务请求消息,根据业务请求消息,确定待处理的业务集合,在业务集合中确定待应答的第一业务子集,在对第一业务子集中的全部业务处理完成后,发送应答消息给第二进程。第一进程在处理第二进程发送的业务请求消息的过程中,如果有待应答的业务,则优先处理业务集合中待应答业务组成的第一业务子集中的待应答业务,并在处理完第一业务子集中的业务后,发送应答消息给第二进程,以此来缩短第二进程等待应答消息的时间,加快第二进程处理业务的速度,提升用户体验。Applying the method provided by the embodiment of the present invention, the first process receives the service request message sent by the second process, determines the service set to be processed according to the service request message, and determines the first service subset to be answered in the service set, and then After all the services in the first service subset are processed, a response message is sent to the second process. In the process of processing the service request message sent by the second process, if there is a business to be answered, the first process will give priority to the business to be answered in the first business subset composed of the business to be answered in the business set, and after processing the first After completing the business in the business subset, send a response message to the second process, so as to shorten the waiting time of the second process for the response message, speed up the processing speed of the second process, and improve user experience.
在本发明的一个实施例中,可以预先设置一个针对回复应答消息的功能开关。该功能开关的开启或者闭合状态可以预先确定,也可以根据实际情况进行确定和调整,本发明实施例对此并不限定。In an embodiment of the present invention, a function switch for replying to the response message may be preset. The open or closed state of the functional switch may be predetermined, or may be determined and adjusted according to actual conditions, which is not limited in this embodiment of the present invention.
在本实施例中,第一进程在执行步骤S101之前,首先判断针对回复应答消息的功能开关是否开启;如果是,则可以依次执行步骤S101至步骤S104的操作;如果否,则在执行步骤S101接收第二进程发送的业务请求消息的操作之后,根据业务请求消息,确定待处理的业务,然后处理完待处理的所有业务后,发送应答消息给第二进程。In this embodiment, before step S101 is executed, the first process first judges whether the function switch for the response message is turned on; if yes, the operations from step S101 to step S104 can be executed sequentially; After receiving the operation of the service request message sent by the second process, determine the service to be processed according to the service request message, and then send a response message to the second process after processing all the services to be processed.
根据功能开关,可以确定是否优先处理应答消息对应的第一业务子集中的业务,可以根据实际情况,进行业务处理,以满足用户需求,以及提升用户体验。According to the function switch, it can be determined whether to give priority to the services in the first service subset corresponding to the response message, and service processing can be performed according to the actual situation to meet user needs and improve user experience.
在本发明的一个实施例中,在根据业务请求消息,确定待处理的业务集合之后、在业务集合中确定待应答的第一业务子集之前,还可以执行以下步骤:In an embodiment of the present invention, after determining the service set to be processed according to the service request message and before determining the first service subset to be answered in the service set, the following steps may also be performed:
判断目标性能参数值是否小于预设第一阈值;如果是,则执行步骤S103在业务集合中确定待应答的第一业务子集的操作。Judging whether the target performance parameter value is smaller than the preset first threshold; if yes, performing step S103 to determine the first service subset to be answered in the service set.
需要说明的是,第一进程的目标性能参数可以表示当前第一进程的业务处理状况,如可以表示第一进程的业务处理的速度、待处理的业务量、当前的资源使用情况。可以根据目标性能参数,判断第一进程处理完第二进程发送的业务请求消息对应的业务集合中的业务,并向第二进程发送应答消息的时间。It should be noted that the target performance parameter of the first process may represent the current business processing status of the first process, for example, it may represent the business processing speed of the first process, the amount of business to be processed, and the current resource usage. The time when the first process finishes processing the services in the service set corresponding to the service request message sent by the second process and sends a response message to the second process can be judged according to the target performance parameter.
具体的,该目标性能参数可以由单一的第一进程的某些参数表示,也可以是根据第一进程的多个性能参数进行加权计算后得到,例如:目标性能参数可以是第一进程的业务处理速度,可以是第一进程的业务量,也可以是业务处理速度和业务量加权和。需要说明的是,目标性能参数值越大,那么第一进程的业务量就越小,或者,处理业务的速度越快,或者,业务量小且处理速度快。因而目标性能参数值可以在一定程度上表示第一进程处理业务请求消息对应的业务的时间,也就是说第一进程发送应答消息给第二进程时间,可以根据目标性能参数值进行预估。Specifically, the target performance parameter may be represented by certain parameters of a single first process, or may be obtained after weighted calculation based on multiple performance parameters of the first process. For example, the target performance parameter may be the business The processing speed may be the business volume of the first process, or may be the weighted sum of the business processing speed and the business volume. It should be noted that the larger the value of the target performance parameter, the smaller the business volume of the first process, or the faster the business processing speed, or the smaller business volume and the faster processing speed. Therefore, the target performance parameter value can represent to a certain extent the time for the first process to process the service corresponding to the service request message, that is to say, the time for the first process to send a response message to the second process can be estimated according to the target performance parameter value.
在本实施例中,可以根据具体的目标性能参数预先设置一个第一阈值,第一阈值的具体大小可以预先设置,也可以根据实际情况进行确定和调整,本发明实施例对此并不限定。In this embodiment, a first threshold may be preset according to a specific target performance parameter, and the specific size of the first threshold may be preset or determined and adjusted according to actual conditions, which is not limited in this embodiment of the present invention.
在根据业务请求消息,确定待处理的业务集合之后、在根据业务集合中确定待应答的第一业务子集之前,可以判断当前自身的目标性能参数值是否小于预设第一阈值,如果是,则表明第一进程如果处理完业务请求消息中的所有业务后,向第二进程发送应答消息会比较晚,可能导致第二进程等待应答消息的时间较长,在这种情况下,第一进程可以执行步骤S103的操作,也就是说,第一进程可以处理业务集合中属于第一业务集合的全部业务后,立即发送应答消息给第二进程,可以缩短第二进程的等待时间。After determining the service set to be processed according to the service request message and before determining the first service subset to be answered according to the service set, it may be determined whether the current target performance parameter value of itself is less than the preset first threshold, and if so, It shows that if the first process has processed all the services in the service request message, it will be relatively late to send a response message to the second process, which may cause the second process to wait for a longer time for the response message. In this case, the first process The operation of step S103 can be performed, that is, after the first process can process all services belonging to the first service set in the service set, it can immediately send a response message to the second process, which can shorten the waiting time of the second process.
在本发明的另一个实施例中,在判断目标性能参数大于或等于第一阈值时,处理完业务集合中的全部业务后,发送应答消息给第二进程。In another embodiment of the present invention, when it is judged that the target performance parameter is greater than or equal to the first threshold, after all services in the service set are processed, a response message is sent to the second process.
在本发明实施例中,如果第一进程的目标性能参数值大于或等于预设的第一阈值,则表明第一进程可以快速的处理完业务集合中的所有业务,并向第二进程发送应答消息,第二进程可以不必等待较长的时间。在这种情况下,第一进程可以处理完业务集合中的所有业务后,再发送应答消息给第二进程。In the embodiment of the present invention, if the target performance parameter value of the first process is greater than or equal to the preset first threshold, it indicates that the first process can quickly process all the services in the service set and send a response to the second process message, the second process may not have to wait for a long time. In this case, the first process may send a response message to the second process after processing all services in the service set.
执行上述操作,可以使第二进程接收应答消息的等待时间较短,避免在业务集合中的各个业务之间存在关联关系时,只处理业务集合中的部分业务,可能会导致第二进程收到的应答消息有误的情况的发生。Performing the above operations can shorten the waiting time for the second process to receive the response message, and avoid processing only part of the services in the service set when there is a relationship between the various services in the service set, which may cause the second process to receive Occurs that the reply message is incorrect.
为了便于理解本发明的技术方案,下面以元数据服务为例,对本发明实施例进行详细说明。In order to facilitate the understanding of the technical solution of the present invention, the following takes the metadata service as an example to describe the embodiment of the present invention in detail.
需要说明的是,下文描述的元数据服务可以为元数据进程。It should be noted that the metadata service described below may be a metadata process.
元数据集群通常是主备模式(激活-备份)构造。某个激活的元数据服务故障时,元数据集群中某一备份的元数据服务将启动接替流程。备份的元数据服务接替过程会经历一系列阶段,其中,主要和其他激活状态的元数据服务通信,以获取故障的元数据服务的缓存内容。待接替完全成功后,原备份的元数据服务顶替原故障的元数据服务,变成激活状态,对外继续提供服务。Metadata clusters are usually constructed in active-standby mode (activation-backup). When an activated metadata service fails, a backup metadata service in the metadata cluster will start the takeover process. The succession process of the backup metadata service will go through a series of stages, in which it mainly communicates with other active metadata services to obtain the cached content of the failed metadata service. After the replacement is completely successful, the original backup metadata service replaces the original failed metadata service, becomes active, and continues to provide external services.
需要说明的是,在接替过程中,即备份的元数据服务在正式激活前,是不能对外提供服务的。即无法响应客户端此时输入的最新读写请求。因此接替过程的快慢,直接影响到系统可用性。接替时间越快,用户体验越好。It should be noted that during the succession process, that is, the backup metadata service cannot provide external services before it is officially activated. That is, it cannot respond to the latest read and write requests entered by the client at this time. Therefore, the speed of the succession process directly affects the system availability. The faster the takeover time, the better the user experience.
如图2所示,现有的接替过程:当原1号元数据服务故障后,备份元数据服务开始接替原1号元数据服务,成为1号元数据服务,并分别向处于激活状态的0号元数据服务和2号元数据服务发送业务请求消息。与此同时,0号元数据服务和2号元数据服务感知到原1号元数据服务故障后,分别向1号元数据服务发送业务请求消息。0号元数据服务、1号元数据服务、2号元数据服务处理完业务请求消息对应的业务后,分别回复ACK。1号元数据服务在处理完0号元数据服务和2号元数据服务发送的业务请求消息对应的业务后,需要收到0号元数据服务和2号元数据服务分别回复的ACK,才能执行后续操作。As shown in Figure 2, the existing replacement process: when the original No. 1 metadata service fails, the backup metadata service starts to take over the original No. No. 2 metadata service and No. 2 metadata service send service request messages. At the same time, metadata service No. 0 and metadata service No. 2 send service request messages to metadata service No. 1 after sensing the failure of the original metadata service No. 1. Metadata service No. 0, Metadata service No. 1, and Metadata service No. 2 reply ACK respectively after processing the service corresponding to the service request message. After metadata service No. 1 processes the business corresponding to the business request message sent by metadata service No. 0 and metadata service No. 2, it needs to receive the ACK replies from metadata service No. 0 and metadata service No. 2 respectively before executing Follow up.
在这种情况下,如果0号元数据服务和/或2号元数据服务在处理业务请求消息时,因自身的工作繁忙、业务处理速度较慢,可能会导致向1号元数据服务回复ACK较慢,进一步可能会造成1号元数据服务的接替工作缓慢或者接替工作停滞,影响用户体验。In this case, if metadata service No. 0 and/or metadata service No. 2 are processing business request messages, due to their busy work and slow business processing speed, they may reply ACK to metadata service No. 1 If it is slow, it may further cause slow or stagnant succession of No. 1 metadata service, affecting user experience.
其中,0号元数据服务和2号元数据服务回复的ACK需要带回的内容只是业务请求消息对应的一部分业务处理结果,并不是所有的业务处理结果。基于对元数据服务的具体情况,进行考虑后,在实际应用中,0号元数据服务、1号元数据服务、2号元数据服务之间可以利用本发明实施例提供的技术方案处理故障交替业务。Among them, the content to be brought back by the ACK replies from metadata service No. 0 and metadata service No. 2 is only part of the business processing results corresponding to the business request message, not all the business processing results. Based on the specific situation of the metadata service, after consideration, in practical applications, the technical solution provided by the embodiment of the present invention can be used to deal with the alternation of faults among the metadata service No. 0, metadata service No. 1, and metadata service No. business.
由于元数据故障交替过程中,0号元数据服务、1号元数据服务、2号元数据服务都可能会发送业务请求消息,也都可能会处理接收到的业务请求消息和回复应答消息,所以0号元数据服务、1号元数据服务、2号元数据服务既可以作为第一进程,也可以作为第二进程。具体的,当他们接收业务请求消息,处理业务请求消息时,可以看作第一进程;当他们发送业务请求消息和接收应答消息时,可以看作第二进程。During the alternation of metadata failures, metadata service No. 0, metadata service No. 1, and metadata service No. 2 may send service request messages, and may also process received service request messages and reply response messages, so Metadata service No. 0, metadata service No. 1, and metadata service No. 2 can be used as the first process or as the second process. Specifically, when they receive and process service request messages, they can be regarded as the first process; when they send service request messages and receive response messages, they can be regarded as the second process.
如图3所示,应用本发明提供的技术方案,元数据服务接替过程可以为:当原1号元数据服务故障后,备份元数据服务开始接替原1号元数据服务,成为1号元数据服务,1号元数据服务分别向处于激活状态的0号元数据服务和2号元数据服务发送业务请求消息。与此同时,0号元数据服务和2号元数据服务感知到原1号元数据服务故障后,也向1号元数据服务发送业务请求消息。As shown in Figure 3, applying the technical solution provided by the present invention, the metadata service replacement process can be as follows: when the original No. 1 metadata service fails, the backup metadata service starts to take over the original No. 1 metadata service and becomes No. 1 metadata service For services, metadata service No. 1 sends service request messages to metadata service No. 0 and metadata service No. 2 in the activated state respectively. At the same time, metadata service No. 0 and metadata service No. 2 also send service request messages to metadata service No. 1 after sensing the failure of the original metadata service No. 1.
1号元数据服务处理完接收到的业务请求对应的业务集合中的所有业务后,分别回复ACK。0号元数据服务和2号元数据服务处理完ACK对应的第一业务子集中的业务后,分别回复ACK。此时,1号元数据服务接收到0号元数据服务和2号元数据服务回复的ACK后,可以执行后续操作。在1号元数据服务执行后续操作的同时,0号元数据服务和2号元数据服务可以分别处理业务集合中非第一业务子集中的业务。After the No. 1 metadata service finishes processing all the services in the service set corresponding to the received service request, it returns ACK respectively. After the metadata service No. 0 and the metadata service No. 2 have processed the services in the first service subset corresponding to the ACK, they reply ACK respectively. At this time, after metadata service No. 1 receives the ACK replies from metadata service No. 0 and metadata service No. 2, subsequent operations can be performed. While metadata service No. 1 is performing subsequent operations, metadata service No. 0 and metadata service No. 2 can respectively process services in the service set that are not in the first service subset.
在不影响逻辑和功能的情况下,可以利用本发明实施例提供的技术方案,0号元数据服务和2号元数据服务处理完1号元数据服务发送的业务请求消息对应的第一业务子集后,向1号元数据服务发送ACK,可以缩短1号元数据服务等待ACK的时间,加快1号元数据服务的业务处理速度,可以更快的完成接替过程,成为激活状态的元数据服务,开始对外提供服务,提升元数据服务系统对外提供服务的可用性,提升用户体验。Without affecting the logic and function, the technical solution provided by the embodiment of the present invention can be used. Metadata service No. 0 and metadata service No. 2 have processed the first service sub-item corresponding to the service request message sent by metadata service No. 1. After collection, send ACK to No. 1 metadata service, which can shorten the time for No. 1 metadata service to wait for ACK, speed up the business processing speed of No. 1 metadata service, and complete the succession process faster, becoming an activated metadata service , began to provide external services, improve the availability of external services provided by the metadata service system, and improve user experience.
相应于上面的方法实施例,本发明实施例还提供了一种业务处理装置,应用于第一进程,下文描述的一种业务处理装置与上文描述的一种业务处理方法可相互对应参照。Corresponding to the above method embodiment, the embodiment of the present invention also provides a service processing device, which is applied to the first process. The service processing device described below and the service processing method described above can be referred to in correspondence.
参见图4所示,该装置包括:Referring to shown in Figure 4, the device includes:
业务请求消息接收模块201,用于接收第二进程发送的业务请求消息;A service request message receiving module 201, configured to receive a service request message sent by the second process;
业务集合确定模块202,用于根据业务请求消息,确定待处理的业务集合;A service set determining module 202, configured to determine a service set to be processed according to the service request message;
第一业务子集确定模块203,用于在业务集合中确定待应答的第一业务子集;The first service subset determination module 203 is configured to determine the first service subset to be answered in the service set;
应答消息发送模块204,用于在对第一业务子集中的全部业务处理完成后,发送应答消息给第二进程。The response message sending module 204 is configured to send a response message to the second process after processing all services in the first service subset.
应用本发明实施例所提供的装置,第一进程接收第二进程发送的业务请求消息,根据业务请求消息,确定待处理的业务集合,在业务集合中确定待应答的第一业务子集,在对第一业务子集中的全部业务处理完成后,发送应答消息给第二进程。第一进程在处理第二进程发送的业务请求消息的过程中,如果有待应答的业务,则优先处理业务集合中待应答业务组成的第一业务子集中的待应答业务,并在处理完第一业务子集中的业务后,发送应答消息给第二进程,以此来缩短第二进程等待应答消息的时间,加快第二进程处理业务的速度,提升用户体验。Applying the device provided by the embodiment of the present invention, the first process receives the service request message sent by the second process, determines the service set to be processed according to the service request message, and determines the first service subset to be answered in the service set. After all the services in the first service subset are processed, a response message is sent to the second process. In the process of processing the service request message sent by the second process, if there is a business to be answered, the first process will give priority to the business to be answered in the first business subset composed of the business to be answered in the business set, and after processing the first After completing the business in the business subset, send a response message to the second process, so as to shorten the waiting time of the second process for the response message, speed up the processing speed of the second process, and improve user experience.
在本发明的一种具体实施方式中,第一业务子集确定模块203,具体用于:In a specific implementation manner of the present invention, the first service subset determination module 203 is specifically used for:
针对业务集合中的每一个业务,如果该业务为待应答的业务,则将该业务添加到第一业务子集中。For each service in the service set, if the service is a service to be answered, the service is added to the first service subset.
在本发明的一种具体实施方式中,还包括业务处理模块,用于:In a specific embodiment of the present invention, it also includes a business processing module for:
在发送应答消息给第二进程之后,或者,在发送应答消息给第二进程的同时,处理业务集合中非第一业务子集的业务。After sending the response message to the second process, or while sending the response message to the second process, the services of the service set other than the first service subset are processed.
在本发明的一种具体实施方式中,还包括判断模块,用于:In a specific embodiment of the present invention, it also includes a judging module for:
在根据业务请求消息,确定待处理的业务集合之后、在业务集合中确定待应答的第一业务子集之前,判断目标性能参数值是否小于预设第一阈值;After determining the service set to be processed according to the service request message and before determining the first service subset to be answered in the service set, judging whether the target performance parameter value is less than a preset first threshold;
如果是,则触发第一业务子集确定模块203。If yes, trigger the first service subset determining module 203 .
在本发明的一种具体实施方式中,应答消息发送模块204,还用于:In a specific implementation manner of the present invention, the response message sending module 204 is also used for:
在判断目标性能参数值大于或等于第一阈值时,处理完业务集合中的全部业务后,发送应答消息给第二进程。When it is judged that the target performance parameter value is greater than or equal to the first threshold, after all services in the service set are processed, a response message is sent to the second process.
本说明书中各个实施例采用递进的方式描述,每个实施例重点说明的都是与其它实施例的不同之处,各个实施例之间相同或相似部分互相参见即可。对于实施例公开的装置而言,由于其与实施例公开的方法相对应,所以描述的比较简单,相关之处参见方法部分说明即可。Each embodiment in this specification is described in a progressive manner, each embodiment focuses on the difference from other embodiments, and the same or similar parts of each embodiment can be referred to each other. As for the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and for the related part, please refer to the description of the method part.
专业人员还可以进一步意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,能够以电子硬件、计算机软件或者二者的结合来实现,为了清楚地说明硬件和软件的可互换性,在上述说明中已经按照功能一般性地描述了各示例的组成及步骤。这些功能究竟以硬件还是软件方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本发明的范围。Professionals can further realize that the units and algorithm steps of the examples described in conjunction with the embodiments disclosed herein can be implemented by electronic hardware, computer software or a combination of the two. In order to clearly illustrate the possible For interchangeability, in the above description, the composition and steps of each example have been generally described according to their functions. Whether these functions are executed by hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art may use different methods to implement the described functions for each specific application, but such implementation should not be regarded as exceeding the scope of the present invention.
结合本文中所公开的实施例描述的方法或算法的步骤可以直接用硬件、处理器执行的软件模块,或者二者的结合来实施。软件模块可以置于随机存储器(RAM)、内存、只读存储器(ROM)、电可编程ROM、电可擦除可编程ROM、寄存器、硬盘、可移动磁盘、CD-ROM、或技术领域内所公知的任意其它形式的存储介质中。The steps of the methods or algorithms described in connection with the embodiments disclosed herein may be directly implemented by hardware, software modules executed by a processor, or a combination of both. Software modules can be placed in random access memory (RAM), internal memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, removable disk, CD-ROM, or any other Any other known storage medium.
本文中应用了具体个例对本发明的原理及实施方式进行了阐述,以上实施例的说明只是用于帮助理解本发明的技术方案及其核心思想。应当指出,对于本技术领域的普通技术人员来说,在不脱离本发明原理的前提下,还可以对本发明进行若干改进和修饰,这些改进和修饰也落入本发明权利要求的保护范围内。In this paper, specific examples are used to illustrate the principles and implementation methods of the present invention, and the descriptions of the above embodiments are only used to help understand the technical solutions and core ideas of the present invention. It should be pointed out that for those skilled in the art, without departing from the principle of the present invention, some improvements and modifications can be made to the present invention, and these improvements and modifications also fall within the protection scope of the claims of the present invention.
Claims (10)
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201710780194.5A CN107479992A (en) | 2017-09-01 | 2017-09-01 | A kind of method for processing business and device |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201710780194.5A CN107479992A (en) | 2017-09-01 | 2017-09-01 | A kind of method for processing business and device |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| CN107479992A true CN107479992A (en) | 2017-12-15 |
Family
ID=60604339
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN201710780194.5A Pending CN107479992A (en) | 2017-09-01 | 2017-09-01 | A kind of method for processing business and device |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN107479992A (en) |
Cited By (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN110866157A (en) * | 2018-08-27 | 2020-03-06 | 北京猎户星空科技有限公司 | Robot response method and device and robot |
Citations (8)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US6578005B1 (en) * | 1996-11-22 | 2003-06-10 | British Telecommunications Public Limited Company | Method and apparatus for resource allocation when schedule changes are incorporated in real time |
| CN101977359A (en) * | 2010-09-26 | 2011-02-16 | 北京握奇数据系统有限公司 | Method and device for processing mobile data service |
| CN102402423A (en) * | 2010-09-19 | 2012-04-04 | 百度在线网络技术(北京)有限公司 | Method and equipment for multitasking in network equipment |
| CN102799467A (en) * | 2011-05-27 | 2012-11-28 | 金蝶软件(中国)有限公司 | Method and system for allocating tasks |
| CN103246557A (en) * | 2012-02-07 | 2013-08-14 | 腾讯科技(深圳)有限公司 | Method and device for calling application information in cross process mode |
| US20140123138A1 (en) * | 2012-10-31 | 2014-05-01 | Samsung Sds Co., Ltd. | Hypervisor-based server duplication system and method and storage medium storing server duplication computer program |
| CN103927225A (en) * | 2014-04-22 | 2014-07-16 | 浪潮电子信息产业股份有限公司 | Multi-core framework Internet information processing and optimizing method |
| CN106921688A (en) * | 2015-12-24 | 2017-07-04 | 阿里巴巴集团控股有限公司 | The service providing method and distributed system of distributed system |
-
2017
- 2017-09-01 CN CN201710780194.5A patent/CN107479992A/en active Pending
Patent Citations (8)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US6578005B1 (en) * | 1996-11-22 | 2003-06-10 | British Telecommunications Public Limited Company | Method and apparatus for resource allocation when schedule changes are incorporated in real time |
| CN102402423A (en) * | 2010-09-19 | 2012-04-04 | 百度在线网络技术(北京)有限公司 | Method and equipment for multitasking in network equipment |
| CN101977359A (en) * | 2010-09-26 | 2011-02-16 | 北京握奇数据系统有限公司 | Method and device for processing mobile data service |
| CN102799467A (en) * | 2011-05-27 | 2012-11-28 | 金蝶软件(中国)有限公司 | Method and system for allocating tasks |
| CN103246557A (en) * | 2012-02-07 | 2013-08-14 | 腾讯科技(深圳)有限公司 | Method and device for calling application information in cross process mode |
| US20140123138A1 (en) * | 2012-10-31 | 2014-05-01 | Samsung Sds Co., Ltd. | Hypervisor-based server duplication system and method and storage medium storing server duplication computer program |
| CN103927225A (en) * | 2014-04-22 | 2014-07-16 | 浪潮电子信息产业股份有限公司 | Multi-core framework Internet information processing and optimizing method |
| CN106921688A (en) * | 2015-12-24 | 2017-07-04 | 阿里巴巴集团控股有限公司 | The service providing method and distributed system of distributed system |
Cited By (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN110866157A (en) * | 2018-08-27 | 2020-03-06 | 北京猎户星空科技有限公司 | Robot response method and device and robot |
| CN110866157B (en) * | 2018-08-27 | 2022-07-15 | 北京猎户星空科技有限公司 | Robot response method and device and robot |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| CN106533805B (en) | Micro-service request processing method, micro-service controller and micro-service architecture | |
| CN108173911B (en) | Microservice fault detection and processing method and device | |
| CN105933408B (en) | A kind of implementation method and device of Redis universal middleware | |
| CN106020976B (en) | Memory is exhausted into the method and apparatus that process flow is unloaded to user's space | |
| CN108804119A (en) | Configure update method, device, system, configuration center, application node and medium | |
| CN106330475A (en) | A method and device for managing active and standby nodes in a communication system and a high-availability cluster | |
| CN108075934A (en) | A kind of network quality monitoring method, apparatus and system | |
| CN107678918A (en) | The OSD heartbeat mechanisms method to set up and device of a kind of distributed file system | |
| CN105357042B (en) | A kind of highly available cluster system and its host node and from node | |
| CN106331081B (en) | A kind of information synchronization method and device | |
| CN116126457A (en) | Container migration method and server cluster | |
| CN111314443A (en) | Node processing method, device and device and medium based on distributed storage system | |
| CN114531373A (en) | Node state detection method, node state detection device, equipment and medium | |
| WO2017185615A1 (en) | Method for determining service status of service processing device and scheduling device | |
| CN106131241B (en) | A network connection method, device and mobile terminal | |
| TWI716822B (en) | Method and device for correcting transaction causality, and electronic equipment | |
| CN106357744A (en) | Cluster reconnection method and system for SMB (server message block) client and SMB client | |
| CN107479992A (en) | A kind of method for processing business and device | |
| CN108964992A (en) | A kind of node failure detection method, device and computer readable storage medium | |
| CN108984779A (en) | Distributed file system snapshot rollback metadata processing method, device and equipment | |
| CN111901395A (en) | Multi-cluster handover method and device | |
| CN115454928A (en) | System online migration method, system online migration device, equipment and medium | |
| CN107728939A (en) | I O scheduling method, apparatus, equipment and storage medium based on Linux | |
| CN107276828A (en) | A kind of dispatching method and device of cluster interior joint | |
| CN110691002A (en) | Interrupt detection method and device |
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 | ||
| RJ01 | Rejection of invention patent application after publication |
Application publication date: 20171215 |
|
| RJ01 | Rejection of invention patent application after publication |