Multi-client request response method and electronic device

By selecting the response policy based on the communication technology type of the access device on the server side, the problem of difficulty in response when multiple client requests is solved, and the client's user experience is improved.

CN119299521BActive Publication Date: 2025-04-11ROYPOW TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411585745.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-11-08
Publication Date
2025-04-11
Estimated Expiration
2044-11-08

AI Technical Summary

Technical Problem

When multiple clients request the same device through the server, the server cannot respond to requests from multiple clients at the same time, resulting in poor client usage experience.

Method used

According to the communication technology type of the access device, the server side uses a rejection policy, a waiting policy or a reply cache policy to respond, corresponding to the communication rate from slow to fast.

Benefits of technology

By adapting to changes in the type of access device, we can respond to the client in a timely manner and improve the client's user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119299521B_ABST
    Figure CN119299521B_ABST
Patent Text Reader

Abstract

The present application provides a multi-client request response method and an electronic device. The method is executed by a server, and the method includes: receiving a first request sent by multiple clients, the first request is used to request data of a first device, and the first device is an access device of the server; responding to multiple clients based on a first strategy, the first strategy is determined based on the type of communication technology used by the first device, the first strategy includes a rejection strategy, a waiting strategy, and a reply cache strategy, and the communication rates of the communication technology types corresponding to the rejection strategy, the waiting strategy, and the reply cache strategy are from slow to fast.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of communication technology, and in particular to a multi-client request response method and an electronic device. Background Art

[0002] Normally, when a client requests a device connected to the server through a server, the server will respond immediately. However, when multiple clients request the same device through a server, the server cannot respond to requests from multiple clients at the same time. The general processing method is to wait for or reject other requests or reply with cached data after responding to the first request. However, as the number of devices connected to the server increases, this processing method can no longer meet the requirements, thus affecting the client's experience. Summary of the invention

[0003] Embodiments of the present application provide a multi-client request response method and an electronic device.

[0004] In a first aspect, an embodiment of the present application provides a multi-client request response method, which is executed by a server, and includes:

[0005] Receiving first requests sent by multiple clients, where the first requests are used to request data of a first device, where the first device is an access device on the server side;

[0006] Responding to multiple clients based on a first strategy, the first strategy is determined based on the type of communication technology used by the first device, the first strategy includes a rejection strategy, a waiting strategy, and a reply cache strategy, and the communication rates of the communication technology types corresponding to the rejection strategy, the waiting strategy, and the reply cache strategy are from slow to fast;

[0007] The rejection strategy is used to instruct the server to respond to the first first request received and return the request result, and reject other first requests;

[0008] The waiting strategy is used to instruct the server to put the first requests of multiple clients into the first blocking queue, and respond to the multiple clients in sequence according to the order in the first blocking queue and return the request results;

[0009] The reply cache strategy is used to instruct the server to respond to the first first request received and return the request result, and put the request result into the cache to respond to other first requests. The first device corresponding to the reply cache strategy has data cache capability.

[0010] Optionally, the communication rate is determined based on a transmission protocol adopted by the communication technology type.

[0011] Optionally, the first policy is determined by a policy distributor on the server side.

[0012] Optionally, before responding to the multiple clients based on the first policy, the method further includes:

[0013] Check whether the first device is online;

[0014] If the first device is offline, an offline result is returned to the multiple clients.

[0015] In a second aspect, an embodiment of the present application provides a server-side device, including:

[0016] A receiving module, used for receiving first requests sent by multiple clients, where the first requests are used for requesting data of a first device, where the first device is an access device on the server side;

[0017] A response module, configured to respond to multiple clients based on a first strategy, the first strategy being determined based on a type of communication technology adopted by the first device, the first strategy including a rejection strategy, a waiting strategy, and a reply cache strategy, and the communication rates of the communication technology types corresponding to the rejection strategy, the waiting strategy, and the reply cache strategy are in descending order;

[0018] The rejection strategy is used to instruct the server to respond to the first first request received and return the request result, and reject other first requests;

[0019] The waiting strategy is used to instruct the server to put the first requests of multiple clients into the first blocking queue, and respond to the multiple clients in sequence according to the order in the first blocking queue and return the request results;

[0020] The reply cache strategy is used to instruct the server to respond to the first first request received and return the request result, and put the request result into the cache to respond to other first requests. The first device corresponding to the reply cache strategy has data cache capability.

[0021] Optionally, the communication rate is determined based on a transmission protocol adopted by the communication technology type.

