Connection method of server, server, storage medium and electronic equipment

By obtaining device priority distribution information and phased connection strategy, the problem of excessive instantaneous server pressure after smart home devices is solved, and server stability and user experience are improved.

CN119109962AActive Publication Date: 2024-12-10GREE ELECTRIC APPLIANCE INC OF ZHUHAI +1

Patent Information

Application Number
CN202411249980.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-06
Publication Date
2024-12-10
Estimated Expiration
2044-09-06

AI Technical Summary

Technical Problem

After the server update and restart of smart home devices, the instantaneous pressure will cause the server to crash, affecting stability, and the existing technology lacks efficient solutions.

Method used

By obtaining the priority distribution information of the device collection, connecting the devices in stages, configuring the priority level according to the device attributes, prioritizing the connection between important devices and high-frequency devices, partitioning and microservices, dynamically adjusting priority and resource usage.

Benefits of technology

Maintain server resources within a bearable range, alleviate instantaneous pressure, and improve server stability and user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119109962A_ABST
    Figure CN119109962A_ABST
Patent Text Reader

Abstract

The invention provides a server connection method, a server, a storage medium and an electronic device.The method comprises the steps that it is determined that restarting of the server is completed; priority distribution information of a device set associated with the server is obtained, the device set comprises a plurality of devices, and the priority distribution information is used for describing the priority level of each device; and connecting the plurality of devices in the device set in stages based on the priority distribution information. The technical problem that the instantaneous pressure is too large after updating of the server in the prior art is solved, the instantaneous pressure of the server is relieved, and the stability of the server is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of Internet of Things, and in particular to a server connection method, a server, a storage medium, and an electronic device. Background Art

[0002] In related technologies, smart home devices / IoT devices refer to the use of advanced information technology and Internet of Things (IoT) technology to connect traditional home appliances and systems with the Internet to achieve automated, intelligent and convenient home management and control systems.

[0003] In the related technology, smart home devices communicate with cloud servers based on protocols. The servers will be updated and restarted according to business needs. In a short period of time after the server is updated and restarted, a large number of IoT devices may request to connect to the server at a certain moment, causing the server to be overly stressed or even crash, affecting the stability of the server.

[0004] With respect to the above-mentioned problems existing in the related technologies, no efficient and accurate solutions have been found yet. Summary of the invention

[0005] The present invention provides a server connection method, a server, a storage medium, and an electronic device to solve the technical problems in related technologies.

[0006] According to one embodiment of the present invention, a server connection method is provided, comprising: determining that the server has been restarted; obtaining priority distribution information of a device set associated with the server, wherein the device set includes multiple devices, and the priority distribution information is used to describe the priority level of each device; and connecting the multiple devices in the device set in stages based on the priority distribution information.

[0007] Optionally, before determining that the server has been restarted, the method further includes: obtaining device attributes of each device in the device set before the server program starts downtime update; configuring the priority level of the corresponding device based on the device attributes, and notifying the device.

[0008] Optionally, configuring the priority level of the corresponding device based on the device attributes includes: parsing a function type of the first device based on the device attributes, wherein the function type includes a gateway function and a storage function; if the first device is a gateway device, configuring the first device to a first priority level; if the first device is a storage device, configuring the first device to a second priority level, wherein the first priority level is higher than the second priority level.

[0009] Optionally, configuring the priority level of the corresponding device based on the device attributes includes: parsing the usage frequency of the second device based on the device attributes; determining whether the usage frequency is greater than a preset threshold; if the usage frequency is greater than the preset threshold, configuring the second device to a third priority level; if the usage frequency is less than or equal to the preset threshold, configuring the second device to a fourth priority level, wherein the third priority level is higher than the fourth priority level.

[0010] Optionally, configuring the priority level of the corresponding device based on the device attributes includes: parsing the user priority of the user to which the third device belongs based on the device attributes; and configuring the priority level of the third device based on the user priority, wherein the priority level is positively correlated with the user priority.

[0011] Optionally, before determining that the server has been restarted, the method further includes: determining an update order of multiple microservices in the server program before the server program starts a rolling update, wherein the server program includes the multiple microservices, each microservice corresponding to a software function; determining a partition device corresponding to each microservice; configuring a priority level of each partition device according to the update order, and notifying the partition device.

[0012] Optionally, connecting multiple devices in the device set in stages based on the priority distribution information includes: selecting a first device set with a preset proportion in the device set in sequence based on the priority distribution information; sending a reconnection notification message to the first device set, and monitoring the real-time proportion value of successful connections in the first device set; and continuing to connect to a second device set in the device set based on the real-time proportion value, wherein the priority level of the devices in the second device set is lower than the priority level of the devices in the first device set.

