MQTT service generation method, server and MQTT proxy server

By automatically establishing MQTT replica service, the problem of manual configuration and debugging of communication processes based on the MQTT protocol in the prior art is solved, and the process simplification and error rate reduction are achieved.

CN119728784AActive Publication Date: 2025-03-28GREE ELECTRIC APPLIANCE INC OF ZHUHAI +1
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202411929392.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-25
Publication Date
2025-03-28
Estimated Expiration
2044-12-25

AI Technical Summary

Technical Problem

In the prior art, communication processes based on the MQTT protocol require manual configuration and debugging, which have problems such as time-consuming, cumbersome steps and error-prone.

Method used

Provide a method for generating an MQTT service. By receiving a client's service application, determine whether the client is a target service object, obtain the resource utilization rate of the server, select a server with sufficient resources and no MQTT replica service is configured, generate the target address of the target server, and generate a copy request based on the target address, and send it to the MQTT proxy server to automatically establish the MQTT replica service.

Benefits of technology

Automatically establishing MQTT replica service is implemented, reducing the steps of manual configuration and debugging, simplifying the process and reducing the error rate.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119728784A_ABST
    Figure CN119728784A_ABST
Patent Text Reader

Abstract

The invention provides an MQTT service generation method, a server and an MQTT proxy server, and the method comprises the steps: receiving a service application sent by a client, and determining whether the client is a target service object or not; under the condition that the client is the target service object, obtaining the resource utilization rate of the server, determining the server of which the resource utilization rate is smaller than a preset threshold value and which is not configured with the MQTT copy service as a target server, and generating a target address of the target server; and generating a copy request according to the target address, sending the copy request to the MQTT proxy server, so that the MQTT proxy server generates an MQTT copy service corresponding to the target address and sends the MQTT copy service to the target server, and performing data processing on the client based on the MQTT copy service in the target server. Through the method and the device, the problem that time and labor are consumed due to the fact that a communication process based on an MQTT protocol needs to be manually configured and debugged in the prior art is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of server configuration, and in particular to an MQTT service generation method, a server and an MQTT proxy server. Background Art

[0002] With the rapid development of Internet of Things technology, MQTT (Message Queuing Telemetry Transport, a client-server based message publishing / subscription transmission protocol, referred to as MQTT) has been widely used in smart home, smart medical care, smart agriculture and other fields due to its lightweight, easy to implement and strong scalability. However, the existing communication process based on MQTT protocol is relatively complex, especially when it is necessary to establish a dedicated line service, which often requires manual configuration and debugging, which is time-consuming, labor-intensive, cumbersome and error-prone. Summary of the invention

[0003] The main purpose of the present application is to provide an MQTT service generation method, a server and an MQTT proxy server, so as to at least solve the problem in the prior art that the communication process based on the MQTT protocol requires manual configuration and debugging, which is time-consuming and labor-intensive.

[0004] In order to achieve the above-mentioned purpose, according to one aspect of the present application, a MQTT service generation method is provided, including: receiving a service application sent by a client, determining whether the client is a target service object, wherein the service application is used to apply for access to the MQTT service, the target service object is the object of the MQTT service, and the MQTT service is a service that performs data processing on an MQTT proxy server; when the client is the target service object, obtaining the resource utilization rate of the server, determining the server whose resource utilization rate is less than a preset threshold and is not configured with an MQTT replica service as a target server, and generating a target address of the target server, wherein the resource utilization rate indicates the usage status of the server resources, and the target address is the Internet Protocol address of the target server; generating a replica request according to the target address, and sending the replica request to the MQTT proxy server, so that the MQTT proxy server generates an MQTT replica service corresponding to the target address and sends it to the target server, so that the target server performs data processing on the client based on the MQTT replica service, wherein the replica request is used to request the generation of the MQTT replica service, and the MQTT replica service is a replica of the MQTT service.

[0005] Optionally, determining whether the client is a target service object includes: obtaining an Internet Protocol address and a geographic location of the client; and determining that the client is the target service object when the Internet Protocol address of the client is a preset address and the geographic location is a preset location.

[0006] Optionally, the resource usage of the server is obtained, and the server whose resource usage is less than a preset threshold and which is not configured with an MQTT replica service is determined as a target server, including: obtaining at least the memory usage and processor usage of the server; and determining that the server is a target server when the memory usage is less than a preset memory threshold and the processor usage is less than a preset processor threshold and the server is not configured with an MQTT replica service.

[0007] Optionally, after generating the target address, the method further comprises: generating a target port and a service area, wherein the target port represents a communication port of the target server, and the service area represents a geographical area served by the target server.

[0008] According to another aspect of the present application, a MQTT service generation method is provided, including: receiving a replica request sent by a target server, wherein the replica request is used to request generation of an MQTT replica service, the MQTT replica service is a replica of the MQTT service, and the MQTT service is a service performed on an MQTT proxy server; generating an MQTT replica service corresponding to a target address, and sending it to the target server, so that the target server processes data for a client based on the MQTT replica service, the target address being an Internet Protocol address of the target server, and the target server being a server whose resource utilization rate is less than a preset threshold and for which the MQTT replica service is not configured.

[0009] Optionally, the target address is an Internet Protocol address of the target server generated after the target server is determined.

[0010] Optionally, before obtaining the resource usage rate of the server, the Internet Protocol address and geographic location of the client are obtained, and when the Internet Protocol address of the client is a preset address and the geographic location is a preset location, the client is determined to be a target service object.

[0011] Optionally, the resource usage of the server being less than a preset threshold at least includes that a memory usage of the server is less than a preset memory threshold and a processor usage is less than a preset processor threshold.

[0012] According to another aspect of the present application, a server is provided, comprising: a determination unit, configured to receive a service application sent by a client, and determine whether the client is a target service object, wherein the service application is used to apply for access to an MQTT service, and the target service object is an object of the MQTT service, and the MQTT service is a service that performs data processing on an MQTT proxy server; a generation unit, configured to obtain a resource usage rate of the server when the client is the target service object, determine the server whose resource usage rate is less than a preset threshold and is not configured with the MQTT replica service as a target server, and generate a target address of the target server, wherein the resource usage rate indicates the usage status of server resources, and the target address is an Internet Protocol address of the target server; a first sending unit, configured to generate a replica request according to the target address, and send the replica request to the MQTT proxy server, so that the MQTT proxy server generates an MQTT replica service corresponding to the target address and sends it to the target server, so that the target server performs data processing on the client based on the MQTT replica service, wherein the replica request is used to request generation of the MQTT replica service, and the MQTT replica service is a replica of the MQTT service.