[0022] Optionally, the device further includes a policy distributor, and the policy distributor is used to determine the first policy.

[0023] Optionally, the device further includes:

[0024] A checking module, configured to check whether the first device is online before the responding module responds to the plurality of clients based on the first policy;

[0025] The response module is also used to return an offline result to the multiple clients when the checking module determines that the first device is offline.

[0026] In a third aspect, an embodiment of the present application provides an electronic device comprising a memory, at least one processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, a method as described in any one of the above-mentioned first aspects is implemented.

[0027] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method as described in any one of the above-mentioned first aspects is implemented.

[0028] In a fifth aspect, an embodiment of the present application provides a computer program product. When the computer program product is run on an electronic device, the electronic device executes any one of the methods described in the first aspect.

[0029] Based on the present application, the communication rate of the communication technology type of the access device requested by multiple clients can be responded to in sequence from slow to fast using rejection strategy, waiting strategy and reply cache strategy, which helps to adapt to the changes in the type of access device and respond to the client in a timely manner, thereby improving the client's user experience. BRIEF DESCRIPTION OF THE DRAWINGS

[0030] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for describing the embodiments are briefly introduced below.

[0031] Figure 1 It is a flowchart of the multi-client request response method provided in an embodiment of the present application.

[0032] Figure 2 This is an example diagram of the multi-client request response method provided in an embodiment of the present application.

[0033] Figure 3 This is an example diagram of a multi-client request response strategy provided in an embodiment of the present application.

[0034] Figure 4 It is a structural diagram of the server-side device provided in an embodiment of the present application.

[0035] Figure 5 It is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0036] The technical solution of the embodiment of the present invention will be described below in conjunction with the accompanying drawings in the embodiment of the present invention.

[0037] The client device can request the server's access device through the server. The server will send instructions to the access device to obtain data according to the client's request. When the access device responds to the server's instructions and provides data, the server can respond to the client and return the requested data. Usually, when the server sends instructions to the client to obtain data, it can be verified by the verification method agreed upon in the protocol. For example, it can be verified through protocol data. When the server receives the data returned by the access device, it can verify the protocol data. If the data verification is wrong, the data is discarded and an error prompt is returned to the client. If the verification is correct, the data result is returned to the client. Usually, the client requests the server's access device through the server, and the server responds immediately.

[0038] However, when multiple clients request the same device through the server, the server cannot respond to the requests of multiple clients at the same time. The general processing method is to wait for or reject other requests or reply with cached data after responding to the first request. However, this processing method can only meet a single functional scenario and is not competent for device display functions and coherent operation instructions in various situations. However, as the number of devices connected to the server increases, this processing method can no longer meet the requirements. For example, when the server is connected to multiple different types of devices at the same time, a single response method is prone to problems such as the client not being able to display real-time data, resulting in a very poor client experience.

[0039] Based on this, Figure 1 The embodiment of the present application provides a multi-client request response method. The method can be executed by a server, such as a server of a photovoltaic inverter.

[0040] like Figure 1 As shown, the method may include steps S110 - S120 .

[0041] In step S110, the server receives a first request sent by multiple clients, where the first request can be used to request data of a first device, which is an access device of the server. As an example, the client device can be a photovoltaic inverter, the server can be a server of the photovoltaic inverter, and the first device can be a bidirectional converter, etc.

[0042] In step S120, the server responds to multiple clients based on the first strategy. The first strategy can be determined based on the type of communication technology adopted by the first device. The first strategy may include a rejection strategy, a waiting strategy, and a reply cache strategy. The communication rates of the communication technology types corresponding to the rejection strategy, the waiting strategy, and the reply cache strategy are from slow to fast.

[0043] Among them, the rejection strategy can be used to instruct the server to respond to the first first request received and return the request result, and reject other first requests. For the first device using a communication technology type with a slow communication rate, it takes a long time to transmit data, and may not be able to process many instructions in a short time. Therefore, the rejection strategy can be selected to respond only to the client that issued the first request, and reject the remaining clients, so as to respond quickly.

[0044] The waiting strategy can be used to instruct the server to put the first requests of multiple clients into the first blocking queue, and respond to the multiple clients in sequence according to the order in the first blocking queue and return the request results. For the first device using a communication technology type with a relatively slow communication rate, the time it takes to transmit data is not long. It is capable of processing more instructions but still requires more time. Therefore, the waiting strategy can be selected to process the requests one by one to respond to multiple clients.