[0013] Optionally, continuing to connect to the second device set in the device set based on the real-time proportion value includes: determining whether the real-time proportion value reaches a preset proportion value; if the real-time proportion value reaches the preset proportion value, continuing to select the second device set in order in the device set based on the priority distribution information; and sending a reconnection notification message to the second device set.

[0014] Optionally, connecting multiple devices in the device set in stages based on the priority distribution information includes: selecting a third device set with a preset proportion in the device set in sequence based on the priority distribution information; sending a reconnection notification message to the third device set, and listening to the remaining computing power resources of the server; and continuing to connect to a fourth device set in the device set based on the remaining computing power resources, wherein the priority level of the devices in the fourth device set is lower than the priority level of the devices in the third device set.

[0015] Optionally, continuing to connect to the fourth device set in the device set based on the remaining computing power resources includes: determining whether the remaining computing power resources are greater than a preset computing power value; if the remaining computing power resources are greater than the preset computing power value, continuing to select the fourth device set in order in the device set based on the priority distribution information; and sending a reconnection notification message to the fourth device set.

[0016] According to another embodiment of the present invention, a server is provided, comprising: a first determination module, used to determine that the server has been restarted; a first acquisition module, used to obtain priority distribution information of a device set associated with the server, wherein the device set includes multiple devices, and the priority distribution information is used to describe the priority level of each device; and a connection module, used to connect multiple devices in the device set in stages based on the priority distribution information.

[0017] Optionally, the device also includes: a second acquisition module, used to obtain the device attributes of each device in the device set before the determination module determines that the server has been restarted and before the server program starts a downtime update; a first configuration module, used to configure the priority level of the corresponding device based on the device attributes and notify the device.

[0018] Optionally, the first configuration module includes: a first parsing unit, used to parse the function type of the first device based on the device attributes, wherein the function type includes a gateway function and a storage function; a first configuration unit, used to configure the first device to a first priority level if the first device is a gateway device; if the first device is a storage device, configure the first device to a second priority level, wherein the first priority level is higher than the second priority level.

[0019] Optionally, the first configuration module includes: a second parsing unit, used to parse the usage frequency of the second device based on the device attributes; a judgment unit, used to judge whether the usage frequency is greater than a preset threshold; a second configuration unit, used to configure the second device to a third priority level if the usage frequency is greater than the preset threshold; if the usage frequency is less than or equal to the preset threshold, configure the second device to a fourth priority level, wherein the third priority level is higher than the fourth priority level.

[0020] Optionally, the first configuration module includes: a third parsing unit, used to parse the user priority of the user to which the third device belongs based on the device attributes; a third configuration unit, used to configure the priority level of the third device based on the user priority, wherein the priority level is positively correlated with the user priority.

[0021] Optionally, the device also includes: a second determination module, used to determine the update order of multiple microservices in the server program before the first determination module determines that the server has been restarted and before the server program starts rolling update, wherein the server program includes the multiple microservices, each microservice corresponds to a software function; a third determination module, used to determine the partition device corresponding to each microservice; a second configuration module, used to configure the priority level of each partition device according to the update order, and notify the partition device.

[0022] Optionally, the connection module includes: a first selection unit, used to select a first device set with a preset proportion in the device set in sequence based on the priority distribution information; a first connection unit, used to send a reconnection notification message to the first device set and monitor the real-time proportion value of successful connection in the first device set; a second connection unit, used to continue connecting to a second device set in the device set based on the real-time proportion value, wherein the priority level of the devices in the second device set is lower than the priority level of the devices in the first device set.

[0023] Optionally, the second connection unit includes: a judgment subunit, used to judge whether the real-time proportion value reaches a preset proportion value; a selection subunit, used to continue selecting a second device set in order from the device set based on the priority distribution information if the real-time proportion value reaches a preset proportion value; and a sending subunit, used to send a reconnection notification message to the second device set.

[0024] Optionally, the connection module includes: a second selection unit, used to select a third device set with a preset proportion in the device set in sequence based on the priority distribution information; a third connection unit, used to send a reconnection notification message to the third device set and listen to the remaining computing power resources of the server; and a fourth connection unit, used to continue connecting to a fourth device set in the device set based on the remaining computing power resources, wherein the priority level of the devices in the fourth device set is lower than the priority level of the devices in the third device set.

[0025] Optionally, the fourth connection unit includes: a judgment subunit, used to judge whether the remaining computing power resources are greater than a preset computing power value; a selection subunit, used to continue selecting a fourth device set in order from the device set based on the priority distribution information if the remaining computing power resources are greater than the preset computing power value; and a sending subunit, used to send a reconnection notification message to the fourth device set.

[0026] According to another aspect of an embodiment of the present application, a storage medium is further provided, which includes a stored program, and the above steps are executed when the program is run.

[0027] According to another aspect of an embodiment of the present application, there is also provided an electronic device, including a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus; wherein: the memory is used to store computer programs; and the processor is used to execute the steps in the above method by running the program stored in the memory.

