CN103428273B - The method and apparatus of response inquiry is carried out in asynchronous system is mutual - Google Patents
The method and apparatus of response inquiry is carried out in asynchronous system is mutual Download PDFInfo
- Publication number
- CN103428273B CN103428273B CN201310305486.5A CN201310305486A CN103428273B CN 103428273 B CN103428273 B CN 103428273B CN 201310305486 A CN201310305486 A CN 201310305486A CN 103428273 B CN103428273 B CN 103428273B
- Authority
- CN
- China
- Prior art keywords
- time
- response
- request
- inquiry
- requested
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
Landscapes
- Computer And Data Communications (AREA)
- Mobile Radio Communication Systems (AREA)
Abstract
本发明的目的是提供一种用于异步式交互中在请求设备端进行响应询问的方法与装置。其中,请求设备在向被请求设备发送数据请求后,根据所述被请求设备所对应的参考响应时间以及当前响应等待期间内询问请求的收敛询问频率,确定在所述当前响应等待期间内每次询问请求的请求时间点;在每个请求时间点,向所述被请求设备发送询问请求,直至满足预定的停止条件。由于响应等待期间内的多个询问请求时间点呈收敛排列,本发明使得请求设备的等待时间也迅速收敛,并避免了被请求设备因故障、过载等情况无法正常工作时,请求设备的空等待,同时,当有大量请求设备并发数据请求时,由于询问请求的减少,被请求设备的负载也被有效降低。
The object of the present invention is to provide a method and device for responding to inquiries at the requesting device side in asynchronous interaction. Wherein, after the requesting device sends the data request to the requested device, according to the reference response time corresponding to the requested device and the converging query frequency of the query request during the current response waiting period, it is determined that each time during the current response waiting period A request time point of the inquiry request; at each request time point, an inquiry request is sent to the requested device until a predetermined stop condition is satisfied. Since multiple inquiry request time points in the response waiting period are in a convergent arrangement, the invention makes the waiting time of the requesting device converge quickly, and avoids the idle waiting of the requesting device when the requested device cannot work normally due to failure, overload, etc. , and at the same time, when there are a large number of requesting devices concurrently requesting data, due to the reduction of query requests, the load of the requested devices is also effectively reduced.
Description
技术领域technical field
本发明涉及异步式交互技术领域,尤其涉及一种用于异步式交互中请求设备进行响应询问的技术。The invention relates to the technical field of asynchronous interaction, in particular to a technology for requesting equipment to respond to inquiries in asynchronous interaction.
背景技术Background technique
在采用异步式交互的场景下,当请求方向被请求方(如服务器)发起请求时,服务器需实时生成数据或者实时查询数据库,这个过程需要耗费一定的时间,但请求方却并不知道服务器何时能够生成完毕相应的请求数据。In the scenario of using asynchronous interaction, when the requester initiates a request to the requested party (such as the server), the server needs to generate data or query the database in real time. This process takes a certain amount of time, but the requesting party does not know where the server is. The corresponding request data can be generated.
现有技术中多采用周期性的轮询方式来向服务器发送询问请求,如每隔一定的时间向服务器发起请求,询问数据是否生成完毕。在服务器准备数据过程中,如请求方与服务器的交互次数较多,将会对服务器造成较大的压力负载,同时等待过程中服务器也无法给请求方相应的反馈,使得请求方无法预知需要等待的时间。In the prior art, a periodic polling method is often used to send an inquiry request to the server, such as sending a request to the server at regular intervals to inquire whether the data has been generated. In the process of server preparing data, if the number of interactions between the requester and the server is large, it will cause a large pressure load on the server. At the same time, the server cannot give corresponding feedback to the requester during the waiting process, making it impossible for the requester to predict the need to wait. time.
发明内容Contents of the invention
本发明的目的是提供一种用于异步式交互中在请求设备端进行响应询问的方法与装置。The object of the present invention is to provide a method and device for responding to inquiries at the requesting device side in asynchronous interaction.
根据本发明的一个方面,提供了一种用于异步式交互中请求设备进行响应询问的方法,其中,该方法包括:According to one aspect of the present invention, a method for requesting a device to respond to an inquiry in an asynchronous interaction is provided, wherein the method includes:
a在向被请求设备发送数据请求后,根据所述被请求设备所对应的参考响应时间以及当前响应等待期间内询问请求的收敛询问频率,确定在所述当前响应等待期间内每次询问请求的请求时间点;a After sending a data request to the requested device, according to the reference response time corresponding to the requested device and the convergent query frequency of the query request during the current response waiting period, determine the time limit of each query request during the current response waiting period request time point;
b在每个请求时间点,向所述被请求设备发送询问请求,直至满足预定的停止条件。b. At each request time point, send an inquiry request to the requested device until a predetermined stop condition is met.
根据本发明的另一个方面,还提供了一种用于异步式交互中在请求设备端进行响应询问的装置,其中,该装置包括:According to another aspect of the present invention, there is also provided an apparatus for responding to an inquiry at the requesting device side in an asynchronous interaction, wherein the apparatus includes:
请求时间确定装置,用于在向被请求设备发送数据请求后,根据所述被请求设备所对应的参考响应时间以及当前响应等待期间内询问请求的收敛询问频率,确定在所述当前响应等待期间内每次询问请求的请求时间点;The request time determining device is used to determine the time of the request during the current response waiting period according to the reference response time corresponding to the requested device and the convergence query frequency of the query request during the current response waiting period after sending the data request to the requested device. The request time point of each inquiry request within;
询问请求发送装置,用于在每个请求时间点,向所述被请求设备发送询问请求,直至满足预定的停止条件。The inquiry request sending means is used to send an inquiry request to the requested device at each request time point until a predetermined stop condition is met.
与现有技术相比,本发明在异步式交互中,请求设备根据参考响应时间以及收敛询问频率来确定当前响应等待期间内的每次询问请求时间点,并在相应时间点向被请求设备发送询问请求。由于响应等待期间内的多个询问请求时间点呈收敛排列,其使得请求设备的等待时间也迅速收敛,并避免了被请求设备因故障、过载等情况无法正常工作时,请求设备的空等待,同时,当有大量请求设备并发数据请求时,由于询问请求的减少,被请求设备的负载也被有效降低。Compared with the prior art, in the asynchronous interaction of the present invention, the requesting device determines the time point of each query request in the current response waiting period according to the reference response time and the convergence query frequency, and sends the requested device at the corresponding time point Inquiry request. Due to the convergent arrangement of multiple inquiry request time points during the response waiting period, it makes the waiting time of the requesting device converge quickly, and avoids the idle waiting of the requesting device when the requested device cannot work normally due to failure, overload, etc. At the same time, when there are a large number of requesting devices concurrently requesting data, due to the reduction of query requests, the load of the requested devices is also effectively reduced.
附图说明Description of drawings
通过阅读参照以下附图所作的对非限制性实施例所作的详细描述,本发明的其它特征、目的和优点将会变得更明显:Other characteristics, objects and advantages of the present invention will become more apparent by reading the detailed description of non-limiting embodiments made with reference to the following drawings:
图1示出根据本发明一个实施例的用于异步式交互中请求设备端进行响应询问的方法流程图;FIG. 1 shows a flow chart of a method for requesting a device side to respond to an inquiry in an asynchronous interaction according to an embodiment of the present invention;
图2示出根据本发明另一个实施例的用于异步式交互中在请求设备端进行响应询问的询问装置的示意图。Fig. 2 shows a schematic diagram of an inquiry device for performing an inquiry response at a requesting device side in an asynchronous interaction according to another embodiment of the present invention.
附图中相同或相似的附图标记代表相同或相似的部件。The same or similar reference numerals in the drawings represent the same or similar components.
具体实施方式detailed description
下面结合附图对本发明作进一步详细描述。The present invention will be described in further detail below in conjunction with the accompanying drawings.
本发明旨在提供一种异步式交互中在请求设备端进行响应询问的方法与装置。其中,发送询问请求的请求设备与接收询问请求并提供响应的被请求设备可以是任何在异步式交互中进行通信的对端设备,例如进行异步式加载的用户设备与响应于该用户设备的异步式请求的网络服务器。The present invention aims to provide a method and device for responding to inquiries at the requesting device side in asynchronous interaction. Wherein, the requesting device that sends the query request and the requested device that receives the query request and provides a response may be any peer device that communicates in asynchronous interaction, for example, a user device that performs asynchronous loading and an asynchronous device that responds to the user device request to the web server.
本发明中在异步式交互中进行响应询问的方案可由请求设备或装置于与请求设备中的特定装置来实现。本文中,为便于说明,将该特定装置称为询问装置,其可以是具有硬件结构的硬件模块,也可以是软件功能模块。如无特别说明,本文中,询问装置与请求设备等同使用。The scheme of responding to inquiries in asynchronous interaction in the present invention can be realized by the requesting device or a specific device installed in the requesting device. Herein, for the convenience of description, the specific device is referred to as an inquiry device, which may be a hardware module with a hardware structure, or a software function module. Unless otherwise specified, in this document, the query device and the request device are used equally.
图1为根据本发明一个实施例的方法流程图,其具体示出一种用于在异步式交互中由请求设备进行响应询问的过程。Fig. 1 is a flow chart of a method according to an embodiment of the present invention, which specifically shows a process for a requesting device to respond to an inquiry in an asynchronous interaction.
如图1所示,在步骤S1中,请求设备在向被请求设备发送数据请求后,根据被请求设备所对应的参考响应时间以及当前响应等待期间内询问请求的收敛询问频率,确定在当前响应等待期间内每次询问请求的请求时间点。As shown in Figure 1, in step S1, after the requesting device sends a data request to the requested device, it determines the data request in the current response according to the reference response time corresponding to the requested device and the convergence query frequency of the query request during the current response waiting period. The request time point of each query request during the waiting period.
在此,被请求设备所对应的参考响应时间意指请求设备从被请求设备获得对应于数据请求的数据响应的参考响应时间;每次响应等待期间意指请求设备在每次向被请求设备发送数据请求后所经历的参考响应时间。Here, the reference response time corresponding to the requested device means the reference response time for the requesting device to obtain the data response corresponding to the data request from the requested device; each response waiting period means that the requesting device sends The reference response time elapsed after a data request.
其中,被请求设备所对应的参考响应时间可基于以下至少任一项来确定:Wherein, the reference response time corresponding to the requested device may be determined based on at least any of the following:
1)请求设备所获得的历史响应的响应时间;1) The response time of the historical response obtained by the requesting device;
在此,被请求设备所对应的参考响应时间可基于请求设备所获得的历史响应的响应时间来确定。其中,请求设备所获得的历史响应包括其从当前的被请求设备所获得的历史响应以及从其他被请求设备所获得的历史响应。参考响应时间可基于这些历史响应中的全部或部分历史响应的响应时间来确定。例如,被请求设备所对应的参考响应时间可以是其上次对请求设备进行响应的响应时间,也可以是其他被请求设备上次对请求设备进行响应的响应时间。又如,被请求设备所对应的参考响应时间可以基于一段时间内请求设备所获得的历史响应的响应时间来确定,如最近时间内所获得响应的均值、最大值或最小值等,这些响应可以仅限定为来自当前被请求设备的响应,也可以包括来自其他被请求设备的响应。Here, the reference response time corresponding to the requested device may be determined based on the response time of historical responses obtained by the requesting device. Wherein, the historical responses obtained by the requesting device include historical responses obtained from the current requested device and historical responses obtained from other requested devices. A reference response time may be determined based on the response times of all or some of these historical responses. For example, the reference response time corresponding to the requested device may be the response time when it responded to the requesting device last time, or the response time when other requested devices responded to the requesting device last time. As another example, the reference response time corresponding to the requested device can be determined based on the response time of historical responses obtained by the requesting device within a period of time, such as the average value, maximum value or minimum value of the responses obtained in the latest time, and these responses can be It is limited to responses from the currently requested device, and may also include responses from other requested devices.
2)被请求设备提供的预期响应时间;2) the expected response time provided by the requested device;
在此,被请求设备所对应的参考响应时间可基于被请求设备提供的预期响应时间来确定。例如,被请求设备在接收到请求设备的数据请求后,可根据数据请求的类型、被请求设备当前的负载状况等,向请求设备返回一个预期响应时间,该预期响应时间即可作为被请求设备所对应的参考响应时间;或者,在该预期响应时间的基础上增加或减少一个预定长度的时间,并将增加或减少后的时间作为被请求设备所对应的参考响应时间。Here, the reference response time corresponding to the requested device may be determined based on the expected response time provided by the requested device. For example, after receiving the data request from the requesting device, the requested device can return an expected response time to the requesting device according to the type of data request, the current load status of the requested device, etc., and the expected response time can be used as the The corresponding reference response time; or, add or subtract a predetermined length of time on the basis of the expected response time, and use the increased or decreased time as the reference response time corresponding to the requested device.
3)请求设备所获得历史响应的响应时间与被请求设备提供的预期响应时间的结合。3) The combination of the response time of historical responses obtained by the requesting device and the expected response time provided by the requested device.
在此,被请求设备所对应的参考响应时间可结合请求设备所获得历史响应的响应时间与被请求设备提供的预期响应时间来确定。例如,被请求设备所对应的参考响应时间可选择请求设备所获得历史响应的响应时间与被请求设备提供的预期响应时间两者之中较长或较短的一个时间来进行设定。Here, the reference response time corresponding to the requested device may be determined by combining the response time of historical responses obtained by the requesting device and the expected response time provided by the requested device. For example, the reference response time corresponding to the requested device may be set by selecting a longer or shorter time between the response time of the historical response obtained by the requesting device and the expected response time provided by the requested device.
优选地,当请求设备所获得历史响应的响应时间大于被请求设备提供的预期响应时间时,被请求设备所对应的参考响应时间为两者的差值并自该预期响应时间期满时起算。例如,在请求设备向被请求设备发送数据请求之后,请求设备等待一个预期响应时间,并在该预期响应时间期满后,按照收敛询问频率向被请求设备发送询问请求,直至参考响应时间期满。Preferably, when the response time of the historical response obtained by the requesting device is greater than the expected response time provided by the requested device, the reference response time corresponding to the requested device is the difference between the two and is calculated from the expiration of the expected response time. For example, after the requesting device sends a data request to the requested device, the requesting device waits for an expected response time, and after the expected response time expires, sends an inquiry request to the requested device according to the convergence inquiry frequency until the reference response time expires .
在此,收敛询问频率意指在每个响应等待期间内请求设备向被请求设备发送的询问请求的询问频率呈收敛排列,也即越趋近于响应等待期间期满时,询问请求的询问频率越高。Here, the converging query frequency means that the query frequency of the query requests sent by the requesting device to the requested device in each response waiting period is arranged in a convergent order, that is, the closer to the expiration of the response waiting period, the query frequency of the query requests higher.
优选地,收敛询问频率可根据每个响应等待期间内剩余时间比例的N分法来确定。在此,N可根据参考响应时间的长度、被请求设备的当前负载状况等来确定。Preferably, the frequency of the convergence inquiry can be determined according to the N-division method of the remaining time ratio in each response waiting period. Here, N may be determined according to the length of the reference response time, the current load status of the requested device, and the like.
例如,收敛询问频率可采用2分法来确定,请求设备在参考响应时间的1/2、3/4、7/8…对应的时间点向被请求设备发送询问请求,从而在当前响应等待期间开始时,询问请求的询问频率较低,当越接近参考响应时间,逐步提高询问请求的询问频率,以避免被请求设备工作不正常而请求设备空等待的情形,同时可使响应等待时间迅速收敛。For example, the convergence query frequency can be determined by the 2-point method. The requesting device sends a query request to the requested device at the time points corresponding to 1/2, 3/4, 7/8... of the reference response time, so that during the current response waiting period At the beginning, the inquiry frequency of the inquiry request is low, and when it is closer to the reference response time, gradually increase the inquiry frequency of the inquiry request, so as to avoid the situation that the requested equipment is not working properly and the requesting equipment is idle, and at the same time, the response waiting time can be quickly converged .
本领域技术人员应能理解,尽管以上以2分法进行举例,然而该示例并不应被理解为对本发明的任何限制,而仅用于说明本发明之目的。因此,其他的N值同样可适用于本发明,从而属于本发明的专利保护范围之内。Those skilled in the art should be able to understand that although the two-point method is used as an example above, this example should not be construed as any limitation to the present invention, but only for the purpose of illustrating the present invention. Therefore, other N values are also applicable to the present invention, and thus fall within the patent protection scope of the present invention.
进一步地,在响应等待期间,请求设备向被请求设备所发送的询问请求可以是纯粹的询问请求,仅用于获取被请求设备的处理状态,或者,该询问请求也可以与原数据请求相同,仅需在其中加入可使被请求设备将其区别于原数据请求的标识信息,如加入询问标识位“1”或加入请求序号2、3、4等,以区别于原数据请求无询问标识位或询问标识位为“0”,或者原数据请求的请求序号为1。据此,被请求设备在接收到请求设备的原数据请求后,后续再从该请求设备接收数据请求,即可从后续接收的数据请求的询问标识位或请求序号来判断其是用于让被请求设备响应并开始任务的数据请求,还是获取被请求设备处理状态的询问请求,在确定请求的目的后,被请求设备给出相应的反馈,如数据请求的任务是否开始或是否处理完成,或告知请求设备仍处于处理状态。Further, during the response waiting period, the query request sent by the requesting device to the requested device may be a pure query request, which is only used to obtain the processing status of the requested device, or the query request may also be the same as the original data request, It is only necessary to add identification information that enables the requested device to distinguish it from the original data request, such as adding an inquiry identification bit "1" or adding request sequence numbers 2, 3, 4, etc., to distinguish it from the original data request without an inquiry identification bit Or the query identification bit is "0", or the request sequence number of the original data request is 1. Accordingly, after the requested device receives the original data request from the requesting device, and subsequently receives the data request from the requesting device, it can judge from the query identification bit or request sequence number of the subsequently received data request that it is used to allow the requested device A data request that requests the device to respond and start the task, or an inquiry request to obtain the processing status of the requested device. After determining the purpose of the request, the requested device gives corresponding feedback, such as whether the task of the data request is started or whether the processing is completed, or Informs the requesting device that it is still processing.
在步骤S2中,请求设备在每个请求时间点,向被请求设备发送询问请求,直至满足预定的停止条件。其中,预定的停止条件包括以下任一项:In step S2, the requesting device sends an inquiry request to the requested device at each request time point until a predetermined stop condition is met. Among them, the predetermined stopping conditions include any of the following:
1)参考响应时间期满。当参考响应时间期满时,请求设备不再按照收敛询问频率向被请求设备发送询问请求。优选地,当参考响应时间期满但请求设备仍未获得被请求设备的响应,请求设备按照固定询问频率向被请求设备发送询问请求,如每5秒发送一次询问请求。1) The reference response time has expired. When the reference response time expires, the requesting device no longer sends an inquiry request to the requested device according to the convergence inquiry frequency. Preferably, when the reference response time expires but the requesting device has not yet obtained a response from the requested device, the requesting device sends an inquiry request to the requested device at a fixed inquiry frequency, such as sending an inquiry request every 5 seconds.
2)获得被请求设备的响应。当获得被请求设备的响应时,数据请求的目的已实现,故请求设备无需再行询问被请求设备的处理状态。2) Get the response from the requested device. When the response from the requested device is obtained, the purpose of the data request has been achieved, so the requesting device does not need to inquire about the processing status of the requested device.
优选地,在步骤S2中,在每个请求时间点,请求设备不仅向被请求设备发送询问请求,还向请求设备用户提供当前响应等待期间的剩余等待时间。其中,剩余等待时间为参考响应时间与已经过的等待时间的差值。Preferably, in step S2, at each request time point, the requesting device not only sends an inquiry request to the requested device, but also provides the user of the requesting device with the remaining waiting time during the current response waiting period. Wherein, the remaining waiting time is the difference between the reference response time and the elapsed waiting time.
图2为根据本发明另一个实施例的装置示意图,其具体示出一种用于异步式交互中在请求设备端进行响应询问的询问装置。如图2所示,询问装置1包括请求时间确定装置11和询问请求发送装置12。Fig. 2 is a schematic diagram of an apparatus according to another embodiment of the present invention, which specifically shows an inquiry apparatus for responding to an inquiry at the requesting device side in an asynchronous interaction. As shown in FIG. 2 , the inquiry device 1 includes a request time determining device 11 and an inquiry request sending device 12 .
具体地,请求时间确定装置11在请求设备向被请求设备发送数据请求后,根据被请求设备所对应的参考响应时间以及当前响应等待期间内询问请求的收敛询问频率,确定在当前响应等待期间内每次询问请求的请求时间点。Specifically, after the requesting device sends a data request to the requested device, the request time determining means 11 determines that within the current response waiting period The request time point for each query request.
在此,被请求设备所对应的参考响应时间意指请求设备从被请求设备获得对应于数据请求的数据响应的参考响应时间;每次响应等待期间意指请求设备在每次向被请求设备发送数据请求后所经历的参考响应时间。Here, the reference response time corresponding to the requested device means the reference response time for the requesting device to obtain the data response corresponding to the data request from the requested device; each response waiting period means that the requesting device sends The reference response time elapsed after a data request.
其中,被请求设备所对应的参考响应时间可基于以下至少任一项来确定:Wherein, the reference response time corresponding to the requested device may be determined based on at least any of the following:
1)请求设备所获得的历史响应的响应时间;1) The response time of the historical response obtained by the requesting device;
在此,被请求设备所对应的参考响应时间可基于请求设备所获得的历史响应的响应时间来确定。其中,请求设备所获得的历史响应包括其从当前的被请求设备所获得的历史响应以及从其他被请求设备所获得的历史响应。参考响应时间可基于这些历史响应中的全部或部分历史响应的响应时间来确定。例如,被请求设备所对应的参考响应时间可以是其上次对请求设备进行响应的响应时间,也可以是其他被请求设备上次对请求设备进行响应的响应时间。又如,被请求设备所对应的参考响应时间可以基于一段时间内请求设备所获得的历史响应的响应时间来确定,如最近时间内所获得响应的均值、最大值或最小值等,这些响应可以仅限定为来自当前被请求设备的响应,也可以包括来自其他被请求设备的响应。Here, the reference response time corresponding to the requested device may be determined based on the response time of historical responses obtained by the requesting device. Wherein, the historical responses obtained by the requesting device include historical responses obtained from the current requested device and historical responses obtained from other requested devices. A reference response time may be determined based on the response times of all or some of these historical responses. For example, the reference response time corresponding to the requested device may be the response time when it responded to the requesting device last time, or the response time when other requested devices responded to the requesting device last time. As another example, the reference response time corresponding to the requested device can be determined based on the response time of historical responses obtained by the requesting device within a period of time, such as the average value, maximum value or minimum value of the responses obtained in the latest time, and these responses can be It is limited to responses from the currently requested device, and may also include responses from other requested devices.
2)被请求设备提供的预期响应时间;2) the expected response time provided by the requested device;
在此,被请求设备所对应的参考响应时间可基于被请求设备提供的预期响应时间来确定。例如,被请求设备在接收到请求设备的数据请求后,可根据数据请求的类型、被请求设备当前的负载状况等,向请求设备返回一个预期响应时间,该预期响应时间即可作为被请求设备所对应的参考响应时间;或者,在该预期响应时间的基础上增加或减少一个预定长度的时间,并将增加或减少后的时间作为被请求设备所对应的参考响应时间。Here, the reference response time corresponding to the requested device may be determined based on the expected response time provided by the requested device. For example, after receiving the data request from the requesting device, the requested device can return an expected response time to the requesting device according to the type of data request, the current load status of the requested device, etc., and the expected response time can be used as the The corresponding reference response time; or, add or subtract a predetermined length of time on the basis of the expected response time, and use the increased or decreased time as the reference response time corresponding to the requested device.
3)请求设备所获得历史响应的响应时间与被请求设备提供的预期响应时间的结合。3) The combination of the response time of historical responses obtained by the requesting device and the expected response time provided by the requested device.
在此,被请求设备所对应的参考响应时间可结合请求设备所获得历史响应的响应时间与被请求设备提供的预期响应时间来确定。例如,被请求设备所对应的参考响应时间可选择请求设备所获得历史响应的响应时间与被请求设备提供的预期响应时间两者之中较长或较短的一个时间来进行设定。Here, the reference response time corresponding to the requested device may be determined by combining the response time of historical responses obtained by the requesting device and the expected response time provided by the requested device. For example, the reference response time corresponding to the requested device may be set by selecting a longer or shorter time between the response time of the historical response obtained by the requesting device and the expected response time provided by the requested device.
优选地,当请求设备所获得历史响应的响应时间大于被请求设备提供的预期响应时间时,被请求设备所对应的参考响应时间为两者的差值并自该预期响应时间期满时起算。例如,在请求设备向被请求设备发送数据请求之后,请求设备等待一个预期响应时间,并在该预期响应时间期满后,按照收敛询问频率向被请求设备发送询问请求,直至参考响应时间期满。Preferably, when the response time of the historical response obtained by the requesting device is greater than the expected response time provided by the requested device, the reference response time corresponding to the requested device is the difference between the two and is calculated from the expiration of the expected response time. For example, after the requesting device sends a data request to the requested device, the requesting device waits for an expected response time, and after the expected response time expires, sends an inquiry request to the requested device according to the convergence inquiry frequency until the reference response time expires .
在此,收敛询问频率意指在每个响应等待期间内请求设备向被请求设备发送的询问请求的询问频率呈收敛排列,也即越趋近于响应等待期间期满时,询问请求的询问频率越高。Here, the converging query frequency means that the query frequency of the query requests sent by the requesting device to the requested device in each response waiting period is arranged in a convergent order, that is, the closer to the expiration of the response waiting period, the query frequency of the query requests higher.
优选地,收敛询问频率可根据每个响应等待期间内剩余时间比例的N分法来确定。在此,N可根据参考响应时间的长度、被请求设备的当前负载状况等来确定。Preferably, the frequency of the convergence inquiry can be determined according to the N-division method of the remaining time ratio in each response waiting period. Here, N may be determined according to the length of the reference response time, the current load status of the requested device, and the like.
例如,收敛询问频率可采用2分法来确定,请求设备在参考响应时间的1/2、3/4、7/8…对应的时间点向被请求设备发送询问请求,从而在当前响应等待期间开始时,询问请求的询问频率较低,当越接近参考响应时间,逐步提高询问请求的询问频率,以避免被请求设备工作不正常而请求设备空等待的情形,同时可使响应等待时间迅速收敛。For example, the convergence query frequency can be determined by the 2-point method. The requesting device sends a query request to the requested device at the time points corresponding to 1/2, 3/4, 7/8... of the reference response time, so that during the current response waiting period At the beginning, the inquiry frequency of the inquiry request is low, and when it is closer to the reference response time, gradually increase the inquiry frequency of the inquiry request, so as to avoid the situation that the requested equipment is not working properly and the requesting equipment is idle, and at the same time, the response waiting time can be quickly converged .
本领域技术人员应能理解,尽管以上以2分法进行举例,然而该示例并不应被理解为对本发明的任何限制,而仅用于说明本发明之目的。因此,其他的N值同样可适用于本发明,从而属于本发明的专利保护范围之内。Those skilled in the art should be able to understand that although the two-point method is used as an example above, this example should not be construed as any limitation to the present invention, but only for the purpose of illustrating the present invention. Therefore, other N values are also applicable to the present invention, and thus fall within the patent protection scope of the present invention.
进一步地,在响应等待期间,请求设备向被请求设备所发送的询问请求可以是纯粹的询问请求,仅用于获取被请求设备的处理状态,或者,该询问请求也可以与原数据请求相同,仅需在其中加入可使被请求设备将其区别于原数据请求的标识信息,如加入询问标识位“1”或加入请求序号2、3、4等,以区别于原数据请求无询问标识位或询问标识位为“0”,或者原数据请求的请求序号为1。据此,被请求设备在接收到请求设备的原数据请求后,后续再从该请求设备接收数据请求,即可从后续接收的数据请求的询问标识位或请求序号来判断其是用于让被请求设备响应并开始任务的数据请求,还是获取被请求设备处理状态的询问请求,在确定请求的目的后,被请求设备给出相应的反馈,如数据请求的任务是否开始或是否处理完成,或告知请求设备仍处于处理状态。Further, during the response waiting period, the query request sent by the requesting device to the requested device may be a pure query request, which is only used to obtain the processing status of the requested device, or the query request may also be the same as the original data request, It is only necessary to add identification information that enables the requested device to distinguish it from the original data request, such as adding an inquiry identification bit "1" or adding request sequence numbers 2, 3, 4, etc., to distinguish it from the original data request without an inquiry identification bit Or the query identification bit is "0", or the request sequence number of the original data request is 1. Accordingly, after the requested device receives the original data request from the requesting device, and subsequently receives the data request from the requesting device, it can judge from the query identification bit or request sequence number of the subsequently received data request that it is used to allow the requested device A data request that requests the device to respond and start the task, or an inquiry request to obtain the processing status of the requested device. After determining the purpose of the request, the requested device gives corresponding feedback, such as whether the task of the data request is started or whether the processing is completed, or Informs the requesting device that it is still processing.
询问请求发送装置12在每个请求时间点,向被请求设备发送询问请求,直至满足预定的停止条件。其中,预定的停止条件包括以下任一项:The inquiry request sending unit 12 sends an inquiry request to the requested device at each request time point until a predetermined stop condition is satisfied. Among them, the predetermined stopping conditions include any of the following:
1)参考响应时间期满。当参考响应时间期满时,询问请求发送装置12不再按照收敛询问频率向被请求设备发送询问请求。优选地,询问装置1还可包括周期询问发送装置(未示出),当参考响应时间期满但请求设备仍未获得被请求设备的响应,周期询问发送装置按照固定询问频率向被请求设备发送询问请求,如每5秒发送一次询问请求。1) The reference response time has expired. When the reference response time expires, the inquiry request sending unit 12 no longer sends an inquiry request to the requested device according to the convergent inquiry frequency. Preferably, the query device 1 may also include a periodic query sending device (not shown). When the reference response time expires but the requesting device has not yet obtained a response from the requested device, the periodic query sending device sends a periodic query to the requested device according to a fixed query frequency. Inquiry request, such as sending an inquiry request every 5 seconds.
2)获得被请求设备的响应。当获得被请求设备的响应时,数据请求的目的已实现,故请求设备无需再行询问被请求设备的处理状态。2) Get the response from the requested device. When the response from the requested device is obtained, the purpose of the data request has been achieved, so the requesting device does not need to inquire about the processing status of the requested device.
优选地,在每个请求时间点,询问请求发送装置12不仅向被请求设备发送询问请求,还向用户提供当前响应等待期间的剩余等待时间。其中,剩余等待时间为参考响应时间与已经过的等待时间的差值。Preferably, at each request time point, the query request sending means 12 not only sends the query request to the requested device, but also provides the user with the remaining waiting time during the current response waiting period. Wherein, the remaining waiting time is the difference between the reference response time and the elapsed waiting time.
需要注意的是,本发明可在软件和/或软件与硬件的组合体中被实施,例如,可采用专用集成电路(ASIC)、通用目的计算机或任何其他类似硬件设备来实现。It should be noted that the present invention can be implemented in software and/or a combination of software and hardware, for example, it can be implemented by an application specific integrated circuit (ASIC), a general purpose computer or any other similar hardware devices.
本发明的软件程序可以通过处理器执行以实现上文所述步骤或功能。同样地,本发明的软件程序(包括相关的数据结构)可以被存储到计算机可读记录介质中,例如,RAM存储器,磁或光驱动器或软磁盘及类似设备。另外,本发明的一些步骤或功能可采用硬件来实现,例如,作为与处理器配合从而执行各个功能或步骤的电路。The software program of the present invention can be executed by a processor to realize the steps or functions described above. Likewise, the software program of the present invention (including associated data structures) can be stored in a computer-readable recording medium such as RAM memory, magnetic or optical drive or floppy disk and the like. In addition, some steps or functions of the present invention may be implemented by hardware, for example, as a circuit that cooperates with a processor to execute each function or step.
另外,本发明的一部分可被应用为计算机程序产品,例如计算机程序指令,当其被计算机执行时,通过该计算机的操作,可以调用或提供根据本发明的方法和/或技术方案。而调用本发明的方法的程序指令,可能被存储在固定的或可移动的记录介质中,和/或通过广播或其他信号承载媒体中的数据流而被传输,和/或被存储在根据所述程序指令运行的计算机设备的工作存储器中。在此,根据本发明的一个实施例,其包括一个装置,该装置包括用于存储计算机程序指令的存储器和用于执行程序指令的处理器,其中,当该计算机程序指令被该处理器执行时,触发该装置运行基于前述根据本发明的多个实施例的方法和/或技术方案。In addition, a part of the present invention can be applied as a computer program product, such as a computer program instruction. When it is executed by a computer, the method and/or technical solution according to the present invention can be invoked or provided through the operation of the computer. The program instructions for invoking the method of the present invention may be stored in a fixed or removable recording medium, and/or transmitted through broadcasting or data streams in other signal-carrying media, and/or stored in the in the working memory of the computer device on which the program instructions described above are executed. Here, according to one embodiment of the present invention, it comprises an apparatus comprising a memory for storing computer program instructions and a processor for executing the program instructions, wherein when the computer program instructions are executed by the processor , triggering the device to run the methods and/or technical solutions based on the aforementioned multiple embodiments of the present invention.
对于本领域技术人员而言,显然本发明不限于上述示范性实施例的细节,而且在不背离本发明的精神或基本特征的情况下,能够以其他的具体形式实现本发明。因此,无论从哪一点来看,均应将实施例看作是示范性的,而且是非限制性的,本发明的范围由所附权利要求而不是上述说明限定,因此旨在将落在权利要求的等同要件的含义和范围内的所有变化涵括在本发明内。不应将权利要求中的任何附图标记视为限制所涉及的权利要求。此外,显然“包括”一词不排除其他单元或步骤,单数不排除复数。系统权利要求中陈述的多个单元或装置也可以由一个单元或装置通过软件或者硬件来实现。第一,第二等词语用来表示名称,而并不表示任何特定的顺序。It will be apparent to those skilled in the art that the invention is not limited to the details of the above-described exemplary embodiments, but that the invention can be embodied in other specific forms without departing from the spirit or essential characteristics of the invention. Accordingly, the embodiments should be regarded in all points of view as exemplary and not restrictive, the scope of the invention being defined by the appended claims rather than the foregoing description, and it is therefore intended that the scope of the invention be defined by the appended claims rather than by the foregoing description. All changes within the meaning and range of equivalents of the elements are embraced in the present invention. Any reference sign in a claim should not be construed as limiting the claim concerned. In addition, it is obvious that the word "comprising" does not exclude other elements or steps, and the singular does not exclude the plural. A plurality of units or devices stated in the system claims may also be realized by one unit or device through software or hardware. The words first, second, etc. are used to denote names and do not imply any particular order.
Claims (14)
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201310305486.5A CN103428273B (en) | 2013-07-18 | 2013-07-18 | The method and apparatus of response inquiry is carried out in asynchronous system is mutual |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201310305486.5A CN103428273B (en) | 2013-07-18 | 2013-07-18 | The method and apparatus of response inquiry is carried out in asynchronous system is mutual |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| CN103428273A CN103428273A (en) | 2013-12-04 |
| CN103428273B true CN103428273B (en) | 2016-12-28 |
Family
ID=49652437
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN201310305486.5A Active CN103428273B (en) | 2013-07-18 | 2013-07-18 | The method and apparatus of response inquiry is carried out in asynchronous system is mutual |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN103428273B (en) |
Families Citing this family (3)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN106936867B (en) * | 2015-12-29 | 2020-07-24 | 阿里巴巴集团控股有限公司 | Service request response method and device |
| CN106790634B (en) * | 2017-01-04 | 2019-10-11 | 北京百度网讯科技有限公司 | A method and device for determining whether to initiate a backup request |
| CN110324427A (en) * | 2019-07-09 | 2019-10-11 | 晏保华 | A kind of asynchronous data transaction system, method and device |
Citations (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US6832243B1 (en) * | 2000-08-15 | 2004-12-14 | International Business Machines Corporation | Methods and apparatus for defining, observing and evaluating message delivery outcome on a per-message basis |
| EP2157723A2 (en) * | 2008-08-21 | 2010-02-24 | Fujitsu Limited | Data retransmission method and system |
| CN102685204A (en) * | 2011-03-17 | 2012-09-19 | 华为技术有限公司 | Method and device for data resource transmission |
| CN103067396A (en) * | 2012-12-29 | 2013-04-24 | 深圳先进技术研究院 | Three-dimensional (3d) geographic information system (GIS) asynchronous communication transmission system and method of asynchronous communication transmission |
-
2013
- 2013-07-18 CN CN201310305486.5A patent/CN103428273B/en active Active
Patent Citations (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US6832243B1 (en) * | 2000-08-15 | 2004-12-14 | International Business Machines Corporation | Methods and apparatus for defining, observing and evaluating message delivery outcome on a per-message basis |
| EP2157723A2 (en) * | 2008-08-21 | 2010-02-24 | Fujitsu Limited | Data retransmission method and system |
| CN102685204A (en) * | 2011-03-17 | 2012-09-19 | 华为技术有限公司 | Method and device for data resource transmission |
| CN103067396A (en) * | 2012-12-29 | 2013-04-24 | 深圳先进技术研究院 | Three-dimensional (3d) geographic information system (GIS) asynchronous communication transmission system and method of asynchronous communication transmission |
Also Published As
| Publication number | Publication date |
|---|---|
| CN103428273A (en) | 2013-12-04 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| US9043382B2 (en) | Stream processing using a client-server architecture | |
| CN102143075B (en) | Method and system for achieving load balance | |
| CN108681777B (en) | A method and apparatus for running a machine learning program based on a distributed system | |
| EP3489825A1 (en) | Method, apparatus and computer readable storage medium for processing service | |
| JP2018532172A (en) | Method and system for resource scheduling | |
| CN102123179A (en) | Load balancing method and system applied to distributed application system | |
| CN105069163B (en) | Network request treating method and apparatus | |
| CN108781226A (en) | Communication Systems | |
| CN111831503B (en) | Monitoring method based on monitoring agent and monitoring agent device | |
| CN103428273B (en) | The method and apparatus of response inquiry is carried out in asynchronous system is mutual | |
| JP2008538428A5 (en) | ||
| US20220326990A1 (en) | Providing optimization in a micro services architecture | |
| CN113821495B (en) | Database cluster implementation system and method | |
| CN112114938A (en) | Transaction processing method, device and server | |
| JP5329589B2 (en) | Transaction processing system and operation method of transaction processing system | |
| CN104509071A (en) | process request | |
| CN111400051B (en) | Resource scheduling method, device and system | |
| CN111782364B (en) | Service calling method, device, electronic equipment and storage medium | |
| CN110381143B (en) | Job submission and execution methods, devices, equipment and computer storage media | |
| JP4330910B2 (en) | Server system response monitoring method and apparatus | |
| CN111913815A (en) | Call request processing method and device, electronic equipment and readable storage medium | |
| WO2019201111A1 (en) | Information processing method, apparatus and device, and computer-readable storage medium | |
| JP2008210110A (en) | Business system and its execution request management method | |
| CN109347940B (en) | Processing cross-domain service request and method and device for requesting cross-domain service | |
| CN115129962A (en) | Object query and response method, system and storage medium |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| C06 | Publication | ||
| PB01 | Publication | ||
| C10 | Entry into substantive examination | ||
| SE01 | Entry into force of request for substantive examination | ||
| C14 | Grant of patent or utility model | ||
| GR01 | Patent grant |