[0013] According to another aspect of the present application, a MQTT proxy server is provided, comprising: a receiving unit, for receiving a replica request sent by a target server, wherein the replica request is used to request generation of an MQTT replica service, the MQTT replica service is a replica of the MQTT service, and the MQTT service is a service performed on the MQTT proxy server; a second sending unit, for generating an MQTT replica service corresponding to a target address, and sending it to the target server, so that the target server processes data for a client based on the MQTT replica service, the target address being an Internet Protocol address of the target server, and the target server being a server whose resource utilization rate is less than a preset threshold and for which the MQTT replica service is not configured.

[0014] Apply the technical solution of the present application, receive the service request sent by the client, determine whether the client is the target service object; when the client is the target service object, obtain the resource utilization rate of the server, determine the server whose resource utilization rate is less than the preset threshold and is not configured with the MQTT replica service as the target server, and generate the target address of the target server; generate a replica request according to the target address, send the replica request to the MQTT proxy server, so that the MQTT proxy server generates the MQTT replica service corresponding to the target address and sends it to the target server, so that the target server processes the client based on the MQTT replica service. Compared with the prior art, the communication process based on the MQTT protocol needs to be manually configured and debugged, which is time-consuming, labor-intensive, cumbersome and error-prone, the present application automatically establishes the MQTT replica service through the above steps to process data based on the MQTT replica service on the target server, so that manual configuration and debugging are not required. Therefore, it can solve the problem that the communication process based on the MQTT protocol in the prior art needs to be manually configured and debugged, and the steps are simple and the error rate is reduced. BRIEF DESCRIPTION OF THE DRAWINGS

[0015] The drawings constituting part of the present application are used to provide a further understanding of the present application. The exemplary embodiments and descriptions of the present application are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:

[0016] Figure 1 A schematic diagram of a process of generating an MQTT service provided by an embodiment of the present application is shown;

[0017] Figure 2 A schematic diagram of a process of another MQTT service generation method provided in an embodiment of the present application is shown;

[0018] Figure 3 A schematic diagram of a specific MQTT service generation method provided in an embodiment of the present application is shown;

[0019] Figure 4 A structural block diagram of a server provided in an embodiment of the present application is shown;

[0020] Figure 5 A structural block diagram of an MQTT proxy server provided in an embodiment of the present application is shown. DETAILED DESCRIPTION

[0021] It should be noted that, in the absence of conflict, the embodiments and features in the embodiments of the present application can be combined with each other. The present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.

[0022] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present application.

[0023] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequential order. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present application described here. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0024] For the convenience of description, some nouns or terms involved in the embodiments of the present application are explained below:

[0025] MQTT: Message Queuing Telemetry Transport, is a client-server based message publish / subscribe transport protocol.

[0026] As introduced in the background technology, the communication process based on the MQTT protocol in the prior art requires manual configuration and debugging, which is time-consuming and labor-intensive. In order to solve the problem that the communication process based on the MQTT protocol requires manual configuration and debugging, which is time-consuming and labor-intensive, the embodiments of the present application provide an MQTT service generation method, server and MQTT proxy server.

[0027] The technical solutions in the embodiments of the present invention will be described clearly and completely below in conjunction with the accompanying drawings in the embodiments of the present invention.

[0028] In this embodiment, a method for generating an MQTT service running on a mobile terminal, a computer terminal or a similar computing device is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.

[0029] Figure 1is a flow chart of the MQTT service generation method according to an embodiment of the present application. Figure 1 As shown, the method comprises the following steps:

[0030] Step S201, receiving a service application sent by a client, and determining whether the client is a target service object, wherein the service application is used to apply for access to an MQTT service, the target service object is an object of the MQTT service, and the MQTT service is a service that processes data on an MQTT proxy server;

[0031] Specifically, the present application constructs a proxy service system based on the MQTT protocol. MQTT (Message Queuing Telemetry Transport) is a client-server based message publish / subscribe transmission protocol. The system consists of an MQTT proxy server, a dedicated line generation service, a client (which can be a device end, a user end, etc.) and a database. The MQTT proxy server is responsible for receiving, processing and forwarding messages from the client, and the dedicated line generation service pre-configures the object-oriented information of the dedicated line generation service. The executor of this embodiment is a server, or a main server, which is used to monitor the resource configuration of the server cluster and configure the above-mentioned dedicated line generation service. The client generally logs in through a smart device, and the client sends a service application, which is first transmitted to the MQTT proxy server. The MQTT proxy server further sends the application to the server that configures the dedicated line generation service. The server determines whether the client is within the service object range. If it is within the service object range, it indicates that the client is the target service object.

[0032] Step S202, when the client is the target service object, obtain the resource usage rate of the server, determine the server whose resource usage rate is less than a preset threshold and is not configured with the MQTT replica service as the target server, and generate a target address of the target server, wherein the resource usage rate represents the usage status of the server resources, and the target address is the Internet Protocol address of the target server;

[0033] Specifically, when the client is within the service object range, the server monitors the resource usage of each server in the MQTT proxy server cluster in real time. The resource usage can include key resource indicators such as memory usage, CPU usage, and physical memory occupancy. When the resource usage is less than the preset threshold, it indicates that the server has less load and sufficient resources, which is suitable for configuring the MQTT service. It is also necessary to consider whether the MQTT service has been configured. Select server resources with sufficient resources and no MQTT service configured, obtain the target server, and provide the target server's target address (ID) and other service configurations. The service configuration mainly includes: 1. Dedicated service object ID; 2. Dedicated service IP group; 3. Dedicated service location range; 4. Service effective time.

[0034] Step S203: Generate a copy request according to the target address, and send the copy request to the MQTT proxy server, so that the MQTT proxy server generates an MQTT copy service corresponding to the target address and sends it to the target server, so that the target server processes data for the client based on the MQTT copy service, wherein the copy request is used to request the generation of the MQTT copy service, and the MQTT copy service is a copy of the MQTT service.

[0035] Specifically, a replica request is generated according to the above target address. In actual applications, a more specific replica request can also be generated according to the above four service configurations and sent to the MQTT proxy server. The MQTT proxy server generates an MQTT replica service and sends the generated result back to the server. The server executes the MQTT replica service (program) on the selected target server to generate a new MQTT proxy service instance, which will inherit the configuration and functions of the main MQTT proxy service and take over the connection and data processing tasks of the newly added device end for the configured service scope. The main MQTT proxy service is a service that is directly executed on the MQTT proxy server.