[0028] According to yet another embodiment of the present invention, a storage medium is provided, in which a computer program is stored, wherein the computer program is configured to execute the steps of any of the above-mentioned device embodiments when running.

[0029] Through the embodiments of the present invention, it is determined that the server has been restarted; the priority distribution information of the device set associated with the server is obtained, wherein the device set includes multiple devices, and the priority distribution information is used to describe the priority level of each device; based on the priority distribution information, multiple devices in the device set are connected in stages, and multiple devices hung under the server are connected in stages. Device sets of different priorities are connected in each stage, so that the number of request connections responded to by the server can be maintained within the safe range that the server resources can bear, which solves the technical problem of excessive instantaneous pressure on the server after the update in the related art, alleviates the instantaneous pressure on the server, and improves the stability of the server. BRIEF DESCRIPTION OF THE DRAWINGS

[0030] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of this application. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings:

[0031] Figure 1 is a hardware structure block diagram of a server according to an embodiment of the present invention;

[0032] Figure 2 is a flow chart of a method for connecting to a server according to an embodiment of the present invention;

[0033] Figure 3 is a flow chart of a server connecting to devices according to priority in an embodiment of the present invention;

[0034] Figure 4 It is a structural block diagram of a server according to an embodiment of the present invention. DETAILED DESCRIPTION

[0035] In order to enable those skilled in the art to better understand the present application, the technical solutions 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 the field without creative work should fall within the scope of protection of the present application. It should be noted that the embodiments in the present application and the features in the embodiments can be combined with each other without conflict.

[0036] 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 sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, 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.

[0037] Example 1

[0038] The method embodiment provided in the first embodiment of the present application can be executed in a server, a controller or a similar device management device. Taking running on a server as an example, Figure 1 FIG. 1 is a hardware structure diagram of a server according to an embodiment of the present invention. Figure 1As shown, the server may include one or more ( Figure 1 Only one is shown in the figure) a processor 102 (the processor 102 may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA) and a memory 104 for storing data. Optionally, the server may also include a transmission device 106 and an input / output device 108 for communication functions. It can be understood by those skilled in the art that Figure 1 The structure shown is only for illustration and does not limit the structure of the above server. Figure 1 More or fewer components as shown, or with Figure 1 Different configurations shown.

