A session creation method, device, server and storage medium
By sorting VNC node devices in ascending order and judging load rate, and responding to session creation requests, the problem of load imbalance between VNC node devices is solved, session number balancing and load balancing are achieved, and system downtime and resource idleness are avoided.
Patent Information
- Application Number
- CN202210965947.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-08-12
- Publication Date
- 2024-11-22
- Estimated Expiration
- 2042-08-12
AI Technical Summary
In the prior art, load imbalance between VNC node devices leads to abnormal behaviors such as system downtime.
By responding to the session creation request, the node devices are arranged in ascending order according to the number of sessions created by each node device, and the load rate is determined in turn whether the load rate is less than or equal to the preset threshold. If it is less than or equal to the request, it responds to the request; if the load rate is high, it judges the load rate Whether the smallest node device is less than or equal to the second preset threshold, and if it is less than, it responds; if it is all greater than the threshold, the request is rejected to achieve load balancing and avoid system downtime.
The number of sessions and load balancing between node devices is realized, which avoids system downtime and idle resources, and ensures the operation of node devices.
Smart Images

Figure CN115129478B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of network communications, and in particular to a session creation method, device, server and storage medium. Background Art
[0002] Virtual Networking Computing (VNC) is a display method on a computer that can transmit a complete window interface to another computer through a network. The user terminal establishes a VNC session with the server through a VNC client.
[0003] In the prior art, when a server receives a request to create a VNC session, it usually creates VNC sessions on each VNC node in turn in a round-robin manner; however, since each VNC session occupies different system resources and has a different session duration, too many VNC sessions are often created on one VNC node, which in turn causes the load rate of the VNC node to be too high, resulting in abnormal behaviors such as system crashes. Summary of the invention
[0004] The present invention provides a session creation method, device, server and storage medium to solve the problem of load imbalance between VNC node devices.
[0005] According to one aspect of the present invention, there is provided a session creation method, comprising:
[0006] In response to obtaining the session creation request, arranging the node devices in ascending order according to the number of sessions created by each node device;
[0007] Determining in sequence whether the load rate of each of the node devices is less than or equal to a first preset threshold;
[0008] If a first node device having a load rate less than or equal to a first preset threshold is obtained, the session creation request is responded to through the first node device.
[0009] After determining in sequence whether the load rate of each of the node devices is less than or equal to the first preset threshold, it also includes: if the load rate of each of the node devices is greater than the first preset threshold, determining whether the load rate of the second node device with the smallest load rate is less than or equal to the second preset threshold; wherein the second preset threshold is greater than the first preset threshold; if the load rate of the second node device is less than or equal to the second preset threshold, responding to the session creation request through the second node device; if the load rate of the second node device is greater than the second preset threshold, refusing to respond to the session creation request. When the load rate of the second node device with the lowest load rate is less than or equal to the second preset threshold, the second node device promptly responds to the session creation request, thereby achieving load balancing between the node devices; when the load rate of the second node device with the lowest load rate is greater than the second preset threshold, the session creation request is not responded to, thereby avoiding the risk of system downtime of the node device.
[0010] The step of sequentially judging whether the load rate of each node device is less than or equal to the first preset threshold value includes: obtaining the current first preset threshold value matching the current node device according to the number of sessions created by the current node device; and judging whether the load rate of the current node device is less than or equal to the current first preset threshold value. The first preset threshold value is dynamically obtained according to the number of sessions of each node device, that is, the first preset threshold value with different values is set for node devices with different numbers of sessions, which ensures timely response to the session creation request while avoiding the risk of system downtime of the node device.
[0011] If the load rates of the node devices are all greater than the first preset threshold, then determining whether the load rate of the second node device with the smallest load rate is less than or equal to the second preset threshold includes: if the load rates of the node devices are all greater than the first preset threshold, obtaining the predicted end time of the created session in each of the node devices; obtaining the load rate prediction curve of each of the node devices according to the predicted end time of each of the created sessions; sequentially determining whether there is a target time node in the load rate prediction curve of each of the node devices; wherein the time span from the target time node to the current moment is less than or equal to the first time threshold, the predicted load rates outside the time span are all less than or equal to the first preset threshold, and the predicted load rates within the time span are all less than or equal to the third preset threshold; the third preset threshold is greater than the first preset threshold and less than the second preset threshold; if a third node device with a target time node is obtained, responding to the session creation request through the third node device; if there is no target time node in the load rate prediction curve of each of the node devices, determining whether the load rate of the second node device with the smallest load rate is less than or equal to the second preset threshold. By having a node device that is about to release a large amount of system resources respond to the session creation request, the system resources of the current node device are effectively utilized, and the risk of system downtime of other node devices after allocation to other node devices is avoided, thereby ensuring load balancing between node devices.
[0012] The method of obtaining the load rate prediction curve of each node device according to the predicted end time of each created session includes: obtaining the predicted resource occupancy of the created session in each node device; and obtaining the load rate prediction curve of each node device according to the predicted end time and predicted resource occupancy of each created session. Compared with using the resource occupancy of the created session at the current moment, the predicted resource occupancy reflects the future resource occupancy trend of each created session. Therefore, by predicting the end time and predicted resource occupancy, the future load rate change trend of each node device is accurately predicted, further improving the load balancing between node devices.
[0013] The method of obtaining the load rate prediction curve of each node device according to the predicted end time and predicted resource occupancy of each created session includes: obtaining the predicted end time and predicted resource occupancy of the session to be created corresponding to the session creation request; obtaining the load rate prediction curve of each node device according to the predicted end time and predicted resource occupancy of each created session and the predicted end time and predicted resource occupancy of the session to be created. By pre-inserting the session to be created into each node device, the load rate prediction curve of each node device after the new session is inserted is obtained, which reflects the load rate change trend of each node device after the new session is inserted, avoiding the sudden change of the load rate of the node device due to the excessive resource occupancy of the session to be created, thereby ensuring the safe operation of the node device.
[0014] According to another aspect of the present invention, there is provided a session creation device, comprising:
[0015] An ascending order execution module, configured to, in response to obtaining a session creation request, arrange each of the node devices in ascending order according to the number of sessions created by each of the node devices;
[0016] A first load rate determination module, used to sequentially determine whether the load rate of each of the node devices is less than or equal to a first preset threshold;
[0017] The first response execution module is used to respond to the session creation request through the first node device if a first node device with a load rate less than or equal to a first preset threshold is obtained.
[0018] According to another aspect of the present invention, a server is provided, the server comprising:
[0019] at least one processor; and
[0020] a memory communicatively connected to the at least one processor; wherein,
[0021] The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the session creation method described in any embodiment of the present invention.
[0022] According to another aspect of the present invention, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the session creation method described in any embodiment of the present invention when executed.
[0023] The technical solution of the embodiment of the present invention, in response to obtaining a session creation request, arranges each node device in ascending order according to the number of sessions already created by each node device, and judges in turn whether the load rate of each node device is less than or equal to a first preset threshold value; if a first node device whose load rate is less than or equal to the first preset threshold value is obtained, the first node device responds to the session creation request, thereby achieving a balance in the number of sessions and a balance in the load between the node devices, thereby avoiding both system downtime in the node device and idleness of system resources in the node device.
[0024] It should be understood that the contents described in this section are not intended to identify the key or important features of the embodiments of the present invention, nor are they intended to limit the scope of the present invention. Other features of the present invention will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0026] Figure 1 is a flow chart of a session creation method provided in Embodiment 1 of the present invention;
[0027] Figure 2A is a flow chart of a session creation method provided by Embodiment 2 of the present invention;
[0028] Figure 2B is a schematic diagram of a load rate prediction curve provided by Embodiment 2 of the present invention;
[0029] Figure 3 is a flow chart of a session creation method provided by Embodiment 3 of the present invention;
[0030] Figure 4 is a flow chart of a session creation method provided by Embodiment 4 of the present invention;
[0031] Figure 5 It is a structural diagram of a session creation device provided in Embodiment 5 of the present invention;
[0032] Figure 6 It is a schematic diagram of the structure of a server that implements the session creation method according to an embodiment of the present invention. DETAILED DESCRIPTION
[0033] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.
[0034] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention 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 interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0035] Embodiment 1
[0036] Figure 1 This is a flow chart of a session creation method provided in the first embodiment of the present invention. This embodiment can be applied to respond to a session creation request according to the number of sessions created by each VNC node device and the load rate. The method can be executed by a session creation device, which can be implemented in the form of hardware and / or software, and can be configured in a server. Figure 1 As shown, the method includes:
[0037] S101 . In response to obtaining a session creation request, arrange the node devices in ascending order according to the number of sessions created by each node device.
[0038] A node device can be a server in a VNC server cluster or a session function component in a server. Each node device independently carries a certain number of VNC sessions and provides system resources required for the VNC sessions. Since the number of sessions created in each node device is different, the node devices are sorted in order from small to large according to the number of sessions created in each node device. In this way, new sessions are created preferentially in node devices that carry fewer sessions, ensuring that the number of sessions carried in each node device is relatively balanced, which is convenient for session management of each node device.
[0039] S102: Determine in turn whether the load rate of each of the node devices is less than or equal to a first preset threshold.
[0040] Since each VNC session transmits different interface content, the system resource usage of different sessions is also different, and the load rate of each node device is also different; the load rate of the node device with the least number of sessions is compared with the first preset threshold in turn; wherein the first preset threshold can be set as needed, usually set to a smaller value, for example, set to 50%, which means that when the load rate of the node device is less than or equal to the first preset threshold, the node device has no operating pressure, and the system resources can meet the load requirements of any newly created session, so the session creation request can be directly responded to in the node device to create a new session.
[0041] Optionally, in an embodiment of the present invention, the sequentially determining whether the load rate of each of the node devices is less than or equal to a first preset threshold value includes: obtaining a current first preset threshold value that matches the current node device based on the number of sessions created by the current node device; and determining whether the load rate of the current node device is less than or equal to the current first preset threshold value.
[0042] Specifically, if the number of sessions created in the current node device is small, even if the system resources occupied by one or more sessions continue to increase during subsequent operation, resulting in an excessively high load rate of the node device, the system resource occupancy of each session can be limited by limiting the session speed, so as to ensure that the current session performs normal data transmission while reducing the load rate of the node device to a large extent. Therefore, for node devices with a small number of sessions, the first preset threshold can be set to a larger value, for example, set to 60%; that is, the load value of this type of node device (i.e., the node device with a small number of sessions) can still meet the load requirements of the newly created session when it is relatively large.
[0043] At the same time, if the current node device has a large number of sessions, when the system resources occupied by one or more sessions continue to increase during subsequent operation, resulting in an excessively high load rate for the node device, even if the system resource amount for each session is limited by limiting the session speed, the overall load rate of the node device is still high due to the large number of sessions, and there is still a risk of system downtime. Therefore, for node devices with a large number of sessions, the first preset threshold can be set to a smaller value, for example, 40%; that is, the load value of this type of node device (i.e., the node device with a large number of sessions) must be relatively small to meet the load requirements of the newly created session; thereby, the first preset threshold is dynamically acquired according to the number of sessions of each node device, that is, first preset thresholds with different values are set for node devices with different numbers of sessions, thereby ensuring a timely response to the session creation request and avoiding the risk of system downtime of the node device.
[0044] In particular, a value range can also be set for the above-mentioned dynamic first preset threshold. For example, greater than or equal to 40% and less than or equal to 60% can be set as the value range of the first preset threshold to avoid an excessively large first preset threshold causing an excessively high load rate of the node device, or an excessively small first preset threshold causing idle resources of the node device.
[0045] S103: If a first node device having a load rate less than or equal to a first preset threshold is obtained, respond to the session creation request through the first node device.
[0046] Since the load rate comparison of the node devices is performed in order from small to large based on the number of sessions, when the first node device with a load rate less than or equal to the first preset threshold is obtained, it can not only ensure that the first node device itself has no operating pressure, but also ensure that the first node device is the node device with the least number of sessions among all node devices with the ability to carry new sessions. Therefore, based on the above two evaluation factors, namely the number of sessions created and the load rate, the first node device is selected to respond to the session creation request.
[0047] Optionally, in an embodiment of the present invention, after determining in turn whether the load rate of each of the node devices is less than or equal to a first preset threshold, it also includes: if the load rate of each of the node devices is greater than the first preset threshold, determining whether the load rate of the second node device with the smallest load rate is less than or equal to a second preset threshold; wherein the second preset threshold is greater than the first preset threshold; if the load rate of the second node device is less than or equal to the second preset threshold, responding to the session creation request through the second node device; if the load rate of the second node device is greater than the second preset threshold, refusing to respond to the session creation request.
[0048] Specifically, if the load rates of all node devices are greater than the first preset threshold, it indicates that each node device has a certain operating load pressure. Therefore, in order to ensure a timely response to the session creation request, the second node device with the lowest load rate is obtained, and the load rate of the second node device is compared with the second preset threshold; wherein the second preset threshold can also be set as needed, usually set to a larger value, for example, set to 90%, which means that when the load rate of the node device is greater than or equal to the second preset threshold, the node device has a great risk of system downtime; thus, when the load rate of the second node device with the lowest load rate is less than or equal to the second preset threshold, the second node device responds to the session creation request in a timely manner, thereby achieving load balancing between the node devices; when the load rate of the second node device with the lowest load rate is greater than the second preset threshold, the session creation request is not responded to, thereby avoiding the risk of system downtime of the node device.
[0049] The technical solution of the embodiment of the present invention, in response to obtaining a session creation request, arranges each node device in ascending order according to the number of sessions already created by each node device, and judges in turn whether the load rate of each node device is less than or equal to a first preset threshold value; if a first node device whose load rate is less than or equal to the first preset threshold value is obtained, the first node device responds to the session creation request, thereby achieving a balance in the number of sessions and a balance in the load between the node devices, thereby avoiding both system downtime in the node device and idleness of system resources in the node device.
[0050] Embodiment 2
[0051] Figure 2A This is a flow chart of a session creation method provided in Embodiment 2 of the present invention. Based on the above embodiments, this embodiment draws a load rate prediction curve for each node device according to the predicted end time of the created session in each node device. Figure 2A As shown, the method includes:
[0052] S201. In response to obtaining a session creation request, the node devices are arranged in ascending order according to the number of sessions created by each node device; and S202 is executed.
[0053] S202. Determine in turn whether the load rate of each of the node devices is less than or equal to a first preset threshold; and execute S203.
[0054] S203. If the load rate of each of the node devices is greater than a first preset threshold, obtain the predicted end time of the created session in each of the node devices; and execute S204.
[0055] For each created session, according to the identity information of the session initiator, for example, the client identifier of the session initiator, the device identifier of the device where the client is located, or the IP address of the initiator, etc., the historical session records of each created session are obtained, and the historical average time or the historical maximum time is obtained according to the historical session records, and this is used as the first predicted time, and then the predicted end time of the created session is determined according to the first predicted time; at the same time, the second predicted time can also be obtained according to the current session record of the created session, for example, the job content (for example, text, image or video) of the current session and / or the authority level of the initiator (for example, member or non-member), and then the predicted end time of the created session is determined according to the second predicted time; matching weight values can also be set for the first predicted time and the second predicted time, respectively, and the product of the first predicted time and the corresponding weight value is taken as the sum of the product of the second predicted time and the corresponding weight value as the third predicted time, and the predicted end time is obtained according to the third predicted time.
[0056] S204. Obtain a load rate prediction curve of each of the node devices according to the predicted end time of each of the created sessions; and execute S205.
[0057] Through the above technical solution, the predicted end time of the created session has been obtained, and the resource occupation of the created session at each future moment is considered to be equal to the resource occupation at the current moment, that is, from the current moment to the predicted end time, the load rate occupied by each created session in the node device remains unchanged, and the sum of the load rates of all created sessions in a node device is the load rate of the node device; thus, it can be obtained as follows Figure 2B The load rate prediction curve of the node device shown reflects the change of the load rate of the current node device over time.
[0058] S205. Determine in turn whether there is a target time node in the load rate prediction curve of each node device; wherein, the time span from the target time node to the current moment is less than or equal to a first time threshold, the predicted load rates outside the time span are less than or equal to the first preset threshold, and the predicted load rates within the time span are less than or equal to a third preset threshold; the third preset threshold is greater than the first preset threshold and less than the second preset threshold; if so, execute S206; if not, execute S207.
[0059] If there is a target time node in the load variation prediction curve of the current node device, it indicates that although the load rate of the current node device may be high (i.e., the third preset threshold is greater than the first preset threshold), the duration of the high load rate is short (i.e., the time span is less than or equal to the first time threshold). After the target time node, with the end of one or more sessions, a large amount of system resources will be released, so that the load rate of the node device is reduced to a lower value (i.e., the predicted load rates outside the time span are all less than or equal to the first preset threshold). At the same time, the current node device has not reached the critical threshold that may cause the system to crash at any time (i.e., less than the second preset threshold), so the current node device still has load space to continue to create new sessions; in particular, since the third preset threshold is less than the second preset threshold, the current node device itself retains a certain load space (i.e., the difference between the second preset threshold and the third preset threshold). Even if no session ends after the target time node in actual operation, the risk of system crash of the node device can still be avoided.
[0060] S206: If a third node device having a target time node is obtained, respond to the session creation request through the third node device.
[0061] As described in the above technical solution, if a third node device with a target time node is obtained, it is obvious that there is load space for creating a new session in the third node device, so the third node device responds to the session creation request and creates a corresponding new session.
[0062] S207. If there is no target time node in the load rate prediction curve of each of the node devices, determine whether the load rate of the second node device with the smallest load rate is less than or equal to a second preset threshold; if so, execute S208; if not, execute S209.
[0063] S208: If the load rate of the second node device is less than or equal to a second preset threshold, respond to the session creation request through the second node device.
[0064] S209: If the load rate of the second node device is greater than a second preset threshold, refuse to respond to the session creation request.
[0065] The technical solution of the embodiment of the present invention obtains the load rate prediction curve of each node device according to the predicted end time of the created session in each node device, and then determines whether there is a target time node in the load rate prediction curve of each node device, so as to respond to the session creation request through the third node device corresponding to the target time node, so that the session creation request is responded to by a node device that is about to release a large amount of system resources, which not only effectively utilizes the system resources of the current node device, but also avoids the risk of system downtime of other node devices after allocation to other node devices, thereby ensuring load balancing between node devices.
[0066] Embodiment 3
[0067] Figure 3 This is a flow chart of a session creation method provided in Embodiment 3 of the present invention. This embodiment is specific based on the above technical solution. In this embodiment of the present invention, a load rate prediction curve of each node device is drawn according to the predicted end time and predicted resource occupancy of each created session. Figure 3 As shown, the method includes:
[0068] S301. In response to obtaining a session creation request, the node devices are arranged in ascending order according to the number of sessions that have been created by each node device; and S302 is executed.
[0069] S302. Determine in turn whether the load rate of each of the node devices is less than or equal to a first preset threshold; and execute S303.
[0070] S303. If the load rate of each of the node devices is greater than a first preset threshold, obtain the predicted end time and predicted resource occupancy of the created session in each of the node devices; and execute S304.
[0071] In the above technical solution, the resource occupancy of the created session at each future moment is considered to be equal to the resource occupancy at the current moment; however, during actual operation, each created session may increase or decrease the occupied system resources as the job content continues to change, thereby causing the load rate of the node device to increase or decrease; therefore, for the created session, the historical session records of each created session can be obtained based on the identity information of the session initiator, and the historical average resource occupancy and the historical maximum resource occupancy can be obtained based on the historical session records, and this can be used as the first predicted resource occupancy of the created session; at the same time, the average resource occupancy and the maximum resource occupancy of the current session can also be obtained based on the current session record of the created session, and this can be used as the second predicted resource occupancy of the created session; weight values can also be set for the first predicted resource occupancy and the second predicted resource occupancy respectively, and the product of the first predicted resource occupancy and the corresponding weight value and the sum of the product of the second predicted resource occupancy and the corresponding weight value can be used as the third predicted resource occupancy.
[0072] S304. Obtain a load rate prediction curve of each of the node devices according to the predicted end time and predicted resource occupancy of each of the created sessions; and execute S305.
[0073] The above-mentioned predicted resource occupancy (i.e., the first predicted resource occupancy, the second predicted resource occupancy or the third predicted resource occupancy) is used as the resource occupancy at each future moment, that is, from the current moment to the predicted end time, the load rate occupied by each created session in the node device remains unchanged; and the sum of the load rates of all created sessions in the node device is the load rate of the node device.
[0074] S305. Determine in turn whether there is a target time node in the load rate prediction curve of each node device; wherein, the time span from the target time node to the current moment is less than or equal to the first time threshold, the predicted load rates outside the time span are all less than or equal to the first preset threshold, and the predicted load rates within the time span are all less than or equal to the third preset threshold; the third preset threshold is greater than the first preset threshold and less than the second preset threshold; if so, execute S306; if not, execute S307.
[0075] S306: If a third node device having a target time node is obtained, respond to the session creation request through the third node device.
[0076] S307. If there is no target time node in the load rate prediction curve of each of the node devices, determine whether the load rate of the second node device with the smallest load rate is less than or equal to the second preset threshold; if so, execute S308; if not, execute S309.
[0077] S308: If the load rate of the second node device is less than or equal to a second preset threshold, respond to the session creation request through the second node device.
[0078] S309: If the load rate of the second node device is greater than a second preset threshold, refuse to respond to the session creation request.
[0079] The technical solution of the embodiment of the present invention obtains the load rate prediction curve of each node device according to the predicted end time and predicted resource occupancy of the created session in each node device. Compared with using the resource occupancy of the created session at the current moment, the predicted resource occupancy reflects the future resource occupancy trend of each created session. Therefore, the future load rate change trend of each node device is accurately predicted by the predicted end time and predicted resource occupancy, further improving the load balancing between the node devices.
[0080] Embodiment 4
[0081] Figure 4 The flowchart of a session creation method provided in the fourth embodiment of the present invention is specific based on the above technical solution. In the embodiment of the present invention, the load rate prediction curve of each node device is jointly drawn according to the predicted end time and predicted resource occupancy of each created session, as well as the predicted end time and predicted resource occupancy of the session to be created. Figure 4 As shown, the method includes:
[0082] S401. In response to obtaining a session creation request, the node devices are arranged in ascending order according to the number of sessions created by each node device; and S402 is executed.
[0083] S402. Determine in turn whether the load rate of each of the node devices is less than or equal to a first preset threshold; and execute S403.
[0084] S403. If the load rate of each of the node devices is greater than a first preset threshold, obtain the predicted end time of the created session in each of the node devices, the predicted resource occupancy of the created session in each of the node devices, and the predicted end time and predicted resource occupancy of the session to be created corresponding to the session creation request; execute S404.
[0085] In the above technical scheme, although the predicted end time and predicted resource occupancy of the created session are obtained, and thus based on the currently created session of the node device, it can be predicted that the future load rate of a certain node device will be low, since the predicted resource occupancy and predicted end time of the session to be created are not obtained, if the above new session is inserted into the node device, it may cause a sudden load rate change (for example, a surge) in the node device; therefore, for the session to be created, it is also possible to obtain historical session records based on the identity information of the session initiator, and obtain the historical average time or the historical maximum time, as well as the historical average resource occupancy or the historical maximum resource occupancy based on the historical session records, and use this as the predicted time and predicted resource occupancy of the session to be created.
[0086] S404. Obtain a load rate prediction curve of each of the node devices according to the predicted end time and predicted resource occupancy of each of the created sessions, and the predicted end time and predicted resource occupancy of the session to be created; and execute S405.
[0087] The session to be created is pre-inserted into each node device, thereby obtaining a load rate prediction curve of each node device after the session to be created is inserted.
[0088] S405. Determine in turn whether there is a target time node in the load rate prediction curve of each node device; wherein, the time span from the target time node to the current moment is less than or equal to a first time threshold, the predicted load rates outside the time span are all less than or equal to the first preset threshold, and the predicted load rates within the time span are all less than or equal to a third preset threshold; the third preset threshold is greater than the first preset threshold and less than the second preset threshold; if so, execute S406; if not, execute S407.
[0089] S406: If a third node device having a target time node is obtained, respond to the session creation request through the third node device.
[0090] S407. If there is no target time node in the load rate prediction curve of each of the node devices, determine whether the load rate of the second node device with the smallest load rate is less than or equal to a second preset threshold; if so, execute S408; if not, execute S409.
[0091] S408: If the load rate of the second node device is less than or equal to a second preset threshold, respond to the session creation request through the second node device.
[0092] S409: If the load rate of the second node device is greater than a second preset threshold, refuse to respond to the session creation request.
[0093] The technical solution of the embodiment of the present invention jointly draws the load rate prediction curve of each node device according to the predicted end time and predicted resource occupancy of the created session in each node device, as well as the predicted end time and predicted resource occupancy of the session to be created. By pre-inserting the session to be created into each node device, the load rate prediction curve of each node device after the new session is inserted is obtained, which reflects the load rate change trend of each node device after the new session is inserted, avoids the load rate surge of the node device due to the high resource occupancy of the session to be created, thereby ensuring the safe operation of the node device.
[0094] Embodiment 5
[0095] Figure 5 This is a schematic diagram of the structure of a session creation device provided in Embodiment 5 of the present invention. Figure 5 As shown, the device comprises:
[0096] An ascending order execution module 501 is used to, in response to obtaining a session creation request, arrange the node devices in ascending order according to the number of sessions created by each node device;
[0097] A first load rate determination module 502, configured to sequentially determine whether the load rate of each of the node devices is less than or equal to a first preset threshold;
[0098] The first response execution module 503 is configured to respond to the session creation request through the first node device if a first node device having a load rate less than or equal to a first preset threshold is obtained.
[0099] The technical solution of the embodiment of the present invention, in response to obtaining a session creation request, arranges each node device in ascending order according to the number of sessions already created by each node device, and judges in turn whether the load rate of each node device is less than or equal to a first preset threshold value; if a first node device whose load rate is less than or equal to the first preset threshold value is obtained, the first node device responds to the session creation request, thereby achieving a balance in the number of sessions and a balance in the load between the node devices, thereby avoiding both system downtime in the node device and idleness of system resources in the node device.
[0100] Optionally, the session creation device further includes:
[0101] A second load rate judgment module, configured to judge whether the load rate of the second node device with the smallest load rate is less than or equal to a second preset threshold value if the load rate of each of the node devices is greater than the first preset threshold value; wherein the second preset threshold value is greater than the first preset threshold value;
[0102] The second response execution module is used to respond to the session creation request through the second node device if the load rate of the second node device is less than or equal to a second preset threshold.
[0103] Optionally, the session creation device further includes:
[0104] The rejection response execution module is used to reject the response to the session creation request if the load rate of the second node device is greater than a second preset threshold.
[0105] Optionally, the first load rate judgment module 502 is specifically used to obtain a current first preset threshold matching the current node device according to the number of sessions created by the current node device; and judge whether the load rate of the current node device is less than or equal to the current first preset threshold.
[0106] Optionally, the second load rate determination module specifically includes:
[0107] A predicted end time acquisition unit, configured to acquire the predicted end time of the created session in each of the node devices if the load rate of each of the node devices is greater than a first preset threshold;
[0108] A curve drawing unit, used for obtaining a load rate prediction curve of each of the node devices according to the predicted end time of each of the created sessions;
[0109] A target time node judgment unit is used to judge in turn whether there is a target time node in the load rate prediction curve of each node device; wherein the time span from the target time node to the current moment is less than or equal to a first time threshold, the predicted load rates outside the time span are less than or equal to the first preset threshold, and the predicted load rates within the time span are less than or equal to a third preset threshold; the third preset threshold is greater than the first preset threshold and less than the second preset threshold;
[0110] a response execution unit, configured to respond to the session creation request through the third node device if a third node device having a target time node is obtained;
[0111] The load rate judgment unit is used to judge whether the load rate of the second node device with the smallest load rate is less than or equal to a second preset threshold value if there is no target time node in the load rate prediction curve of each of the node devices.
[0112] Optionally, the curve drawing unit is specifically used to obtain the predicted resource occupancy of the created sessions in each of the node devices; and obtain the load rate prediction curve of each of the node devices according to the predicted end time and predicted resource occupancy of each of the created sessions.
[0113] Optionally, the curve drawing unit is further used to obtain the predicted end time and predicted resource occupancy of the session to be created corresponding to the session creation request; and obtain the load rate prediction curve of each of the node devices according to the predicted end time and predicted resource occupancy of each of the created sessions, as well as the predicted end time and predicted resource occupancy of the session to be created.
[0114] The session creation device provided in the embodiment of the present invention can execute the session creation method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.
[0115] Embodiment 6
[0116] Figure 6 A schematic diagram of a server 10 that can be used to implement an embodiment of the present invention is shown. The server is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The server may also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices (such as helmets, glasses, watches, etc.), and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or required herein.
[0117] like Figure 6 As shown, the server 10 includes at least one processor 11, and a memory connected to the at least one processor 11, such as a read-only memory (ROM) 12, a random access memory (RAM) 13, etc., wherein the memory stores a computer program that can be executed by at least one processor, and the processor 11 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 12 or the computer program loaded from the storage unit 18 to the random access memory (RAM) 13. In the RAM 13, various programs and data required for the operation of the server 10 can also be stored. The processor 11, the ROM 12, and the RAM 13 are connected to each other through a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.
[0118] A number of components in the server 10 are connected to the I / O interface 15, including: an input unit 16, such as a keyboard, a mouse, etc.; an output unit 17, such as various types of displays, speakers, etc.; a storage unit 18, such as a disk, an optical disk, etc.; and a communication unit 19, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 19 allows the server 10 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0119] The processor 11 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The processor 11 executes the various methods and processes described above, such as a session creation method.
[0120] In some embodiments, the session creation method may be implemented as a computer program, which is tangibly contained in a computer-readable storage medium, such as a storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or installed on the server 10 via the ROM 12 and / or the communication unit 19. When the computer program is loaded into the RAM 13 and executed by the processor 11, one or more steps of the session creation method described above may be performed. Alternatively, in other embodiments, the processor 11 may be configured to execute the session creation method in any other appropriate manner (e.g., by means of firmware).
[0121] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0122] Computer programs for implementing the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that when the computer program is executed by the processor, the functions / operations specified in the flow chart and / or block diagram are implemented. The computer program may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.
[0123] In the context of the present invention, a computer-readable storage medium may be a tangible medium that may contain or store a computer program for use by or in combination with an instruction execution system, device or equipment. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or equipment, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0124] To provide interaction with a user, the systems and techniques described herein may be implemented on a server having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the server. Other types of devices may also be used to provide interaction with the user; for example, the feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form (including acoustic input, voice input, or tactile input).
[0125] The systems and techniques described herein may be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.
[0126] A computing system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The client and server relationship is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services.
[0127] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps described in the present invention can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solution of the present invention can be achieved, and this document does not limit this.
[0128] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
Claims
1. A session creation method, characterized in that: include: In response to obtaining the session creation request, arranging the node devices in ascending order according to the number of sessions created by each node device; Determining in sequence whether the load rate of each of the node devices is less than or equal to a first preset threshold; If a first node device whose load rate is less than or equal to the first preset threshold is obtained, responding to the session creation request through the first node device; After determining in sequence whether the load rate of each of the node devices is less than or equal to a first preset threshold, the method further includes: If the load rate of each of the node devices is greater than the first preset threshold, determining whether the load rate of the second node device with the smallest load rate is less than or equal to the second preset threshold; wherein the second preset threshold is greater than the first preset threshold; If the load rate of the second node device is less than or equal to a second preset threshold, responding to the session creation request through the second node device; If the load rates of the node devices are all greater than the first preset threshold, determining whether the load rate of the second node device with the smallest load rate is less than or equal to the second preset threshold includes: If the load rate of each of the node devices is greater than the first preset threshold, obtaining the predicted end time of the created session in each of the node devices; Obtaining a load rate prediction curve of each of the node devices according to the predicted end time of each of the created sessions; Determine in sequence whether there is a target time node in the load rate prediction curve of each node device; wherein the time span from the target time node to the current time is less than or equal to a first time threshold, the predicted load rates outside the time span are less than or equal to the first preset threshold, and the predicted load rates within the time span are less than or equal to a third preset threshold; the third preset threshold is greater than the first preset threshold and less than the second preset threshold; If a third node device having the target time node is obtained, responding to the session creation request through the third node device; If the target time node does not exist in the load rate prediction curve of each of the node devices, it is determined whether the load rate of the second node device with the smallest load rate is less than or equal to a second preset threshold.
2. The method according to claim 1, characterized in that: After determining whether the load rate of the second node device with the smallest load rate is less than or equal to a second preset threshold, the method further includes: If the load rate of the second node device is greater than a second preset threshold, the session creation request is rejected.
3. The method according to claim 1, characterized in that The step of sequentially determining whether the load rate of each of the node devices is less than or equal to a first preset threshold comprises: According to the number of sessions created by the current node device, obtaining a current first preset threshold matching the current node device; Determine whether the load rate of the current node device is less than or equal to the current first preset threshold.
4. The method according to claim 1, characterized in that: The acquiring, according to the predicted end time of each created session, a load rate prediction curve of each node device, comprises: Obtaining the predicted resource occupancy of the created sessions in each of the node devices; According to the predicted end time and predicted resource occupancy of each created session, a load rate prediction curve of each node device is obtained.
5. The method according to claim 4, characterized in that The step of obtaining a load rate prediction curve of each node device according to the predicted end time and the predicted resource occupancy of each created session includes: Obtaining a predicted end time and a predicted resource occupancy of a session to be created corresponding to the session creation request; A load rate prediction curve of each of the node devices is obtained according to the predicted end time and the predicted resource occupancy of each of the created sessions, and the predicted end time and the predicted resource occupancy of the session to be created.
6. A session creation device, characterized in that: include: An ascending order execution module, configured to, in response to obtaining a session creation request, arrange each of the node devices in ascending order according to the number of sessions created by each of the node devices; A first load rate determination module, used to sequentially determine whether the load rate of each of the node devices is less than or equal to a first preset threshold; A first response execution module, configured to respond to the session creation request through the first node device if a first node device with a load rate less than or equal to a first preset threshold is obtained; The session creation device further includes: A second load rate judgment module, configured to judge whether the load rate of a second node device with the smallest load rate is less than or equal to a second preset threshold value if the load rates of the node devices are all greater than the first preset threshold value; Wherein, the second preset threshold is greater than the first preset threshold; A second response execution module, configured to respond to the session creation request through the second node device if the load rate of the second node device is less than or equal to a second preset threshold; The second load rate determination module specifically includes: A predicted end time acquisition unit, configured to acquire the predicted end time of the created session in each of the node devices if the load rate of each of the node devices is greater than a first preset threshold; A curve drawing unit, used for obtaining a load rate prediction curve of each of the node devices according to the predicted end time of each of the created sessions; A target time node determination unit, used to sequentially determine whether there is a target time node in the load rate prediction curve of each of the node devices; The time span between the target time node and the current time is less than or equal to a first time threshold, the predicted load rates outside the time span are less than or equal to the first preset threshold, and the predicted load rates within the time span are less than or equal to a third preset threshold; The third preset threshold is greater than the first preset threshold and less than the second preset threshold; a response execution unit, configured to respond to the session creation request through the third node device if a third node device having a target time node is obtained; The load rate judgment unit is used to judge whether the load rate of the second node device with the smallest load rate is less than or equal to a second preset threshold value if there is no target time node in the load rate prediction curve of each of the node devices.
7. A server, characterized in that: The server comprises: at least one processor; and a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the session creation method according to any one of claims 1 to 5.
8. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the session creation method according to any one of claims 1 to 5 when executed.