[0036] Through this embodiment, a service application sent by a client is received to determine whether the client is the target service object; when the client is the target service object, the resource utilization rate of the server is obtained, and a server whose resource utilization rate is less than a preset threshold and is not configured with an MQTT replica service is determined as a target server, and a target address of the target server is generated; a replica request is generated according to the target address, and the replica request is sent to the MQTT proxy server, so that the MQTT proxy server generates an MQTT replica service corresponding to the target address and sends it to the target server, so that the target server processes data for the client based on the MQTT replica service. Compared with the prior art, the communication process based on the MQTT protocol requires manual configuration and debugging, which is time-consuming, labor-intensive, cumbersome, and prone to errors. The present application automatically establishes an MQTT replica service through the above steps to process data based on the MQTT replica service on the target server, thereby eliminating the need for manual configuration and debugging. Therefore, it can solve the problem of the prior art that the communication process based on the MQTT protocol requires manual configuration and debugging, and achieves the effect of concise steps and reduced error rate.

[0037] In a specific implementation process, the above step S202 determines whether the client is the target service object, which can be implemented by the following steps: Step S2021: Acquire the Internet Protocol address and geographical location of the client; Step S2022: When the Internet Protocol address of the client is a preset address and the geographical location is a preset location, determine that the client is the target service object. The method determines whether the client is the target service object through the above steps, so that service configuration can be further performed for the client.

[0038] Specifically, the server's dedicated line generation service determines whether the IP (Internet Protocol address) and geographic location reported by the client are within the pre-configured object and scope allowed for the dedicated line service. If the Internet Protocol address is a preset address and the geographic location is a preset location, the client is determined to be the target service object.

[0039] In some optional implementations, the above step S202 obtains the resource usage of the server, and determines the server whose resource usage is less than a preset threshold and is not configured with an MQTT replica service as a target server, which can be achieved by the following steps: Step S2023: at least obtain the memory usage and processor usage of the server; Step S2024: when the memory usage is less than a preset memory threshold and the processor usage is less than a preset processor threshold and the server is not configured with an MQTT replica service, determine that the server is a target server. The method determines the target server through the above steps, so that qualified servers can be screened to smoothly configure the MQTT service.

[0040] In the specific implementation process, the resource pressure of the server is monitored to determine whether the resource utilization rate meets the requirements for configuring the MQTT service. The dedicated line service monitors the key resource indicators such as the memory utilization rate, CPU utilization rate, and physical memory utilization rate of each server in the MQTT proxy server cluster in real time. The server resource pressure level is as follows: 1. Low pressure level, memory utilization rate is less than 20%, CPU utilization rate is less than 20%, and physical memory utilization rate is less than 30%. In this state, the server runs smoothly, resources are sufficient, and more connections and message loads can be processed. The dedicated line service can be configured. 2. Medium pressure level, memory utilization rate is 20%-50%, CPU utilization rate is less than 20%-70%, and physical memory utilization rate is 30%-70%. The server begins to feel a certain load, but it is still capable of handling increased requests. After the dedicated line service is generated, it may be necessary to monitor the system performance. 3. High pressure level, memory utilization rate exceeds 50%, CPU utilization rate exceeds 70%, and physical memory utilization rate exceeds 70%. The server load is high, and the generation of the dedicated line service may affect the response time and stability of the service.

[0041] In some other optional implementations, after generating the target address, the method further comprises the following steps: generating a target port and a service area, wherein the target port represents the communication port of the target server, and the service area represents the geographical area served by the target server. The method generates the configuration port and region through the above steps, so that a specific port and region of the service configuration can be generated to provide dedicated line service to the client.

[0042] During the specific implementation process, the configuration elements also include the service scope, the target port, i.e. the fixed IP port, and the service area, i.e. the fixed area service.

[0043] Figure 2 FIG. 1 is a flowchart of another MQTT service generation method according to an embodiment of the present application. Figure 2 As shown, the method comprises the following steps:

[0044] Step S301, receiving a replica request sent by a target server, wherein the replica request is used to request generation of an MQTT replica service, the MQTT replica service is a replica of an MQTT service, and the MQTT service is a service performed on the MQTT proxy server;

[0045] Specifically, the present application constructs a proxy service system based on the MQTT protocol. MQTT (Message Queuing Telemetry Transport) is a client-server based message publish / subscribe transmission protocol. The system consists of an MQTT proxy server, a dedicated line generation service, a client (which can be a device end, a user end, etc.) and a database. The MQTT proxy server is responsible for receiving, processing and forwarding messages from the client, and the dedicated line generation service pre-configures the object-oriented information of the dedicated line generation service. The executor of this embodiment is the MQTT proxy server. The client generally logs in through a smart device. The client sends a service application, which is first transmitted to the MQTT proxy server. The MQTT proxy server further sends the application to the server that configures the dedicated line generation service. The server determines whether the client is within the service object range. If it is within the service object range, it indicates that the client is the target service object.

[0046] Step S302, generate an MQTT replica service corresponding to the target address and send it to the target server so that the target server processes data for the client based on the MQTT replica service. The target address is the Internet Protocol address of the target server, and the target server is a server whose resource utilization rate is less than a preset threshold and the MQTT replica service is not configured.

[0047] Specifically, when the client is within the service object scope, the server monitors the resource utilization of each server in the MQTT proxy server cluster in real time. The resource utilization may include key resource indicators such as memory utilization, CPU utilization, and physical memory occupancy. When the resource utilization is less than the preset threshold, it indicates that the server has a small load and sufficient resources, and is suitable for configuring the MQTT service. It is also necessary to consider whether the MQTT service has been configured.

[0048] The server generates a replica request according to the above target address. In actual applications, a more specific replica request can also be generated according to the above four service configurations and sent to the MQTT proxy server. The MQTT proxy server generates an MQTT replica service and sends the generated result back to the server. The server executes the MQTT replica service (program) on the selected target server and generates a new MQTT proxy service instance. The instance will inherit the configuration and functions of the main MQTT proxy service and take over the connection and data processing tasks of the newly added device end for the configured service scope. The main MQTT proxy service is a service that is directly executed on the MQTT proxy server.

[0049] The above step S302 of the present application can be implemented through the following steps: the target address is the Internet Protocol address of the target server generated after the target server is determined. The method determines the target address through the above steps, so that the client can be allowed to access and provide dedicated line service through the target address.

[0050] During the specific implementation process, select server resources with sufficient resources and no MQTT service configured, obtain the target server, and provide service configurations such as the target address (ID) of the target server. The service configuration mainly includes: 1. Dedicated service object ID; 2. Dedicated service IP group; 3. Dedicated service location range; 4. Service effective time.