[0039] The memory 104 can be used to store server programs, for example, software programs and modules of application software, such as a server program corresponding to a method for connecting a server in an embodiment of the present invention. The processor 102 executes various functional applications and data processing by running the server program stored in the memory 104, that is, to implement the above method. The memory 104 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 104 may further include a memory remotely arranged relative to the processor 102, and these remote memories may be connected to the server via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0040] The transmission device 106 is used to receive or send data via a network. The specific example of the above network may include a wireless network provided by a communication provider of the server. In one example, the transmission device 106 includes a network adapter (Network Interface Controller, referred to as NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission device 106 can be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.

[0041] In this embodiment, a method for connecting to a server is provided. Figure 2 is a flow chart of a method for connecting to a server according to an embodiment of the present invention. Figure 2 As shown, the process includes the following steps:

[0042] Step S202, determining that the server has been restarted;

[0043] The server of this embodiment can be various types of network servers, such as a cloud server of the Internet of Things. The server and the device are connected based on a communication protocol, which can be a protocol such as MQTT (Message Queuing Telemetry Transport).

[0044] Step S204, obtaining priority distribution information of a device set associated with the server, wherein the device set includes a plurality of devices, and the priority distribution information is used to describe a priority level of each device;

[0045] Optionally, the device is a terminal device, gateway device, management device, interrupt device, etc. that can be connected to the server. Terminal devices include refrigerators, air conditioners, sweeping robots, and smart speakers.

[0046] In this embodiment, the priority distribution information can be stored on the server in the form of a mapping table or a priority model. The mapping table stores the priority level of each device connected to the server. The priority level can be level one, level two, level three, etc., or can be expressed in the form of P0, P1, P2, etc.

[0047] Step S206, connecting multiple devices in the device set in stages based on the priority distribution information;

[0048] The higher the priority level, the more important the device is, and the higher in the order of connection it will be after the server update is completed and restarted.

[0049] Through the above steps, it is determined that the server has been restarted; the priority distribution information of the device set associated with the server is obtained, wherein the device set includes multiple devices, and the priority distribution information is used to describe the priority level of each device; based on the priority distribution information, multiple devices in the device set are connected in stages, and multiple devices hung under the server are connected in stages. Device sets of different priorities are connected in each stage, so that the number of request connections responded to by the server can be maintained within the safe range that the server resources can bear, which solves the technical problem of excessive instantaneous pressure on the server after the update in the related technology, alleviates the instantaneous pressure on the server, and improves the stability of the server.

[0050] In an implementation scenario of this embodiment, before determining that the server has been restarted, it also includes: before the server program starts a downtime update, obtaining the device attributes of each device in the device set; configuring the priority level of the corresponding device based on the device attributes, and notifying the device.

[0051] Optionally, device attributes may include but are not limited to the following attribute information: function type, usage frequency, user priority, etc. When configuring the priority level of the corresponding device, one or more types of attribute information may be selected for configuration.

[0052] In the implementation scenario of downtime update, by configuring the priority level of the device according to the device attributes before updating, after the server is updated and restarted, multiple devices in the device set can be connected in stages according to the importance of the device attributes, ensuring that important devices are connected to the server first.

[0053] In one example, configuring the priority level of the corresponding device based on the device attributes includes: parsing a function type of the first device based on the device attributes, wherein the function type includes a gateway function and a storage function; if the first device is a gateway device, configuring the first device to a first priority level; if the first device is a storage device, configuring the first device to a second priority level, wherein the first priority level is higher than the second priority level.

[0054] In this example, the device attributes are functional attributes or network attributes. A basic priority sequence model is established through the server. The functional types include gateway functions (directly connected devices) and storage functions (non-directly connected devices, sub-devices). Real-time devices and node-type devices have higher priority than storage devices, etc. For example, gateway devices have higher priority than sub-devices.

[0055] Generate a priority model: First, establish a basic priority sequence model through the server. For reference: important devices, real-time devices, and node devices have higher priority than storage devices, such as gateway devices have higher priority than sub-devices, etc.

[0056] By using the device's function type to configure the device's priority level, the gateway device's priority level is higher than the storage device. The gateway device plays a role in networking, protocol conversion and other functions in the IoT network. Only when the gateway device is connected can the storage device networked through the gateway device be further connected, which improves the success rate of device connection to the server and reduces invalid reconnections.

[0057] In another example, configuring the priority level of the corresponding device based on the device attributes includes: parsing the usage frequency of the second device based on the device attributes; determining whether the usage frequency is greater than a preset threshold; if the usage frequency is greater than the preset threshold, configuring the second device to a third priority level; if the usage frequency is less than or equal to the preset threshold, configuring the second device to a fourth priority level, wherein the third priority level is higher than the fourth priority level.

[0058] Optionally, the frequency of use of the second device can be calculated by weighting the device attributes such as time, geographic location, and device type. According to the actual use of the user, the device type, the frequency of use of the device, the time of use, and the geographic location of use are offset. For example, in summer, the demand for refrigeration equipment such as air conditioners is higher, and the frequency of use is relatively low in spring and autumn. In summer, air conditioners (such as relative floor heating) are used more frequently and have a higher priority level. The dimension of geographic location can also be considered at the same time. For example, in each city, it can be shown that the time of equipment in urban villages and suburbs is concentrated in non-working hours compared to commercial areas. In non-working hours, the weight of equipment in the suburbs is higher than that in commercial areas, and the frequency of use is higher. During working hours, the weight of equipment in the suburbs is lower than that in commercial areas, and the frequency of use is lower.

[0059] By configuring the priority level of the device according to the frequency of device use, the priority level of the device with high usage frequency is higher than that of the device with low usage frequency. Devices with high user usage frequency and high usage probability are connected first, which improves the utilization rate of server access devices and shortens the offline time of high-frequency used devices.

[0060] In another example, configuring the priority level of the corresponding device based on the device attributes includes: parsing the user priority of the user to which the third device belongs based on the device attributes; configuring the priority level of the third device based on the user priority, wherein the priority level is positively correlated with the user priority.

[0061] Optionally, by analyzing the user account of the device that logs in, the user priority can be personalized according to user habits, user type, etc. For example, the priority of users with paid accounts is higher than that of ordinary users, the priority of old users is higher than that of new users, the priority of users who purchase high-end devices with the same function is higher than that of users of low-end devices, and the priority of users who use devices frequently is higher than that of users who use devices less frequently, etc. The higher the user priority, the greater the impact on the user of whether the device is connected to the server.

[0062] You can also consider the priorities of multiple dimensions comprehensively. The priority strategy of the server is: function type > usage frequency > user priority. If the priority levels of different dimensions conflict, the priority dimension with the higher priority strategy will be given priority.

[0063] By configuring the priority level of the device using the user priority of the user to whom the device belongs, the priority level of the device with a higher user level is higher than that of the device with a lower user level. Devices that have a greater impact on the user are connected first, thus ensuring the user experience.

[0064] In another implementation scenario of this embodiment, before determining that the server has been restarted, it also includes: before the server program starts a rolling update, determining an update order of multiple microservices in the server program, wherein the server program includes the multiple microservices, and each microservice corresponds to a software function; determining a partition device corresponding to each microservice; configuring the priority level of each partition device according to the update order, and notifying the partition device.

[0065] Optionally, microservices also correspond to different priorities. For example, some microservices are pre-services of other microservices (such as microservice registration center, inspection center, etc.), which can detect the abnormality of the started microservices and respond to the corresponding processing strategy in the first time. When updating multiple microservices in the server program, each microservice will be updated in order of priority to ensure the robustness of the server. More important microservices will be updated first, that is, the update order is relatively early, and more important microservices will be restarted earlier.

[0066] In the scenario of rolling server updates, the server is divided into different blocks. It can be understood that the program that needs to be updated contains multiple microservices. These microservices also have a certain priority ranking, which is reflected in the update order. The devices with high microservice priority form a partition, that is, the partition device. After receiving the update notification, the device that depends on the partition can adjust its own connection strategy and give priority to the connection requests of devices requesting higher priority microservices. Devices with lower priority will be postponed or switched to backup servers or other partitions.

[0067] In one example, after the rolling update of the server program is completed, a server cluster proxies the request to the edge server through several central point servers, and then processes the request. High-priority microservices, such as the nginx proxy service in the centralized server, are called "centralized partitions". This part is updated and restarted first, and then the requests of the edge server (partition) are processed if there are excess resources.

[0068] By configuring the priority level of devices according to the update order of microservices in the rolling update scenario, the priority level of devices for important microservices that are updated first is higher than that of devices for microservices that are updated later. Partitioned devices for important microservices can be started and connected first, ensuring the robustness of the server.

[0069] In one implementation of the present embodiment, connecting multiple devices in the device set in stages based on the priority distribution information includes: selecting a first device set with a preset proportion in the device set in sequence based on the priority distribution information; sending a reconnection notification message to the first device set, and monitoring the real-time proportion value of successful connections in the first device set; and continuing to connect to a second device set in the device set based on the real-time proportion value, wherein the priority level of the devices in the second device set is lower than the priority level of the devices in the first device set.

[0070] In selecting the first device set with a preset ratio in sequence, in the initial first stage, the first device set with the highest priority is selected. The preset ratio (such as 50%) refers to the ratio of the number of first device sets to the total number of devices, so as to control the instantaneous pressure of the server in each stage. After the first device set is successfully connected, only devices with lower priority are left, and the second device set with lower priority can continue to be connected in the next stage. By connecting multiple devices in stages according to priority order, the resource pressure of the server is dispersed and the stability of the server is improved.

[0071] Optionally, continuing to connect to the second device set in the device set based on the real-time proportion value includes: determining whether the real-time proportion value reaches a preset proportion value; if the real-time proportion value reaches the preset proportion value, continuing to select the second device set in order in the device set based on the priority distribution information; and sending a reconnection notification message to the second device set.

[0072] After the server is updated, the devices at different levels are reconnected in a certain proportion according to the priority model level generated previously. And after being connected for a period of time, the priority of the device is dynamically adjusted (that is, after the proportion of reconnection of the first-priority device exceeds XX%, some devices of the second-priority level can continue to be connected in the next stage. For example, important devices, real-time devices, etc. at the first-level priority have been successfully connected for more than 80%, but at this time, the second-level devices have only been successfully connected for 30%. In this case, the priority of a certain time and a certain region can be raised to occupy a larger "reconnection" ratio).

[0073] A strategy for dynamically adjusting priorities based on actual conditions. For example, if the number of connections to the first device set at the first priority level (assuming it is a centralized device such as a gateway) exceeds a certain threshold, and does not affect the user's main usage experience, you can start connecting to some second device sets at the second priority level that are frequently used by some users (such as air conditioners or voice speakers in summer), and dynamically adjust the priority based on usage.

[0074] By adopting the solution of this embodiment, when the real-time ratio of successful connections at a high priority level reaches a preset ratio, the next stage of connection is initiated to connect to a second set of devices at a lower priority level, thereby ensuring the number of connections for high priority devices while sharing the pressure on the server.

[0075] In one implementation of the present embodiment, connecting multiple devices in the device set in stages based on the priority distribution information includes: selecting a third device set with a preset proportion in the device set in sequence based on the priority distribution information; sending a reconnection notification message to the third device set, and monitoring the remaining computing power resources of the server; and continuing to connect to a fourth device set in the device set based on the remaining computing power resources, wherein the priority level of the devices in the fourth device set is lower than the priority level of the devices in the third device set.

[0076] Optionally, the computing resources of the server include the utilization rate of resources such as CPU, GPU, and memory. The greater the remaining computing resources of the server, the more connections the server can process instantaneously, and the greater the pressure it can withstand.

[0077] After the server connects to the third set of devices, it starts to monitor the remaining computing resources of the server. If the remaining computing resources allow, it can start the next stage to continue connecting to the fourth set of devices with a lower priority. By connecting multiple devices in stages according to priority order, the resource pressure of the server is dispersed and the stability of the server is improved.

[0078] Optionally, continuing to connect to the fourth device set in the device set based on the remaining computing power resources includes: determining whether the remaining computing power resources are greater than a preset computing power value; if the remaining computing power resources are greater than the preset computing power value, continuing to select the fourth device set in order in the device set based on the priority distribution information; and sending a reconnection notification message to the fourth device set.

[0079] By managing server resources, during the device connection process, the remaining computing resources of the server can be monitored through the middleware. If the server resources are sufficient, or when processing devices with certain priorities, the device connection peak can be dynamically adjusted to form a scalable connection strategy. That is, assuming there are devices A and B, and device A has a higher priority, then during the connection process of device A, the server's strategy may be to ensure that A can connect successfully (such as QoS2 in the MQTT protocol), and device B only needs QoS 0 level during the connection process. In this case, device A will consume more resources than B during the connection process. After the priority is adjusted later, more connections can be opened when connecting a large number of devices B, maintaining the server resources in a high-performance state.

[0080] This implementation achieves flexible use of server computing resources. Assuming that the server resources used to connect to A are twice that of B, to ensure the stability of A's connection, after the A connection with a very high priority is completed, more resources can be freed up for B to use, that is, more connections are opened to ensure a peak value of the server.

[0081] By adopting the solution of this embodiment, when the remaining computing power resources of the server are greater than the preset computing power value, the server releases the computing power resources and starts the next stage of connection to connect to the fourth set of devices with a lower priority level, thereby improving the utilization rate of server resources and reducing the connection waiting time of low-priority devices.

[0082] Figure 3 It is a flow chart of the server connecting to devices according to priority in an embodiment of the present invention, including: before updating, obtaining user usage habits and server (microservice) update time, generating a secondary priority, and generating a primary priority in combination with device attributes such as device priority type. If the server is updated in a shutdown manner, notification is made in order of priority, and the priority strategy is dynamically adjusted according to the restart result (devices are notified in order of priority to reconnect); if it is a rolling update, partition notification is made according to the update speed of different microservices in the program, and finally after the update is completed, the partition sends an overall notification to tell all devices that the update has been completed.

[0083] Overall notification: After all priorities / partitions are updated, the server status update message is published via MQTT to inform all devices that the server update is complete.

[0084] By adopting the solution of this embodiment, when the server program is updated (divided into rolling updates and downtime updates), the priority of the devices that need to be reconnected is adjusted, and devices with high connection levels are prioritized at each stage to ensure the user experience. At the same time, the number of response request connections is maintained within the range that the server resources can bear, alleviating the instantaneous pressure on the server.

[0085] This embodiment implements a strategy for dynamically adjusting priorities based on data analysis, which can dynamically adjust the priorities of devices that need to be reconnected when the server program is restarted or updated, and preferentially connect to servers with high priorities when server resources are sufficient, thereby alleviating instantaneous pressure on the server and ensuring user usage needs.

[0086] Through the description of the above implementation methods, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus a necessary general hardware platform, and of course can also be implemented by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, a magnetic disk, or an optical disk), and includes a number of instructions for enabling a terminal device (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods described in each embodiment of the present invention.

[0087] Example 2

[0088] In the present embodiment, a server is also provided, and the device is used to implement the above-mentioned embodiment and preferred implementation mode, and the descriptions that have been made are not repeated. As used below, the term "module" can implement the combination of software and hardware of the reservation function. Although the device described in the following embodiments is preferably implemented in software, the implementation of hardware, or the combination of software and hardware, can also be conceived.

[0089] Figure 4 is a structural block diagram of a server according to an embodiment of the present invention, such as Figure 4 As shown, including:

[0090] A first determination module 40 is used to determine whether the server has been restarted;

[0091] A first acquisition module 42, configured to acquire priority distribution information of a device set associated with the server, wherein the device set includes a plurality of devices, and the priority distribution information is used to describe a priority level of each device;

[0092] The connection module 44 is configured to connect the plurality of devices in the device set in stages based on the priority distribution information.

[0093] Optionally, the device also includes: a second acquisition module, used to obtain the device attributes of each device in the device set before the determination module determines that the server has been restarted and before the server program starts a downtime update; a first configuration module, used to configure the priority level of the corresponding device based on the device attributes and notify the device.

[0094] Optionally, the first configuration module includes: a first parsing unit, used to parse the function type of the first device based on the device attributes, wherein the function type includes a gateway function and a storage function; a first configuration unit, used to configure the first device to a first priority level if the first device is a gateway device; if the first device is a storage device, configure the first device to a second priority level, wherein the first priority level is higher than the second priority level.

[0095] Optionally, the first configuration module includes: a second parsing unit, used to parse the usage frequency of the second device based on the device attributes; a judgment unit, used to judge whether the usage frequency is greater than a preset threshold; a second configuration unit, used to configure the second device to a third priority level if the usage frequency is greater than the preset threshold; if the usage frequency is less than or equal to the preset threshold, configure the second device to a fourth priority level, wherein the third priority level is higher than the fourth priority level.

[0096] Optionally, the first configuration module includes: a third parsing unit, used to parse the user priority of the user to which the third device belongs based on the device attributes; a third configuration unit, used to configure the priority level of the third device based on the user priority, wherein the priority level is positively correlated with the user priority.

[0097] Optionally, the device also includes: a second determination module, used to determine the update order of multiple microservices in the server program before the first determination module determines that the server has been restarted and before the server program starts rolling update, wherein the server program includes the multiple microservices, each microservice corresponds to a software function; a third determination module, used to determine the partition device corresponding to each microservice; a second configuration module, used to configure the priority level of each partition device according to the update order, and notify the partition device.

[0098] Optionally, the connection module includes: a first selection unit, used to select a first device set with a preset proportion in the device set in sequence based on the priority distribution information; a first connection unit, used to send a reconnection notification message to the first device set and monitor the real-time proportion value of successful connection in the first device set; a second connection unit, used to continue connecting to a second device set in the device set based on the real-time proportion value, wherein the priority level of the devices in the second device set is lower than the priority level of the devices in the first device set.

[0099] Optionally, the second connection unit includes: a judgment subunit, used to judge whether the real-time proportion value reaches a preset proportion value; a selection subunit, used to continue selecting a second device set in order from the device set based on the priority distribution information if the real-time proportion value reaches a preset proportion value; and a sending subunit, used to send a reconnection notification message to the second device set.

[0100] Optionally, the connection module includes: a second selection unit, used to select a third device set with a preset proportion in the device set in sequence based on the priority distribution information; a third connection unit, used to send a reconnection notification message to the third device set and listen to the remaining computing power resources of the server; and a fourth connection unit, used to continue connecting to a fourth device set in the device set based on the remaining computing power resources, wherein the priority level of the devices in the fourth device set is lower than the priority level of the devices in the third device set.

[0101] Optionally, the fourth connection unit includes: a judgment subunit, used to judge whether the remaining computing power resources are greater than a preset computing power value; a selection subunit, used to continue selecting a fourth device set in order from the device set based on the priority distribution information if the remaining computing power resources are greater than the preset computing power value; and a sending subunit, used to send a reconnection notification message to the fourth device set.

[0102] It should be noted that the above modules can be implemented by software or hardware. For the latter, it can be implemented in the following ways, but not limited to: the above modules are all located in the same processor; or the above modules are located in different processors in any combination.

[0103] Example 3

[0104] An embodiment of the present invention further provides a storage medium, in which a computer program is stored, wherein the computer program is configured to execute the steps of any of the above method embodiments when running.

[0105] Optionally, in this embodiment, the above storage medium may be configured to store a computer program for executing:

[0106] S1, confirm that the server has been restarted;

[0107] S2, obtaining priority distribution information of a device set associated with the server, wherein the device set includes a plurality of devices, and the priority distribution information is used to describe a priority level of each device;

[0108] S3, connecting multiple devices in the device set in stages based on the priority distribution information.

[0109] Optionally, in this embodiment, the above-mentioned storage medium may include but is not limited to: a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk, and other media that can store computer programs.

[0110] An embodiment of the present invention further provides an electronic device, including a memory and a processor, wherein a computer program is stored in the memory, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.

[0111] Optionally, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor, and the input / output device is connected to the processor.

[0112] Optionally, in this embodiment, the processor may be configured to perform the following steps through a computer program:

[0113] S1, confirm that the server has been restarted;

[0114] S2, obtaining priority distribution information of a device set associated with the server, wherein the device set includes a plurality of devices, and the priority distribution information is used to describe a priority level of each device;

[0115] S3, connecting multiple devices in the device set in stages based on the priority distribution information.

[0116] Optionally, the specific examples in this embodiment may refer to the examples described in the above embodiments and optional implementation modes, and this embodiment will not be described in detail here.

[0117] The serial numbers of the above-mentioned embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.

[0118] In the above embodiments of the present application, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, please refer to the relevant description of other embodiments.

[0119] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the device embodiments described above are only schematic, for example, the division of units is only a logical function division, and there may be other division methods in actual implementation, for example, 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 units or modules, which can be electrical or other forms.

[0120] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0121] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0122] 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 technical solution of the present application, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, a controller or a network device, etc.) to perform all or part of the steps of each embodiment method of the present application. The aforementioned storage medium includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, disk or optical disk, etc., various media that can store program codes.