[0045] The reply cache strategy can be used to instruct the server to respond to the first first request received and return the request result, and put the request result into the cache to respond to other first requests. The first device corresponding to the reply cache strategy has data cache capability. For the first device using a communication technology type with a faster communication rate, the time consumed for transmitting data is shorter, and the results can be returned quickly in response to the instructions issued by the server. Combined with the data cache capability, the first device can store real-time data in the cache and send it to the server in batches. Therefore, the server can adopt a reply cache strategy to respond to the first first request and obtain data from the first device, and then return the request result to the client that issued the first first request, and store the request result in the cache to respond to the remaining clients separately.

[0046] Optionally, the communication rate of the communication technology type can be determined based on the transmission protocol adopted by the communication technology type. For example, the transmission protocol of the 485 communication protocol is slow, and the packaging time of the data is long. Therefore, if the first device is an access device using the 485 communication protocol, the server can choose a rejection strategy. For another example, the message queuing telemetry transport (MQTT) protocol is a lightweight, publish-subscribe-based message transmission protocol suitable for resource-constrained devices and low-bandwidth, high-latency or unstable network environments. It is popular in IoT applications and can achieve efficient communication between sensors, actuators and other devices. The transmission speed of the MQTT protocol is not slow, and the packaging time of the data is not long. Therefore, if the first device is an access device using the MQTT protocol, the server can choose a waiting strategy. For another example, the Modbus transmission control protocol (TCP) is a Modbus protocol version based on Ethernet, which uses the transmission control protocol TCP / internet protocol (IP) for communication. Unlike the traditional Modbus remote terminal unit (RTU) protocol, Modbus TCP allows devices to be directly interconnected via Ethernet without any dedicated hardware or communication interface. Therefore, Modbus TCP has a higher communication rate and a wider range of applications. Therefore, if the first device is an access device using the ModbusTCP protocol and the first device has data caching capabilities, the server can select a reply caching strategy. Based on the transport protocol, it helps to quickly determine the strategy for responding to multiple clients.

[0047] Optionally, the first policy may be determined by a policy distributor on the server side. For example, the server may have a built-in policy distributor to determine the response policies of multiple clients according to the type of the first device. The implementation of the policy distributor is not specifically limited and can be determined according to actual conditions.

[0048] Optionally, before responding to the plurality of clients based on the first policy, Figure 1 The method shown may also include: checking whether the first device is online; if the first device is not online, returning an offline result to the multiple clients. As an example, the offline result may be empty. Based on this, it can be avoided that the server sends meaningless instructions to the first device when it is not online.

[0049] Based on the present application, the communication rate of the communication technology type of the access device requested by multiple clients can be responded to in sequence from slow to fast using rejection strategy, waiting strategy and reply cache strategy, which helps to adapt to the changes in the type of access device and respond to the client in a timely manner, thereby improving the client's user experience.

[0050] Combine the following Figure 2 and Figure 3 , an example is given to introduce the multi-client request response method of an embodiment of the present application.

[0051] like Figure 2 As shown in the figure, clients 1 / 2 / 3 send requests for access devices to the server at the same time, where request 1 from client 1 is the first request received by the server. The server will check whether the access device targeted by the request is online. If it is not online, it will directly return an offline result. If the access device is online, the requests of multiple clients will enter the policy distributor. The policy distributor will select different response strategies according to the communication technology type of the access device, namely, rejection strategy, reply cache strategy and waiting strategy.

[0052] Rejection strategy: Respond to the first request and send instructions to the access device to obtain data, return the data result to the client of the first request (that is, client 1), and reject other requests.

[0053] Reply cache: respond to the first request received and send instructions to the access device to obtain data, return data to the client of the first request. Put the data into the cache and return the data in the cache to other clients that issued the request.

[0054] Waiting strategy: Store the received requests and put them into the instruction queue, and execute the blocking queue instructions. When a request is detected to be executed, respond to the request and issue instructions to the access device to obtain data, and return data to the client that issued the request. Execute the requests in the blocking queue one by one until all requests are completed.

[0055] The correspondence between the communication technology type of the access device and the response strategy can be, for example, Figure 3 shown.

[0056] Devices using the first type of protocol (such as 485 protocol): Since the transmission protocol used by the device is slow and it takes a long time to package data, it cannot process other instructions in a short time. For this type of access device, you can respond to the client in a rejection manner.

[0057] Devices using the second type of protocol (such as the MQTT protocol): Since the transmission protocol used by the device is not slow and it does not take long to package data, this type of access device can respond to the client in a waiting manner.