[0051] The above method also includes other implementation steps, for example: before obtaining the resource usage rate of the server, obtaining the Internet Protocol address and geographical location of the client, and determining that the client is a target service object when the Internet Protocol address of the client is a preset address and the geographical location is a preset location. The method determines whether the client is within the service range through the above steps, so as to determine whether to continue to configure the MQTT service.

[0052] Specifically, the server's dedicated line generation service determines whether the IP (Internet Protocol address) and geographic location reported by the client are within the pre-configured object and scope allowed for the dedicated line service. If the Internet Protocol address is a preset address and the geographic location is a preset location, the client is determined to be the target service object.

[0053] In some embodiments, the above method may include the following steps: the resource utilization rate of the server is less than a preset threshold, which at least includes that the memory utilization rate of the server is less than a preset memory threshold and the processor utilization rate is less than a preset processor threshold. The method determines the resource utilization rate of the server through the above steps to determine the target server based on the resource utilization rate, ensuring that the target server has sufficient operating resources.

[0054] In the specific implementation process, the resource pressure of the server is monitored to determine whether the resource utilization rate meets the requirements for configuring the MQTT service. The dedicated line service monitors the key resource indicators such as the memory utilization rate, CPU utilization rate, and physical memory utilization rate of each server in the MQTT proxy server cluster in real time. The server resource pressure level is as follows: 1. Low pressure level, memory utilization rate is less than 20%, CPU utilization rate is less than 20%, and physical memory utilization rate is less than 30%. In this state, the server runs smoothly, resources are sufficient, and more connections and message loads can be processed. The dedicated line service can be configured. 2. Medium pressure level, memory utilization rate is 20%-50%, CPU utilization rate is less than 20%-70%, and physical memory utilization rate is 30%-70%. The server begins to feel a certain load, but it is still capable of handling increased requests. After the dedicated line service is generated, it may be necessary to monitor the system performance. 3. High pressure level, memory utilization rate exceeds 50%, CPU utilization rate exceeds 70%, and physical memory utilization rate exceeds 70%. The server load is high, and the generation of the dedicated line service may affect the response time and stability of the service. The final configuration elements also include the service scope, the target port, i.e. the fixed IP port, and the service area, i.e. the fixed area service.

[0055] In order to enable those skilled in the art to more clearly understand the technical solution of the present application, the implementation process of the MQTT service generation method of the present application will be described in detail below in combination with specific embodiments.

[0056] This embodiment relates to a specific MQTT service generation method, such as Figure 3 As shown, it includes a smart device (client), an MQTT agent (server), and a dedicated line server (server), and includes the following steps:

[0057] Step S1: The smart device initiates an application to the MQTT proxy server for a dedicated line service;

[0058] Step S2: The MQTT proxy server applies for dedicated line service scheduling and initiates an application to the dedicated line server (server);

[0059] Step S3: The dedicated line server (device) applies for dedicated line service scheduling;

[0060] Step S4: Determine whether it is within the service object range;

[0061] Step S5: If yes, analyze the service resources of the MQTT proxy cluster server and whether there is a configured MQTT service, and request a server with sufficient resources and no configured MQTT service as the target server;

[0062] Step S6: providing the target address generated by the service, requesting to generate a copy of the MQTT proxy service corresponding to the dedicated line service, and requesting to generate a copy of the MQTT service from the MQTT proxy server;

[0063] Step S7: The MQTT proxy server generates an MQTT proxy replica service and automatically starts it;

[0064] Step S8: Provide the MQTT proxy service replica address and port, and notify the dedicated server of the generation result;

[0065] Step S9: The smart device sends an access request to apply for access to the MQTT proxy service replica service.

[0066] The embodiment of the present application also provides a server. It should be noted that the server of the embodiment of the present application can be used to execute the MQTT service generation method provided by the embodiment of the present application. The device is used to implement the above-mentioned embodiments and preferred implementation modes, and the descriptions have been omitted. As used below, the term "module" can implement a combination of software and / or hardware for a predetermined function. Although the device described in the following embodiments is preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceived.

[0067] The following is an introduction to the server provided in the embodiment of the present application.

[0068] Figure 4 is a schematic diagram of a server according to an embodiment of the present application. Figure 4 As shown, the device comprises:

[0069] A determination unit 10 is used to receive a service application sent by a client, and determine whether the client is a target service object, wherein the service application is used to apply for access to an MQTT service, the target service object is an object of the MQTT service, and the MQTT service is a service that performs data processing on an MQTT proxy server;

[0070] Specifically, the present application constructs a proxy service system based on the MQTT protocol. MQTT (Message Queuing Telemetry Transport) is a client-server based message publish / subscribe transmission protocol. The system consists of an MQTT proxy server, a dedicated line generation service, a client (which can be a device end, a user end, etc.) and a database. The MQTT proxy server is responsible for receiving, processing and forwarding messages from the client, and the dedicated line generation service pre-configures the object-oriented information of the dedicated line generation service. The executor of this embodiment is a server, or a main server, which is used to monitor the resource configuration of the server cluster and configure the above-mentioned dedicated line generation service. The client generally logs in through a smart device, and the client sends a service application, which is first transmitted to the MQTT proxy server. The MQTT proxy server further sends the application to the server that configures the dedicated line generation service. The server determines whether the client is within the service object range. If it is within the service object range, it indicates that the client is the target service object.

[0071] A generating unit 20 is used to obtain a resource usage rate of a server when the client is the target service object, determine the server whose resource usage rate is less than a preset threshold and is not configured with the MQTT replica service as a target server, and generate a target address of the target server, wherein the resource usage rate indicates a usage status of server resources, and the target address is an Internet Protocol address of the target server;

[0072] Specifically, when the client is within the service object range, the server monitors the resource usage of each server in the MQTT proxy server cluster in real time. The resource usage can include key resource indicators such as memory usage, CPU usage, and physical memory occupancy. When the resource usage is less than the preset threshold, it indicates that the server has less load and sufficient resources, which is suitable for configuring the MQTT service. It is also necessary to consider whether the MQTT service has been configured. Select server resources with sufficient resources and no MQTT service configured, obtain the target server, and provide the target server's target address (ID) and other service configurations. The service configuration mainly includes: 1. Dedicated service object ID; 2. Dedicated service IP group; 3. Dedicated service location range; 4. Service effective time.

[0073] The first sending unit 30 is used to generate a copy request according to the target address, and send the copy request to the MQTT proxy server, so that the MQTT proxy server generates an MQTT copy service corresponding to the target address and sends it to the target server, so that the target server processes data for the client based on the MQTT copy service, wherein the copy request is used to request the generation of the MQTT copy service, and the MQTT copy service is a copy of the MQTT service.