[0123] The above are only preferred implementations of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.

Claims

1. A method for connecting to a server, characterized in that: include: Make sure the server has been restarted. Acquire priority distribution information of a device set associated with the server, wherein the device set includes a plurality of devices, and the priority distribution information is used to describe a priority level of each device; Multiple devices in the device set are connected in stages based on the priority distribution information.

2. The method according to claim 1, characterized in that: Before determining that the server has been restarted, the method further includes: Before the server program starts the downtime update, obtaining the device attributes of each device in the device set; The priority level of the corresponding device is configured based on the device attribute, and the device is notified.

3. The method according to claim 2, characterized in that Configuring the priority level of the corresponding device based on the device attributes includes: parsing a function type of the first device based on the device attribute, wherein the function type includes a gateway function and a storage function; If the first device is a gateway device, the first device is configured to a first priority level; if the first device is a storage device, the first device is configured to a second priority level, wherein the first priority level is higher than the second priority level.

4. The method according to claim 2, characterized in that: Configuring the priority level of the corresponding device based on the device attributes includes: parsing a usage frequency of the second device based on the device attribute; Determining whether the usage frequency is greater than a preset threshold; If the usage frequency is greater than a preset threshold, the second device is configured as a third priority level; if the usage frequency is less than or equal to the preset threshold, the second device is configured as a fourth priority level, wherein the third priority level is higher than the fourth priority level.