[0058] Devices that use the third-class protocol (such as Modbus TCP protocol) and have data caching capabilities: Since the transmission protocol used by the device has a higher communication rate and the device can store real-time data within a certain period of time, a reply caching strategy can be used to respond to the client for this type of access device.

[0059] based on Figure 2 The method shown can make the server's response mode to multiple client requests no longer single, which helps to respond to the client faster, thereby improving the client's user experience.

[0060] The method provided in the embodiment of the present application is described in detail above. The device provided in the embodiment of the present application is described in detail below with reference to the accompanying drawings.

[0061] See also Figure 4 , is a schematic diagram of the structure of a server-side device provided in an embodiment of the present application. Figure 4 The server-side device 400 shown may include a receiving module 410 and a responding module 420 .

[0062] The receiving module 410 may be configured to receive first requests sent by multiple clients, where the first requests are used to request data of a first device, where the first device is an access device on the server side;

[0063] The response module 420 may be used to respond to multiple clients based on a first strategy, the first strategy may be determined based on the type of communication technology adopted by the first device, the first strategy may include a rejection strategy, a waiting strategy, and a reply cache strategy, and the communication rates of the communication technology types corresponding to the rejection strategy, the waiting strategy, and the reply cache strategy are from slow to fast in sequence;

[0064] The rejection strategy may be used to instruct the server to respond to the first first request received and return the request result, and reject other first requests;

[0065] The waiting strategy can be used to instruct the server to put the first requests of multiple clients into the first blocking queue, and respond to the multiple clients in sequence according to the order in the first blocking queue and return the request results;

[0066] The reply cache strategy can be used to instruct the server to respond to the first first request received and return the request result, and put the request result into the cache to respond to other first requests. The first device corresponding to the reply cache strategy has data cache capability.

[0067] Optionally, the communication rate may be determined based on a transmission protocol adopted by the communication technology type.

[0068] Optionally, the device may further include a policy distributor 430, and the policy distributor 430 may be used to determine the first policy.

[0069] Optionally, the device may also include a checking module 440, which may be used to check whether the first device is online before the response module responds to multiple clients based on the first policy; the response module 420 may also be used to return an offline result to multiple clients when the checking module 440 determines that the first device is not online.

[0070] The present application also provides an electronic device. Figure 5 As shown, the electronic device 500 includes: at least one processor 501, a memory 502, and a computer program 503 stored in the memory 502 and executable on the at least one processor 501. When the processor 501 executes the computer program 503, the method provided in the present application is implemented.

[0071] Exemplarily, the computer program 503 may be divided into one or more modules / units, one or more modules / units are stored in the memory 502, and are executed by the processor 501 to complete the present application. One or more modules / units may be a series of computer program instruction segments capable of completing specific functions, and the instruction segments are used to describe the execution process of the computer program in the electronic device 500.

[0072] Those skilled in the art will understand that Figure 5 It is only an example of the electronic device 500 and does not constitute a limitation of the electronic device. It may include more or fewer components than shown in the figure, or a combination of certain components, or different components. For example, the electronic device 500 may also include input and output devices, network access devices, buses, etc.

[0073] The processor 501 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or the processor may be any conventional processor, etc.

[0074] The memory 502 may be an internal storage unit of the electronic device 500, such as a hard disk or memory of the electronic device 500. The memory 502 may also be an external storage device of the electronic device 500, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. equipped on the electronic device 500. Further, the memory 502 may also include both an internal storage unit of the electronic device 500 and an external storage device. The memory 502 is used to store computer programs and other programs and data required by the electronic device 500. The memory 502 may also be used to temporarily store data that has been output or is to be output.

[0075] The electronic device 500 provided in this embodiment can execute the above method embodiment, and its implementation principle and technical effect are similar, which will not be repeated here.

[0076] An embodiment of the present application further provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments can be implemented.

[0077] An embodiment of the present application provides a computer program product. When the computer program product runs on an electronic device, the electronic device can implement the steps in the above-mentioned method embodiments when executing the computer program product.

[0078] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present application implements all or part of the processes in the above method embodiments, which can be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium. When the computer program is executed by the processor, the steps of the above method embodiments can be implemented. Among them, the computer program includes computer program code, which can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may at least include: any entity or device that can carry the computer program code to the camera / electronic device, recording medium, computer memory, ROM (read-only memory), RAM (random access memory), CD-ROM (compact disc read-only memory), magnetic tape, floppy disk and optical data storage device. The computer-readable storage medium mentioned in the present application can be a non-volatile storage medium, in other words, it can be a non-transient storage medium.