[0074] Specifically, a replica request is generated according to the above target address. In actual applications, a more specific replica request can also be generated according to the above four service configurations and sent to the MQTT proxy server. The MQTT proxy server generates an MQTT replica service and sends the generated result back to the server. The server executes the MQTT replica service (program) on the selected target server to generate a new MQTT proxy service instance, which will inherit the configuration and functions of the main MQTT proxy service and take over the connection and data processing tasks of the newly added device end for the configured service scope. The main MQTT proxy service is a service that is directly executed on the MQTT proxy server.

[0075] Through this embodiment, a service application sent by a client is received to determine whether the client is the target service object; when the client is the target service object, the resource utilization rate of the server is obtained, and a server whose resource utilization rate is less than a preset threshold and is not configured with an MQTT replica service is determined as a target server, and a target address of the target server is generated; a replica request is generated according to the target address, and the replica request is sent to the MQTT proxy server, so that the MQTT proxy server generates an MQTT replica service corresponding to the target address and sends it to the target server, so that the target server processes data for the client based on the MQTT replica service. Compared with the prior art, the communication process based on the MQTT protocol requires manual configuration and debugging, which is time-consuming, labor-intensive, cumbersome, and prone to errors. The present application automatically establishes an MQTT replica service through the above steps to process data based on the MQTT replica service on the target server, thereby eliminating the need for manual configuration and debugging. Therefore, it can solve the problem of the prior art that the communication process based on the MQTT protocol requires manual configuration and debugging, and achieves the effect of concise steps and reduced error rate.

[0076] In a specific implementation process, the generation unit includes a first acquisition module and a first determination module, wherein the first acquisition module is used to acquire the Internet Protocol address and geographic location of the client; the first determination module is used to determine that the client is the target service object when the Internet Protocol address of the client is a preset address and the geographic location is a preset location. The method determines whether the client is the target service object through the above steps, so that service configuration can be further performed for the client.

[0077] Specifically, the server's dedicated line generation service determines whether the IP (Internet Protocol address) and geographic location reported by the client are within the pre-configured object and scope allowed for the dedicated line service. If the Internet Protocol address is a preset address and the geographic location is a preset location, the client is determined to be the target service object.

[0078] In some optional implementations, the generation unit further includes a second acquisition module and a second determination module, the second acquisition module is used to obtain at least the memory usage and processor usage of the server; the second determination module is used to determine that the server is a target server when the memory usage is less than a preset memory threshold and the processor usage is less than a preset processor threshold and the server is not configured with an MQTT replica service. The method determines the target server through the above steps, so that qualified servers can be screened to smoothly configure the MQTT service.

[0079] In the specific implementation process, the resource pressure of the server is monitored to determine whether the resource utilization rate meets the requirements for configuring the MQTT service. The dedicated line service monitors the key resource indicators such as the memory utilization rate, CPU utilization rate, and physical memory utilization rate of each server in the MQTT proxy server cluster in real time. The server resource pressure level is as follows: 1. Low pressure level, memory utilization rate is less than 20%, CPU utilization rate is less than 20%, and physical memory utilization rate is less than 30%. In this state, the server runs smoothly, resources are sufficient, and more connections and message loads can be processed. The dedicated line service can be configured. 2. Medium pressure level, memory utilization rate is 20%-50%, CPU utilization rate is less than 20%-70%, and physical memory utilization rate is 30%-70%. The server begins to feel a certain load, but it is still capable of handling increased requests. After the dedicated line service is generated, it may be necessary to monitor the system performance. 3. High pressure level, memory utilization rate exceeds 50%, CPU utilization rate exceeds 70%, and physical memory utilization rate exceeds 70%. The server load is high, and the generation of the dedicated line service may affect the response time and stability of the service.

[0080] In some other optional implementations, after generating the target address, the server further includes a generation unit for generating a target port and a service area, wherein the target port represents the communication port of the target server, and the service area represents the geographical area served by the target server. The method generates the configuration port and region through the above steps, so that a specific port and region of the service configuration can be generated to provide dedicated line service to the client.

[0081] During the specific implementation process, the configuration elements also include the service scope, the target port, i.e. the fixed IP port, and the service area, i.e. the fixed area service.

[0082] The server includes a processor and a memory, and the above-mentioned determination unit, generation unit and first sending unit are all stored in the memory as program units, and the processor executes the above-mentioned program units stored in the memory to realize corresponding functions. The above-mentioned modules are all located in the same processor; or, the above-mentioned modules are respectively located in different processors in the form of any combination.

[0083] The processor includes a kernel, which retrieves the corresponding program unit from the memory. One or more kernels can be set, and the kernel parameters can be adjusted to solve the problem that the communication process based on the MQTT protocol in the prior art needs to be manually configured and debugged, which is time-consuming and labor-intensive.

[0084] The memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM, and the memory includes at least one memory chip.

[0085] The embodiment of the present application also provides an MQTT proxy server. It should be noted that the MQTT proxy server of the embodiment of the present application can be used to execute the MQTT service generation method provided by the embodiment of the present application. The device is used to implement the above-mentioned embodiments and preferred implementation modes, and the descriptions have been omitted. As used below, the term "module" can implement a combination of software and / or hardware for a predetermined function. Although the device described in the following embodiments is preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceived.

[0086] The following is an introduction to the MQTT proxy server provided in an embodiment of the present application.

[0087] Figure 5 is a schematic diagram of a server according to an embodiment of the present application. Figure 5 As shown, the device comprises:

[0088] The receiving unit 40 is used to receive a replica request sent by a target server, wherein the replica request is used to request the generation of an MQTT replica service, the MQTT replica service is a replica of the MQTT service, and the MQTT service is a service performed on the MQTT proxy server;

[0089] Specifically, the present application constructs a proxy service system based on the MQTT protocol. MQTT (Message Queuing Telemetry Transport) is a client-server based message publish / subscribe transmission protocol. The system consists of an MQTT proxy server, a dedicated line generation service, a client (which can be a device end, a user end, etc.) and a database. The MQTT proxy server is responsible for receiving, processing and forwarding messages from the client, and the dedicated line generation service pre-configures the object-oriented information of the dedicated line generation service. The executor of this embodiment is the MQTT proxy server. The client generally logs in through a smart device. The client sends a service application, which is first transmitted to the MQTT proxy server. The MQTT proxy server further sends the application to the server that configures the dedicated line generation service. The server determines whether the client is within the service object range. If it is within the service object range, it indicates that the client is the target service object.

[0090] The second sending unit 50 is used to generate an MQTT replica service corresponding to the target address and send it to the target server so that the target server can process data for the client based on the MQTT replica service. The target address is the Internet Protocol address of the target server, and the target server is a server whose resource utilization rate is less than a preset threshold and the MQTT replica service is not configured.