5. The method according to claim 2, characterized in that: Configuring the priority level of the corresponding device based on the device attributes includes: parsing the user priority of the user to which the third device belongs based on the device attribute; A priority level of the third device is configured based on the user priority, wherein the priority level is positively correlated with the user priority.

6. The method according to claim 1, characterized in that Before determining that the server has been restarted, the method further includes: Before the server program starts rolling update, determining an update order of multiple microservices in the server program, wherein the server program includes the multiple microservices, each microservice corresponding to a software function; Determine the partition device corresponding to each microservice; The priority level of each partition device is configured according to the update order, and the partition device is notified.

7. The method according to claim 1, characterized in that Connecting the plurality of devices in the device set in stages based on the priority distribution information includes: Selecting a first device set with a preset proportion in order from the device set based on the priority distribution information; Sending a reconnection notification message to the first device set, and monitoring a real-time ratio value of successful connections in the first device set; Continue to connect a second set of devices in the set of devices based on the real-time ratio value, wherein the priority level of the devices in the second set of devices is lower than the priority level of the devices in the first set of devices.

8. The method according to claim 7, characterized in that Continuing to connect the second set of devices in the set of devices based on the real-time ratio value includes: Determining whether the real-time ratio value reaches a preset ratio value; If the real-time ratio value reaches the preset ratio value, continue to select the second device set in the device set in order based on the priority distribution information; Send a reconnection notification message to the second device set.