[0079] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0080] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.

[0081] In the embodiments provided in the present application, it should be understood that the disclosed devices / equipment and methods can be implemented in other ways. For example, the device / equipment embodiments described above are only schematic, for example, the division of modules or units is only a logical function division, and there may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0082] It should be understood that when used in the present specification and the appended claims, the term "comprising" indicates the presence of described features, wholes, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components and / or combinations thereof.

[0083] It should also be understood that the term “and / or” used in the specification and appended claims refers to any and all possible combinations of one or more of the associated listed items, and includes these combinations.

[0084] As used in the specification and appended claims of this application, the term "if" can be interpreted as "when" or "uponce" or "in response to determining" or "in response to detecting", depending on the context. Similarly, the phrase "if it is determined" or "if [described condition or event] is detected" can be interpreted as meaning "uponce it is determined" or "in response to determining" or "uponce [described condition or event] is detected" or "in response to detecting [described condition or event]", depending on the context.

[0085] In addition, in the description of the present application specification and the appended claims, the terms "first", "second", etc. are only used to distinguish the descriptions and cannot be understood as indicating or implying relative importance.

[0086] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present application.

Claims

1. A multi-client request response method, characterized in that: The method is executed by the server side, and the method includes: Receiving first requests sent by multiple clients, where the first requests are used to request data of a first device, where the first device is an access device of the server; Responding to the multiple clients based on a first strategy, the first strategy being determined based on a type of communication technology adopted by the first device, the first strategy comprising a rejection strategy, a wait strategy, and a reply cache strategy, and the communication rates of the communication technology types corresponding to the rejection strategy, the wait strategy, and the reply cache strategy are in descending order; The rejection strategy is used to instruct the server to respond to the first first request received and return the request result, and reject other first requests; The waiting strategy is used to instruct the server to put the first requests of the multiple clients into a first blocking queue, and respond to the multiple clients in sequence according to the order in the first blocking queue and return the request results; The reply cache strategy is used to instruct the server to respond to the first first request received and return the request result, and put the request result into the cache to respond to other first requests. The first device corresponding to the reply cache strategy has data cache capability.

2. The method according to claim 1, characterized in that The communication rate is determined based on a transmission protocol adopted by the communication technology type.

3. The method according to claim 2, characterized in that The first policy is determined by a policy distributor on the server side.

4. The method according to claim 3, characterized in that Before responding to the plurality of clients based on the first policy, the method further includes: Checking whether the first device is online; If the first device is not online, an offline result is returned to the multiple clients.

5. A server-side device, characterized in that: include: A receiving module, configured to receive first requests sent by a plurality of clients, wherein the first requests are used to request data of a first device, and the first device is an access device of the server; a response module, configured to respond to the plurality of clients based on a first strategy, wherein the first strategy is determined based on a type of communication technology adopted by the first device, the first strategy comprising a rejection strategy, a waiting strategy, and a reply cache strategy, and the communication rates of the communication technology types corresponding to the rejection strategy, the waiting strategy, and the reply cache strategy are in descending order; The rejection strategy is used to instruct the server to respond to the first first request received and return the request result, and reject other first requests; The waiting strategy is used to instruct the server to put the first requests of the multiple clients into a first blocking queue, and respond to the multiple clients in sequence according to the order in the first blocking queue and return the request results; The reply cache strategy is used to instruct the server to respond to the first first request received and return the request result, and put the request result into the cache to respond to other first requests. The first device corresponding to the reply cache strategy has data cache capability.

6. The device according to claim 5, characterized in that The communication rate is determined based on a transmission protocol adopted by the communication technology type.

7. The device according to claim 6, characterized in that The device also includes a policy distributor configured to determine the first policy.

8. The device according to claim 7, characterized in that The device also includes: a checking module, configured to check whether the first device is online before the responding module responds to the plurality of clients based on the first policy; The response module is further configured to return an offline result to the multiple clients when the checking module determines that the first device is offline.

9. An electronic device comprising a memory, at least one processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the method according to any one of claims 1 to 4 is implemented.

10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 4 is implemented.

Citation Information

Patent Citations

  • Mobile device configuration for wireless networks

    CN112119655A

  • Data request processing method and device, storage medium and electronic equipment

    CN117675935A