[0091] Specifically, when the client is within the service object scope, the server monitors the resource utilization of each server in the MQTT proxy server cluster in real time. The resource utilization may include key resource indicators such as memory utilization, CPU utilization, and physical memory occupancy. When the resource utilization is less than the preset threshold, it indicates that the server has a small load and sufficient resources, and is suitable for configuring the MQTT service. It is also necessary to consider whether the MQTT service has been configured.

[0092] The server generates a replica request according to the above target address. In actual applications, a more specific replica request can also be generated according to the above four service configurations and sent to the MQTT proxy server. The MQTT proxy server generates an MQTT replica service and sends the generated result back to the server. The server executes the MQTT replica service (program) on the selected target server and generates a new MQTT proxy service instance. The instance will inherit the configuration and functions of the main MQTT proxy service and take over the connection and data processing tasks of the newly added device end for the configured service scope. The main MQTT proxy service is a service that is directly executed on the MQTT proxy server.

[0093] The target address of the present application is the Internet Protocol address of the target server generated after the target server is determined. The method determines the target address through the above steps, so that the client can be allowed to access and perform dedicated line services through the target address.

[0094] During the specific implementation process, select server resources with sufficient resources and no MQTT service configured, obtain the target server, and provide service configurations such as the target address (ID) of the target server. The service configuration mainly includes: 1. Dedicated service object ID; 2. Dedicated service IP group; 3. Dedicated service location range; 4. Service effective time.

[0095] Before obtaining the resource usage rate of the server, the Internet Protocol address and geographic location of the client are obtained, and when the Internet Protocol address of the client is a preset address and the geographic location is a preset location, the client is determined to be a target service object. The method determines whether the client is within the service range through the above steps, so as to determine whether to continue to configure the MQTT service.

[0096] Specifically, the server's dedicated line generation service determines whether the IP (Internet Protocol address) and geographic location reported by the client are within the pre-configured object and scope allowed for the dedicated line service. If the Internet Protocol address is a preset address and the geographic location is a preset location, the client is determined to be the target service object.

[0097] In some embodiments, the resource utilization rate of the server described above being less than a preset threshold at least includes the memory utilization rate of the server being less than a preset memory threshold and the processor utilization rate being less than a preset processor threshold. The method determines the resource utilization rate of the server through the above steps to determine the target server based on the resource utilization rate, thereby ensuring that the target server has sufficient operating resources.

[0098] In the specific implementation process, the resource pressure of the server is monitored to determine whether the resource utilization rate meets the requirements for configuring the MQTT service. The dedicated line service monitors the key resource indicators such as the memory utilization rate, CPU utilization rate, and physical memory utilization rate of each server in the MQTT proxy server cluster in real time. The server resource pressure level is as follows: 1. Low pressure level, memory utilization rate is less than 20%, CPU utilization rate is less than 20%, and physical memory utilization rate is less than 30%. In this state, the server runs smoothly, resources are sufficient, and more connections and message loads can be processed. The dedicated line service can be configured. 2. Medium pressure level, memory utilization rate is 20%-50%, CPU utilization rate is less than 20%-70%, and physical memory utilization rate is 30%-70%. The server begins to feel a certain load, but it is still capable of handling increased requests. After the dedicated line service is generated, it may be necessary to monitor the system performance. 3. High pressure level, memory utilization rate exceeds 50%, CPU utilization rate exceeds 70%, and physical memory utilization rate exceeds 70%. The server load is high, and the generation of the dedicated line service may affect the response time and stability of the service. The final configuration elements also include the service scope, the target port, i.e. the fixed IP port, and the service area, i.e. the fixed area service.

[0099] An embodiment of the present invention provides a computer-readable storage medium, wherein the computer-readable storage medium includes a stored program, wherein when the program is executed, the device where the computer-readable storage medium is located is controlled to execute the MQTT service generation method.

[0100] Specifically, the MQTT service generation method includes:

[0101] Step S201, receiving a service application sent by a client, and determining whether the client is a target service object, wherein the service application is used to apply for access to an MQTT service, the target service object is an object of the MQTT service, and the MQTT service is a service that processes data on an MQTT proxy server;

[0102] Specifically, the present application constructs a proxy service system based on the MQTT protocol. MQTT (Message Queuing Telemetry Transport) is a client-server based message publish / subscribe transmission protocol. The system consists of an MQTT proxy server, a dedicated line generation service, a client (which can be a device end, a user end, etc.) and a database. The MQTT proxy server is responsible for receiving, processing and forwarding messages from the client, and the dedicated line generation service pre-configures the object-oriented information of the dedicated line generation service. The executor of this embodiment is a server, or a main server, which is used to monitor the resource configuration of the server cluster and configure the above-mentioned dedicated line generation service. The client generally logs in through a smart device, and the client sends a service application, which is first transmitted to the MQTT proxy server. The MQTT proxy server further sends the application to the server that configures the dedicated line generation service. The server determines whether the client is within the service object range. If it is within the service object range, it indicates that the client is the target service object.

[0103] Step S202, when the client is the target service object, obtain the resource usage rate of the server, determine the server whose resource usage rate is less than a preset threshold and is not configured with the MQTT replica service as the target server, and generate a target address of the target server, wherein the resource usage rate represents the usage status of the server resources, and the target address is the Internet Protocol address of the target server;

[0104] Specifically, when the client is within the service object range, the server monitors the resource usage of each server in the MQTT proxy server cluster in real time. The resource usage can include key resource indicators such as memory usage, CPU usage, and physical memory occupancy. When the resource usage is less than the preset threshold, it indicates that the server has less load and sufficient resources, which is suitable for configuring the MQTT service. It is also necessary to consider whether the MQTT service has been configured. Select server resources with sufficient resources and no MQTT service configured, obtain the target server, and provide the target server's target address (ID) and other service configurations. The service configuration mainly includes: 1. Dedicated service object ID; 2. Dedicated service IP group; 3. Dedicated service location range; 4. Service effective time.

[0105] Step S203: Generate a copy request according to the target address, and send the copy request to the MQTT proxy server, so that the MQTT proxy server generates an MQTT copy service corresponding to the target address and sends it to the target server, so that the target server processes data for the client based on the MQTT copy service, wherein the copy request is used to request the generation of the MQTT copy service, and the MQTT copy service is a copy of the MQTT service.