9. The method according to claim 1, characterized in that: Connecting the plurality of devices in the device set in stages based on the priority distribution information includes: Selecting a third device set of a preset proportion in order from the device set based on the priority distribution information; Sending a reconnection notification message to the third device set, and monitoring the remaining computing resources of the server; A fourth device set in the device set continues to be connected based on the remaining computing resources, wherein a priority level of devices in the fourth device set is lower than a priority level of devices in the third device set.

10. The method according to claim 9, characterized in that Continuing to connect to a fourth device set in the device set based on the remaining computing power resources includes: Determine whether the remaining computing power resources are greater than a preset computing power value; If the remaining computing power resources are greater than the preset computing power value, continue to select a fourth device set in the device set in order based on the priority distribution information; Send a reconnection notification message to the fourth device set.

11. A server, characterized in that: include: A first determination module is used to determine whether the server has been restarted; A first acquisition module, configured to acquire priority distribution information of a device set associated with the server, wherein the device set includes a plurality of devices, and the priority distribution information is used to describe a priority level of each device; A connection module is used to connect multiple devices in the device set in stages based on the priority distribution information.

12. A storage medium, characterized in that: The storage medium stores a computer program, wherein the computer program is configured to execute the steps of the server connection method in any one of claims 1 to 10 when running.

13. An electronic device comprising a processor, a communication interface, a memory and a communication bus, wherein: The processor, the communication interface, and the memory communicate with each other via a communication bus; wherein: Memory, used to store computer programs; A processor, configured to execute the steps of the server connection method according to any one of claims 1 to 10 by running a program stored in a memory.

Citation Information

Patent Citations

  • AP (access point) device reconnecting method and device

    CN104113932A

  • Network equipment restarting method and device, electronic device and readable storage medium

    CN110851186A

  • Port starting method and device

    CN110995498A

  • Startup method and system of virtual machine and related device

    CN111273997A

  • Connection control device, wireless communication system, and connection control program

    JP2020113937A

Cited By

  • Network connection processing method and device, product, equipment and medium

    CN119906750A