[0106] Specifically, a replica request is generated according to the above target address. In actual applications, a more specific replica request can also be generated according to the above four service configurations and sent to the MQTT proxy server. The MQTT proxy server generates an MQTT replica service and sends the generated result back to the server. The server executes the MQTT replica service (program) on the selected target server to generate a new MQTT proxy service instance, which will inherit the configuration and functions of the main MQTT proxy service and take over the connection and data processing tasks of the newly added device end for the configured service scope. The main MQTT proxy service is a service that is directly executed on the MQTT proxy server.

[0107] An embodiment of the present invention provides an electronic device, including a processor, a memory, and a program stored in the memory and executable on the processor, wherein when the processor executes the program, at least the following steps are implemented:

[0108] Step S201, receiving a service application sent by a client, and determining whether the client is a target service object, wherein the service application is used to apply for access to an MQTT service, the target service object is an object of the MQTT service, and the MQTT service is a service that processes data on an MQTT proxy server;

[0109] Specifically, the present application constructs a proxy service system based on the MQTT protocol. MQTT (Message Queuing Telemetry Transport) is a client-server based message publish / subscribe transmission protocol. The system consists of an MQTT proxy server, a dedicated line generation service, a client (which can be a device end, a user end, etc.) and a database. The MQTT proxy server is responsible for receiving, processing and forwarding messages from the client, and the dedicated line generation service pre-configures the object-oriented information of the dedicated line generation service. The executor of this embodiment is a server, or a main server, which is used to monitor the resource configuration of the server cluster and configure the above-mentioned dedicated line generation service. The client generally logs in through a smart device, and the client sends a service application, which is first transmitted to the MQTT proxy server. The MQTT proxy server further sends the application to the server that configures the dedicated line generation service. The server determines whether the client is within the service object range. If it is within the service object range, it indicates that the client is the target service object.

[0110] Step S202, when the client is the target service object, obtain the resource usage rate of the server, determine the server whose resource usage rate is less than a preset threshold and is not configured with the MQTT replica service as the target server, and generate a target address of the target server, wherein the resource usage rate represents the usage status of the server resources, and the target address is the Internet Protocol address of the target server;

[0111] Specifically, when the client is within the service object range, the server monitors the resource usage of each server in the MQTT proxy server cluster in real time. The resource usage can include key resource indicators such as memory usage, CPU usage, and physical memory occupancy. When the resource usage is less than the preset threshold, it indicates that the server has less load and sufficient resources, which is suitable for configuring the MQTT service. It is also necessary to consider whether the MQTT service has been configured. Select server resources with sufficient resources and no MQTT service configured, obtain the target server, and provide the target server's target address (ID) and other service configurations. The service configuration mainly includes: 1. Dedicated service object ID; 2. Dedicated service IP group; 3. Dedicated service location range; 4. Service effective time.

[0112] Step S203: Generate a copy request according to the target address, and send the copy request to the MQTT proxy server, so that the MQTT proxy server generates an MQTT copy service corresponding to the target address and sends it to the target server, so that the target server processes data for the client based on the MQTT copy service, wherein the copy request is used to request the generation of the MQTT copy service, and the MQTT copy service is a copy of the MQTT service.

[0113] Specifically, a replica request is generated according to the above target address. In actual applications, a more specific replica request can also be generated according to the above four service configurations and sent to the MQTT proxy server. The MQTT proxy server generates an MQTT replica service and sends the generated result back to the server. The server executes the MQTT replica service (program) on the selected target server to generate a new MQTT proxy service instance, which will inherit the configuration and functions of the main MQTT proxy service and take over the connection and data processing tasks of the newly added device end for the configured service scope. The main MQTT proxy service is a service that is directly executed on the MQTT proxy server.

[0114] The devices in this article can be servers, PCs, PADs, mobile phones, etc.

[0115] The present application also provides a computer program product, including a computer program, which, when executed by a processor, implements the steps of the method described in each embodiment of the present application:

[0116] Step S201, receiving a service application sent by a client, and determining whether the client is a target service object, wherein the service application is used to apply for access to an MQTT service, the target service object is an object of the MQTT service, and the MQTT service is a service that processes data on an MQTT proxy server;

[0117] Specifically, the present application constructs a proxy service system based on the MQTT protocol. MQTT (Message Queuing Telemetry Transport) is a client-server based message publish / subscribe transmission protocol. The system consists of an MQTT proxy server, a dedicated line generation service, a client (which can be a device end, a user end, etc.) and a database. The MQTT proxy server is responsible for receiving, processing and forwarding messages from the client, and the dedicated line generation service pre-configures the object-oriented information of the dedicated line generation service. The executor of this embodiment is a server, or a main server, which is used to monitor the resource configuration of the server cluster and configure the above-mentioned dedicated line generation service. The client generally logs in through a smart device, and the client sends a service application, which is first transmitted to the MQTT proxy server. The MQTT proxy server further sends the application to the server that configures the dedicated line generation service. The server determines whether the client is within the service object range. If it is within the service object range, it indicates that the client is the target service object.

[0118] Step S202, when the client is the target service object, obtain the resource usage rate of the server, determine the server whose resource usage rate is less than a preset threshold and is not configured with the MQTT replica service as the target server, and generate a target address of the target server, wherein the resource usage rate represents the usage status of the server resources, and the target address is the Internet Protocol address of the target server;

[0119] Specifically, when the client is within the service object range, the server monitors the resource usage of each server in the MQTT proxy server cluster in real time. The resource usage can include key resource indicators such as memory usage, CPU usage, and physical memory occupancy. When the resource usage is less than the preset threshold, it indicates that the server has less load and sufficient resources, which is suitable for configuring the MQTT service. It is also necessary to consider whether the MQTT service has been configured. Select server resources with sufficient resources and no MQTT service configured, obtain the target server, and provide the target server's target address (ID) and other service configurations. The service configuration mainly includes: 1. Dedicated service object ID; 2. Dedicated service IP group; 3. Dedicated service location range; 4. Service effective time.

[0120] Step S203: Generate a copy request according to the target address, and send the copy request to the MQTT proxy server, so that the MQTT proxy server generates an MQTT copy service corresponding to the target address and sends it to the target server, so that the target server processes data for the client based on the MQTT copy service, wherein the copy request is used to request the generation of the MQTT copy service, and the MQTT copy service is a copy of the MQTT service.

[0121] Specifically, a replica request is generated according to the above target address. In actual applications, a more specific replica request can also be generated according to the above four service configurations and sent to the MQTT proxy server. The MQTT proxy server generates an MQTT replica service and sends the generated result back to the server. The server executes the MQTT replica service (program) on the selected target server to generate a new MQTT proxy service instance, which will inherit the configuration and functions of the main MQTT proxy service and take over the connection and data processing tasks of the newly added device end for the configured service scope. The main MQTT proxy service is a service that is directly executed on the MQTT proxy server.

[0122] Obviously, those skilled in the art should understand that the above modules or steps of the present invention can be implemented by a general computing device, they can be concentrated on a single computing device, or distributed on a network composed of multiple computing devices, they can be implemented by a program code executable by a computing device, so that they can be stored in a storage device and executed by the computing device, and in some cases, the steps shown or described can be executed in a different order than here, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. Thus, the present invention is not limited to any specific combination of hardware and software.

[0123] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.

[0124] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0125] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0126] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process in the computer or other programmable device. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0127] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.

[0128] The memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.

[0129] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.

[0130] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.

[0131] From the above description, it can be seen that the above embodiments of the present application achieve the following technical effects:

[0132] 1) In the MQTT service generation method of the present application, a service application sent by a client is received to determine whether the client is the target service object; when the client is the target service object, the resource utilization rate of the server is obtained, and a server whose resource utilization rate is less than a preset threshold and is not configured with an MQTT replica service is determined as a target server, and a target address of the target server is generated; a replica request is generated according to the target address, and the replica request is sent to the MQTT proxy server, so that the MQTT proxy server generates an MQTT replica service corresponding to the target address and sends it to the target server, so that the target server processes data for the client based on the MQTT replica service. Compared with the prior art, the communication process based on the MQTT protocol requires manual configuration and debugging, which is time-consuming, labor-intensive, cumbersome, and prone to errors. The present application automatically establishes an MQTT replica service through the above steps to process data based on the MQTT replica service on the target server, thereby eliminating the need for manual configuration and debugging. Therefore, it can solve the problem that the communication process based on the MQTT protocol in the prior art requires manual configuration and debugging, and achieves the effect of concise steps and reduced error rate.

[0133] The above description is only the preferred embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.

Claims

1. A method for generating an MQTT service, characterized in that: include: Receive a service application sent by a client, and determine whether the client is a target service object, wherein the service application is used to apply for access to an MQTT service, the target service object is an object of the MQTT service, and the MQTT service is a service that performs data processing on an MQTT proxy server; In the case where the client is the target service object, obtaining the resource usage rate of the server, determining the server whose resource usage rate is less than a preset threshold and is not configured with an MQTT replica service as a target server, and generating a target address of the target server, wherein the resource usage rate indicates the usage status of server resources, and the target address is an Internet Protocol address of the target server; A replica request is generated according to the target address, and the replica request is sent to the MQTT proxy server, so that the MQTT proxy server generates the MQTT replica service corresponding to the target address and sends it to the target server, so that the target server processes data for the client based on the MQTT replica service, wherein the replica request is used to request the generation of the MQTT replica service, and the MQTT replica service is a replica of the MQTT service.

2. The MQTT service generation method according to claim 1, characterized in that: Determining whether the client is a target service object includes: Obtaining the Internet Protocol address and geographic location of the client; When the Internet Protocol address of the client is a preset address and the geographical location is a preset location, the client is determined to be the target service object.

3. The MQTT service generation method according to claim 1, characterized in that: Obtaining the resource usage of the server, and determining the server whose resource usage is less than a preset threshold and is not configured with the MQTT replica service as a target server, including: At least obtaining a memory usage rate and a processor usage rate of the server; When the memory usage is less than a preset memory threshold, the processor usage is less than a preset processor threshold, and the server is not configured with the MQTT replica service, the server is determined to be a target server.

4. The MQTT service generation method according to claim 1, characterized in that: After generating the target address, the method further includes: A target port and a service area are generated, wherein the target port represents a communication port of the target server, and the service area represents a geographical area served by the target server.

5. A method for generating an MQTT service, characterized in that: include: Receiving a replica request sent by a target server, wherein the replica request is used to request generation of an MQTT replica service, the MQTT replica service is a replica of an MQTT service, and the MQTT service is a service performed on an MQTT proxy server; Generate an MQTT replica service corresponding to the target address and send it to the target server so that the target server can process data for the client based on the MQTT replica service. The target address is the Internet Protocol address of the target server, and the target server is a server whose resource utilization rate is less than a preset threshold and the MQTT replica service is not configured.

6. The MQTT service generation method according to claim 5, characterized in that: The target address is an Internet Protocol address of the target server generated after the target server is determined.

7. The MQTT service generation method according to claim 6, characterized in that: Before obtaining the resource usage rate of the server, the Internet Protocol address and geographical location of the client are obtained, and when the Internet Protocol address of the client is a preset address and the geographical location is a preset location, the client is determined to be a target service object.

8. The MQTT service generation method according to claim 6, characterized in that: The resource usage rate of the server being less than a preset threshold value at least includes that the memory usage rate of the server is less than a preset memory threshold value and the processor usage rate is less than a preset processor threshold value.

9. A server, characterized in that: include: A determination unit, configured to receive a service application sent by a client, and determine whether the client is a target service object, wherein the service application is used to apply for access to an MQTT service, the target service object is an object of the MQTT service, and the MQTT service is a service that performs data processing on an MQTT proxy server; A generating unit, configured to obtain a resource usage rate of a server when the client is the target service object, determine the server whose resource usage rate is less than a preset threshold and is not configured with an MQTT replica service as a target server, and generate a target address of the target server, wherein the resource usage rate indicates a usage status of server resources, and the target address is an Internet Protocol address of the target server; A first sending unit is used to generate a copy request according to the target address, and send the copy request to the MQTT proxy server, so that the MQTT proxy server generates the MQTT copy service corresponding to the target address and sends it to the target server, so that the target server processes data for the client based on the MQTT copy service, wherein the copy request is used to request the generation of the MQTT copy service, and the MQTT copy service is a copy of the MQTT service.

10. An MQTT proxy server, characterized in that: include: A receiving unit, configured to receive a replica request sent by a target server, wherein the replica request is used to request generation of an MQTT replica service, the MQTT replica service is a replica of an MQTT service, and the MQTT service is a service performed on the MQTT proxy server; The second sending unit is used to generate an MQTT replica service corresponding to the target address and send it to the target server so that the target server can process data for the client based on the MQTT replica service. The target address is the Internet Protocol address of the target server, and the target server is a server whose resource utilization rate is less than a preset threshold and the MQTT replica service is not configured.

Citation Information

Patent Citations

  • Internet of Things message service system

    CN106534107A

  • MQTT protocol message security processing method and system based on trusted computing

    CN116846614A

  • Systems and methods for permissioned blockchain infrastructure with fine-grained access control and confidentiality-preserving publish / subscribe messaging

    US20190394175A1

  • Distributed Machine-Learning Resource Sharing and Request Routing

    US20220239758A1