Resource allocation method, device, server and computer-readable storage medium

By monitoring the server network traffic and preset resource traffic relationship in real time, and dynamically adjusting the resource size, the problem of insufficient or waste of resource allocation in the existing technology is solved, and efficient utilization of resources is achieved.

CN113467924BActive Publication Date: 2024-12-31BEIJING KINGSOFT CLOUD NETWORK TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202010247311.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-03-31
Publication Date
2024-12-31
Estimated Expiration
2040-03-31

AI Technical Summary

Technical Problem

When allocating server resources in the prior art, it is difficult to adapt to different concurrency situations of network requests, resulting in insufficient resources or waste.

Method used

By monitoring the network traffic of the server in real time, adjusting the resource size dynamically according to the preset resource traffic relationship, adjusting memory and thread resources according to the type and data volume of network requests, and storing data exceeding the resource requirements to the hard disk for processing.

Benefits of technology

It realizes dynamic allocation of resources, adapts to the needs of different concurrent numbers of network requests, improves the utilization rate of resources, and avoids resource waste.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113467924B_ABST
    Figure CN113467924B_ABST
Patent Text Reader

Abstract

The embodiment of the present invention provides a resource allocation method, device, server and computer-readable storage medium, which are applied to a server and relate to the field of cloud computing. The method includes: determining the real-time network traffic of the server, the real-time network traffic includes the data volume of the network request received by the network card of the server; allocating resources for processing the network request according to the data volume of the network request received by the network card of the server and the preset resource volume flow relationship, the resource volume flow relationship is determined according to the pre-stated network traffic and the resource size of the resources used by the network traffic. Applying the solution provided by the embodiment of the present invention to allocate resources can be applicable to the resource requirements of different concurrent situations of network requests.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of cloud computing, and in particular to a resource allocation method, device, server and computer-readable storage medium. Background Art

[0002] The server can provide various services to users. When receiving a network request from a user, the server can provide the user with the services requested by the user. In order to understand the situation of each user's request for services, the audit service provided by the server can parse the received network request, obtain various information related to the user's network request, and then make statistics on the obtained information.

[0003] In order to successfully obtain various information related to the user's network request, the server usually pre-allocates fixed resources for processing the user's network request.

[0004] For example, in actual applications, users may request database services. In order to understand the situation of each user requesting the database, after the server receives the network request, the database audit service provided by the server can use the above-mentioned fixed resources to parse the received network request, obtain information such as the requested operation type, and then count the number of network requests of each operation type.

[0005] However, since fixed resources are allocated in advance, when the number of concurrent network requests from users is large, the fixed resources may not be sufficient to process the concurrent network requests; and when the number of concurrent network requests from users is small, more of the fixed resources may be unused, resulting in resource waste. Therefore, when the fixed resource allocation method is used to allocate resources for processing user network requests, it is difficult to adapt to the resource requirements of different concurrent network requests. Summary of the invention

[0006] The purpose of the embodiments of the present invention is to provide a resource allocation method, device, server and computer-readable storage medium to meet the resource requirements of different concurrent network requests. The specific technical solution is as follows:

[0007] In a first aspect, an embodiment of the present invention provides a resource allocation method, which is applied to a server, and the method includes:

[0008] Determine the real-time network traffic of the server, wherein the real-time network traffic includes the data volume of the network request received by the network card of the server;

[0009] Resources for processing network requests are allocated based on the amount of data received by the network card of the server and a preset resource volume flow relationship, wherein the resource volume flow relationship is determined based on pre-stated network traffic and the resource size of resources used by the network traffic.

[0010] In one embodiment of the present invention, the above-mentioned allocating resources for processing network requests according to the data volume of the network request received by the network card of the server and the preset resource volume flow relationship includes:

[0011] Determine the relationship between the preset resource volume flow and the data volume of the network request received by the network card of the server, so as to determine a first resource size of resources required for processing the data volume of the network request received by the network card of the server;

[0012] Parsing the network request received by the network card of the server to obtain the network request type of the network request;

[0013] adjusting the first resource size according to the request type of the network request to obtain a second resource size;

[0014] The resource for processing the network request received by the network card of the server is allocated based on the second resource size.

[0015] In one embodiment of the present invention, the above-mentioned determining the relationship between the preset resource volume flow rate and the data volume of the network request received by the network card of the server to determine the first resource size of the resources required for processing the data volume of the network request received by the network card of the server includes:

[0016] Determine a resource volume flow relationship corresponding to the data volume of the network request according to the data volume of the network request received by the network card of the server and the preset resource volume flow relationship;

[0017] Based on the resource volume flow relationship corresponding to the data volume of the network request, a first resource size of resources required for processing the data volume of the network request is determined.

[0018] In one embodiment of the present invention, the adjusting the first resource size according to the request type of the network request to obtain the second resource size includes:

[0019] When the network request type is an intensive interface access request type, the size of the memory resource in the determined first resource size is reduced to obtain a second resource size.

[0020] In one embodiment of the present invention, the adjusting the first resource size according to the request type of the network request to obtain the second resource size includes:

[0021] When the network request type is an intensive computing resource access request type, the size of the computing resource in the first resource size is reduced to obtain a second resource size.

[0022] In one embodiment of the present invention, the parsing of the network request received by the network card of the server to obtain the network request type of the network request includes:

[0023] The first preset number of bytes of the first data packet of the network request received by the network card of the server are parsed to obtain the network request type of the network request.

[0024] In one embodiment of the present invention, the method further comprises:

[0025] When the resource size of the resources required by the data volume of the network request received by the network card of the server is greater than the allocated resource size, storing other data of the network request except the data that can be processed by the resources in the hard disk of the server;

[0026] When the allocated resources are in an idle state, other data of the network request stored in the hard disk of the server is processed.

[0027] In one embodiment of the present invention, the above resources include: memory resources and thread resources.

[0028] In a second aspect, an embodiment of the present invention provides a resource allocation device, applied to a server, the device comprising:

[0029] A traffic determination module, used to determine the real-time network traffic of the server, wherein the real-time network traffic includes the data volume of the network request received by the network card of the server;

[0030] The resource allocation module is used to allocate resources for processing network requests based on the data volume of the network requests received by the network card of the server and a preset resource volume flow relationship, wherein the resource volume flow relationship is determined based on pre-stated network traffic and the resource size of the resources used by the network traffic.

[0031] In one embodiment of the present invention, the resource allocation module includes:

[0032] A first resource determination submodule, configured to determine a relationship between the preset resource volume flow and the data volume of the network request received by the network card of the server, so as to determine a first resource size of resources required for processing the data volume of the network request received by the network card of the server;

[0033] A network request type parsing submodule, used to parse the network request received by the network card of the server to obtain the network request type of the network request;

[0034] a resource adjustment submodule, configured to adjust the first resource size according to the request type of the network request to obtain a second resource size;

[0035] The second resource determination submodule is used to allocate the resources for processing the network request received by the network card of the server based on the second resource size.

[0036] In one embodiment of the present invention, the first resource determination submodule is further configured to:

[0037] Determine a resource volume flow relationship corresponding to the data volume of the network request according to the data volume of the network request received by the network card of the server and the preset resource volume flow relationship;

[0038] Based on the resource volume flow relationship corresponding to the data volume of the network request, a first resource size of resources required for processing the data volume of the network request is determined.

[0039] In one embodiment of the present invention, the resource adjustment submodule is further used to:

[0040] When the network request type is an intensive interface access request type, the size of the memory resource in the determined first resource size is reduced to obtain a second resource size.

[0041] In one embodiment of the present invention, the resource adjustment submodule is further used to:

[0042] When the network request type is an intensive computing resource access request type, the size of the computing resource in the first resource size is reduced to obtain a second resource size.

[0043] In one embodiment of the present invention, the network request type parsing submodule is further used to:

[0044] The first preset number of bytes of the first data packet of the network request received by the network card of the server are parsed to obtain the network request type of the network request.

[0045] In one embodiment of the present invention, the above device further includes:

[0046] A data storage module, used for storing other data of the network request except the data that can be processed by the resource in the hard disk of the server when the resource size of the resource required by the data amount of the network request received by the network card of the server is greater than the allocated resource size;

[0047] The request processing module is used to process other data of the network request stored in the hard disk of the server when the allocated resources are in an idle state.

[0048] In one embodiment of the present invention, the above resources include: memory resources and thread resources.

[0049] In a third aspect, an embodiment of the present invention provides a server, 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;

[0050] Memory, used to store computer programs;

[0051] The processor is used to implement the method steps described in the first aspect when executing the program stored in the memory.

[0052] In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method steps described in the first aspect are implemented.

[0053] As can be seen from the above, when the solution provided by this embodiment is applied to allocate resources, since the real-time network traffic can characterize the amount of data of network requests received by the network card per unit time when the number of concurrent network requests is different, and the above-mentioned preset resource volume flow relationship reflects the relationship between the pre-stated network traffic and the resource size of the resources used by the network traffic. In this way, according to the amount of data of the network requests received by the server's network card and the preset resource volume flow relationship, resources are allocated according to the different amounts of data of the network requests to process the network requests, thereby realizing dynamic allocation of resources to process network requests with different concurrent numbers of requests. Compared with the prior art, it can be applicable to the situation where different concurrent numbers of network requests have resource requirements. BRIEF DESCRIPTION OF THE DRAWINGS

[0054] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. 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 paying creative work.

[0055] Figure 1 A schematic diagram of a flow chart of a first resource allocation method provided in an embodiment of the present invention;

[0056] Figure 2 A schematic diagram of a flow chart of a second resource allocation method provided in an embodiment of the present invention;

[0057] Figure 3 A schematic diagram of a flow chart of a third resource allocation method provided in an embodiment of the present invention;

[0058] Figure 4 A schematic diagram of the structure of a first resource allocation device provided by an embodiment of the present invention;

[0059] Figure 5 A schematic diagram of the structure of a second resource allocation device provided by an embodiment of the present invention;

[0060] Figure 6 A schematic diagram of the structure of a third resource allocation device provided by an embodiment of the present invention;

[0061] Figure 7 A schematic diagram of the structure of a server provided in an embodiment of the present invention; DETAILED DESCRIPTION

[0062] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions 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 are within the scope of protection of the present invention.

[0063] See also Figure 1 , Figure 1 This is a flow chart of a first resource allocation method provided in an embodiment of the present invention. The method includes S101-S102.

[0064] S101: Determine the real-time network traffic of the server.

[0065] The application scenario of the solution provided by the embodiment of the present invention may be: when the server provides services based on the received network request, the server allocates certain resources to the audit service, and the audit service uses the allocated resources to process the network request received by the server to obtain information about the network request.

[0066] For example, the audit service may be a database audit service, which is used to count the number of network requests of each network request type. The database audit service may count the number of network requests of different network request types received in the network card in a bypass detection manner.

[0067] In one embodiment of the present invention, the above-mentioned audit service and the database for providing service data may be deployed in the same resource pool.

[0068] The same resource pool may include storage resources, computing resources, etc. Specifically, when allocating resources, the server may allocate the resources in the resource pool to the audit service and the database in different proportions.

[0069] The real-time network traffic includes the data volume of network requests received by the network card of the server.

[0070] The network request is used to request a service. For example, the network request may be used to request an image display service or a video display service.

[0071] After the user sends a network request to the server through the client used by the user, the network card in the server receives the network request and caches the received network request.

[0072] The above-mentioned real-time network traffic can be used to characterize the data volume of the network request received by the network card in a unit time. When the real-time network traffic is large, it means that the data volume of the network request received by the network card in a unit time is large, and when the real-time network traffic is small, it means that the data volume of the network request received by the network card in a unit time is small. Therefore, the above-mentioned real-time network traffic can be obtained by statistics based on the data volume of the network request received by the network card.

[0073] Specifically, when obtaining the above-mentioned real-time network traffic, the amount of data of the network requests obtained by the network card within the preset time can be counted, the amount of data of the network requests received per unit time can be calculated, and the calculated value can be determined as the real-time network traffic. For example: the amount of data of the network requests obtained by the network card within 3 seconds is 9G, and the amount of data of the network requests received per second is calculated to be 9G / 3s=3G / s, and the calculated result is used as the real-time network traffic.

[0074] S102: Allocate resources for processing the network request according to the data volume of the network request received by the network card of the server and a preset resource volume and flow relationship.

[0075] The above resource volume flow relationship is determined based on the pre-stated network volume and the resource volume (or resource size) of the resources used by the network volume. The above-stated network volume includes the pre-collected data volume of network requests, and the above-stated network volume can be obtained by statistics based on the pre-collected data volume of network requests.

[0076] In one embodiment of the present invention, the above resources may include memory resources and thread resources.

[0077] Specifically, the thread resources are used to calculate data, and the amount of thread resources may include a preset number of threads, for example, 5 threads, 10 threads, and the like.

[0078] The memory resource is used to store data. The amount of the memory resource may include a preset size of memory, for example, the size of the memory resource may be 1G memory, 2G memory, etc.

[0079] Specifically, when the above resource volume-flow relationship is obtained, network requests may be collected in advance in a test environment, and then the pre-stated network flow may be calculated based on the data volume of the pre-collected network requests.

[0080] For example: the amount of data collected in advance for network requests is 1G, and the time to receive the network request is 1s. The amount of data obtained in the network request per unit time is calculated to be 1G / s, and the calculated value is used as the pre-statisticated network traffic of the network request as 1G / s. And the resource size of the resources used by the network traffic is obtained as 1G of memory resources and 5 threads of thread resources. In this way, the relationship between the pre-statisticated network traffic of 1G / s and the resource size of the resources used by the network traffic of 1G / s can be determined, that is, the above-mentioned resource volume flow relationship. The above-mentioned resource volume flow relationship can be represented in a tabular form, as shown in Table 1 below.

[0081] Table 1

[0082]

[0083] According to the above method, the preset resource quantity and flow relationship can be determined.

[0084] After obtaining the above resource flow relationship, the resource size of the resources used to process the network request can be directly determined according to the data volume of the network request received by the network card of the server, and the resources used to process the network request can be allocated according to the determined resource size.

[0085] For example, assuming that the resource size of the resources obtained for processing the obtained network request includes: the amount of memory resources and the amount of thread resources, the preset resource amount flow relationship is shown in Table 2.

[0086] Table 2

[0087]

[0088] It can be seen from Table 2 that when the pre-counted network traffic is 1G / s, the resource size of the resources used by the network traffic is: the amount of memory resources is 1G, and the amount of thread resources is 5 threads; when the pre-counted network traffic is 2G / s, the resource size of the resources used by the network traffic is: the amount of memory resources is 2G, and the amount of thread resources is 10 threads; when the pre-counted network traffic is 3G / s, the resource size of the resources used by the network traffic is: the amount of memory resources is 3G, and the amount of thread resources is 15 threads.

[0089] Assuming that the amount of data of the network request received by the server's network card within 1 second is 2G, then the real-time network traffic is 2G / s. According to the above Table 2, it can be determined that the resource size of the resources used to process the network request is: the amount of memory resources is 2G, and the amount of thread resources is 10 threads. The resources used to process the network request are allocated according to the determined amount of memory resources and thread resources.

[0090] As can be seen from the above, when the solution provided by this embodiment is applied to allocate resources, since the real-time network traffic can characterize the amount of data of network requests received by the network card per unit time when the number of concurrent network requests is different, and the above-mentioned preset resource volume flow relationship reflects the relationship between the pre-stated network traffic and the resource size of the resources used by the network traffic. In this way, according to the amount of data of network requests received by the server's network card and the preset resource volume flow relationship, network requests for processing different concurrent numbers of requests can be dynamically allocated, which is applicable to the situation where different concurrent numbers of network requests have resource requirements compared to the prior art.

[0091] See also Figure 2 , Figure 2 The flowchart of the second resource allocation method provided in the embodiment of the present invention may include S102A1-S102A4 when allocating resources for processing network requests according to the data volume of the network request received by the network card of the server and the preset resource volume flow relationship in the above S102.

[0092] S102A1: Determine a relationship between a preset resource volume flow and a data volume of a network request received by the network card of the server to determine a first resource size of resources required for processing the data volume of the network request received by the network card of the server.

[0093] S102A2: Parse the network request received by the network card of the server to obtain the network request type of the network request.

[0094] The above network request types may include: intensive interface access request types and intensive computing resource access request types.

[0095] Specifically, the interface may include an IO interface, etc., and a dense IO interface access request type may also be called IO intensive; the computing resources may include a CPU, a GPU, etc., and a dense CPU access request type may also be called CPU intensive.

[0096] Specifically, during the analysis, the data packets in the network request received by the network card may be spliced, and the spliced ​​data packets may be parsed to obtain the network request type of the network request.

[0097] In one embodiment of the present invention, in the above S102A2, the network request received by the network card of the server can be parsed in the following manner to obtain the network request type of the network request.

[0098] The first preset number of bytes of the first data packet of the network request received by the network card are parsed to obtain the network request type of the network request.

[0099] Specifically, the above preset number can be 1024, 2048, etc.

[0100] Since the first 1024 bytes of the first data packet of the network request include information representing the type of the network request, the data packet splicing process can be discarded, and only at least the first 1024 bytes of the first data packet are parsed to obtain the network request type of the network request.

[0101] In this way, only the first preset number of bytes of the first data packet of the network request are parsed, which can save resources for parsing the network request.

[0102] S102A3: Adjust the first resource size according to the request type of the network request to obtain a second resource size.

[0103] Since when the network request types are different, although the data volumes of the network requests of the different network request types are the same, the resource sizes of the resources for processing the network requests of the above network request types may be different. Therefore, in order to be applicable to the resources required for network requests of different network request types, the size of the determined first resource can be adjusted according to the network request type of the network request and the preset resource volume flow relationship corresponding to the network request type.

[0104] S102A4: Allocate resources for processing network requests received by the network card of the server based on the second resource size.

[0105] The resource volume flow relationship corresponding to the above preset network request type is: a relationship determined based on the network flow of a network request of a certain network request type and the resource size of the resources used by the network flow of the network request of the network request type. For example, assuming that the network request type is network request type R, the resource volume flow relationship corresponding to network request type R can be shown in Table 3 below.

[0106] Table 3

[0107]

[0108]

[0109] It can be seen from Table 3 that when the network traffic of the network request of the network request type R that is pre-counted is 1G / s, the resource size of the resources used by the network traffic is: the amount of memory resources is 0.5G, and the amount of thread resources is 7 threads; when the network traffic of the network request of the network request type R that is pre-counted is 2G / s, the resource size of the resources used by the network traffic is: the amount of memory resources is 0.7G, and the amount of thread resources is 9 threads.

[0110] It can be seen from Table 3 compared with Table 2 that, although the pre-counted network traffic is the same, the resource sizes of the resources required for the network traffic are not the same.

[0111] Assuming that the data volume of the network request of network request type R received by the server's network card within 1 second is 2G, then the real-time network traffic is 2G / s. According to the above Table 3, the resources that can be allocated to process the network request of network request type R are: the amount of memory resources is 0.7G, and the amount of thread resources is 9 threads.

[0112] In this way, according to the network request type of the network request and the preset resource flow relationship corresponding to the network request type, it can be applicable to the resources required for network requests of different network request types, thereby improving the effective utilization of resources.

[0113] In one embodiment of the present invention, the above S102A1 can be implemented in the following manner to determine the relationship between the data volume of the network request received by the server's network card and the preset resource volume flow to determine the first resource size of the resources required for processing the data volume of the network request received by the server's network card.

[0114] Determine the resource size of resources required for processing the network request according to the network request type of the network request and the resource volume flow relationship corresponding to the preset network request type; and allocate the resources for processing the network request according to the determined resource size.

[0115] Specifically, based on the real-time network traffic of the network request type and the resource traffic relationship corresponding to the preset network request type, the resource size of the resources used to process the obtained network request can be directly determined, and the resources used to process the network request can be allocated according to the determined resource size.

[0116] In this way, resources for processing network requests can be allocated more accurately based on the real-time network traffic of the network request type and the resource volume and traffic relationship corresponding to the preset network request type.

[0117] In another embodiment of the present invention, the following steps B1-B2 can be used to implement the above S102A1 to determine the relationship between the data volume of the network request received by the server's network card and the preset resource volume flow, so as to determine the first resource size of the resources required for processing the data volume of the network request received by the server's network card.

[0118] Step B1: According to the data volume of the network request received by the network card of the server and the preset resource volume flow relationship, determine the resource volume flow relationship corresponding to the data volume of the network request.

[0119] Exemplarily, the preset resource volume flow relationship is the correspondence between network traffic (such as the amount of data requested by the network) and the resource size of resources required to process the network traffic. Based on this, the corresponding resource volume flow relationship can be determined by counting the amount of data of the network request received by the network card of the server.

[0120] Step B2: Based on the resource volume flow relationship corresponding to the data volume of the network request, determine a first resource size of resources required for processing the data volume of the network request.

[0121] Exemplarily, after the corresponding resource volume flow relationship is determined, the resource size corresponding to the data volume of the network request can be preliminarily determined, that is, the first resource size.

[0122] Since the network request type is an intensive interface access request type, when the server provides services according to the network request of the above network request type, a large amount of storage resources are needed to obtain data, so the server needs to allocate more storage resources to obtain service data. In order to ensure that the server can smoothly provide services, the size of the memory resources or computing resources in the determined first resource size can be adjusted, which can meet the resources required for processing network requests without causing waste of resources.

[0123] Exemplarily, S102A3 may be implemented as follows: when the network request type is an intensive interface access request type, reducing the size of the memory resource in the determined first resource size to obtain the second resource size.

[0124] In some other embodiments, step S102A3 may also be implemented as: when the network request type is an intensive computing resource access request type, reducing the size of the computing resource in the first resource size to obtain the second resource size.

[0125] Since the server needs a lot of storage resources to obtain data when providing services to intensive interface access request type network requests, the server needs to allocate more storage resources to obtain service data. Therefore, reducing the memory resources allocated to the above network requests can ensure that the server can provide services smoothly.

[0126] In addition, since the server needs a large amount of computing resources to process data when providing services to network requests of intensive computing resource access request type, the server needs to allocate more computing resources for processing data. Therefore, reducing the computing resources allocated to the above network requests can ensure that the server can provide services smoothly.

[0127] Since network requests of different network request types have different requirements for resource sizes, after determining the resource size required for processing the network request according to the network request type and the resource volume flow relationship corresponding to the preset network request type, the determined resource size is further adjusted according to the network request type. In this way, resources for processing network requests of different network request types can be dynamically allocated.

[0128] In one embodiment of the present invention, Figure 3 As shown, Figure 3 The flowchart of the third resource allocation method provided in the embodiment of the present invention may further include the following steps S103-S104 after the above step S102.

[0129] Step S103: when the resource size required by the data volume of the network request received by the network card of the server is greater than the allocated resource size, the other data of the network request except the data that can be processed by the resources is stored in the hard disk of the server.

[0130] The other data of the above network request except the data processed by resources refers to: the data in the network request that is not processed by resources when the network request is processed according to the allocated resources.

[0131] The allocated resource size may represent the maximum resource size of resources used to process network requests. When the determined resource size is greater than the allocated resource size, the server cannot allocate resources according to the determined resource size, and therefore allocates resources for processing network requests according to the allocated resource size.

[0132] To avoid data loss, data in network requests other than data processed by resources can be stored on the server's hard disk.

[0133] Step S104: When the allocated resources are in an idle state, other data requested by the network and stored in the hard disk of the server are processed.

[0134] In this way, when the determined resource size is larger than the allocated resource size, the data in the network request that has not been resource processed is stored in the hard disk, which can avoid data loss. When the allocated resources are idle, the network request for the hard disk data stored on the server is processed, which can ensure that all received network requests are processed.

[0135] Corresponding to the above resource allocation method, an embodiment of the present invention further provides a resource allocation device.

[0136] See also Figure 4 , Figure 4 This is a schematic diagram of the structure of a first resource allocation device provided in an embodiment of the present invention, which is applied to a server. The device includes 401-402.

[0137] The traffic determination module 401 is used to determine the real-time network traffic of the server, where the real-time network traffic includes the data volume of the network request received by the network card of the server;

[0138] The resource allocation module 402 is used to allocate resources for processing network requests based on the data volume of the network requests received by the server's network card and a preset resource volume flow relationship, where the resource volume flow relationship is determined based on pre-stated network traffic and the resource size of the resources used by the network traffic.

[0139] As can be seen from the above, when the solution provided by this embodiment is applied to allocate resources, since the real-time network traffic can characterize the amount of data of network requests received by the network card per unit time when the number of concurrent network requests is different, and the above-mentioned preset resource volume flow relationship reflects the relationship between the pre-stated network traffic and the resource size of the resources used by the network traffic. In this way, according to the amount of data of network requests received by the server's network card and the preset resource volume flow relationship, network requests for processing different concurrent numbers of requests can be dynamically allocated, which is applicable to the situation where different concurrent numbers of network requests have resource requirements compared to the prior art.

[0140] See also Figure 5 , Figure 5 This is a schematic diagram of the structure of a second resource allocation device provided in an embodiment of the present invention. In the resource allocation module 402, 402A-402D may also be included.

[0141] A first resource determination submodule 402A, configured to determine a relationship between a preset resource volume flow and a data volume of a network request received by a network card of a server, so as to determine a first resource size of resources required for processing the data volume of the network request received by the network card of the server;

[0142] A network request type parsing submodule 402B is used to parse the network request received by the network card of the server to obtain the network request type of the network request;

[0143] A resource adjustment submodule 402C, configured to adjust the first resource size according to the request type of the network request to obtain a second resource size;

[0144] The second resource determination submodule 402D is configured to allocate the resources for processing the network request received by the network card of the server based on the second resource size.

[0145] In this way, according to the network request type of the network request and the preset resource flow relationship corresponding to the network request type, it can be applicable to the resources required for network requests of different network request types, thereby improving the effective utilization of resources.

[0146] In one embodiment of the present invention, the first resource determination submodule 402A may be further configured to:

[0147] Determine a resource volume flow relationship corresponding to the data volume of the network request according to the data volume of the network request received by the network card of the server and the preset resource volume flow relationship;

[0148] Based on the resource volume flow relationship corresponding to the data volume of the network request, a first resource size of resources required for processing the data volume of the network request is determined.

[0149] In this way, resources for processing network requests can be allocated more accurately based on the real-time network traffic of the network request type and the resource volume and traffic relationship corresponding to the preset network request type.

[0150] In one embodiment of the present invention, the resource adjustment submodule 402C may be further configured to:

[0151] When the network request type is an intensive interface access request type, the size of the memory resource in the determined first resource size is reduced to obtain a second resource size.

[0152] In this way, since the server needs a large amount of storage resources to obtain data when providing services to network requests of intensive interface access request type, the server needs to allocate more storage resources for obtaining service data. Therefore, reducing the memory resources allocated to the above network requests can ensure that the server can provide services smoothly.

[0153] Alternatively, in the resource adjustment submodule 402C, it can be further used to:

[0154] It is further used to reduce the size of the computing resources in the first resource size to obtain a second resource size when the network request type is an intensive computing resource access request type.

[0155] In this way, since the server needs a large amount of computing resources to process data when providing services to network requests of intensive computing resource access request type, the server needs to allocate more computing resources for processing data. Therefore, reducing the computing resources allocated to the above network requests can ensure that the server can provide services smoothly.

[0156] Since network requests of different network request types have different requirements for resource sizes, after determining the resource size required for processing the network request according to the network request type and the resource volume flow relationship corresponding to the preset network request type, the determined resource size is further adjusted according to the network request type. In this way, resources for processing network requests of different network request types can be dynamically allocated.

[0157] In one embodiment of the present invention, the network request type parsing submodule 402B is further used to:

[0158] The first preset number of bytes of the first data packet of the network request received by the network card of the server are parsed to obtain the network request type of the network request.

[0159] In this way, only the first preset number of bytes of the first data packet of the network request are parsed, which can save resources for parsing the network request.

[0160] See also Figure 6 , Figure 6 A schematic diagram of the structure of a third resource allocation device provided by an embodiment of the present invention, wherein the device may further include:

[0161] A data storage module 403 is used to store other data of the network request except the data that can be processed by the resource in the hard disk of the server when the resource size of the resource required by the data amount of the network request received by the network card of the server is greater than the allocated resource size;

[0162] The request processing module 404 is used to process other data of the network request stored in the hard disk of the server when the allocated resources are in an idle state.

[0163] In this way, when the determined resource size is greater than the preset resource amount, the data in the network request that has not been resource processed is stored in the hard disk, which can avoid data loss, and when the allocated resources are in an idle state, the network request for the hard disk data stored on the server is processed, which can ensure that all received network requests are processed.

[0164] In one embodiment of the present invention, the above resources include: memory resources and thread resources.

[0165] Corresponding to the above resource allocation method, an embodiment of the present invention further provides a server.

[0166] See also Figure 7 , Figure 7 A schematic diagram of the structure of a server provided in an embodiment of the present invention includes a processor 701, a communication interface 702, a memory 703 and a communication bus 704, wherein the processor 701, the communication interface 702, and the memory 703 communicate with each other through the communication bus 704.

[0167] Memory 703, used for storing computer programs;

[0168] The processor 701 is used to implement the resource allocation method provided in the embodiment of the present invention when executing the program stored in the memory 703.

[0169] The communication bus mentioned in the above electronic device can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The communication bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.

[0170] The communication interface is used for communication between the above server and other devices.

[0171] The memory may include a random access memory (RAM) or a non-volatile memory (NVM), such as at least one disk memory. Optionally, the memory may also be at least one storage device located away from the aforementioned processor.

[0172] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.

[0173] In another embodiment of the present invention, a computer-readable storage medium is provided, in which a computer program is stored. When the computer program is executed by a processor, the resource allocation method provided in the embodiment of the present invention is implemented.

[0174] In another embodiment of the present invention, a computer program product including instructions is provided. When the computer program product is run on a computer, the computer implements the resource allocation method provided in the embodiment of the present invention.

[0175] As can be seen from the above, when the solution provided by this embodiment is applied to allocate resources, since the real-time network traffic can characterize the amount of data of network requests received by the network card per unit time when the number of concurrent network requests is different, and the above-mentioned preset resource volume flow relationship reflects the relationship between the pre-stated network traffic and the resource size of the resources used by the network traffic. In this way, according to the amount of data of network requests received by the server's network card and the preset resource volume flow relationship, network requests for processing different concurrent numbers of requests can be dynamically allocated, which is applicable to the situation where different concurrent numbers of network requests have resource requirements compared to the prior art.

[0176] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented by software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present invention is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from a website site, computer, server or data center to another website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrated. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state hard disk Solid State Disk (SSD)), etc.

[0177] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.

[0178] Each embodiment in this specification is described in a related manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the device, server, and computer-readable storage medium embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiments.

[0179] The above description is only a preferred embodiment of the present invention and is not intended to limit the protection scope of the present invention. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention are included in the protection scope of the present invention.

Claims

1. A resource allocation method, characterized in that: Applied to a server, the method comprises: Determine the real-time network traffic of the server, wherein the real-time network traffic includes the data volume of the network request received by the network card of the server; Determine the relationship between the preset resource volume flow and the data volume of the network request received by the network card of the server according to the data volume of the network request, so as to determine the first resource size of the resources required for processing the data volume of the network request received by the network card of the server; the resource volume flow relationship is determined according to the pre-stated network traffic and the resource size of the resources used by the network traffic; Parsing the network request received by the network card of the server to obtain the network request type of the network request; the network request type includes: an intensive interface access request type or an intensive computing resource access request type; When the network request type is an intensive interface access request type, reducing the size of the memory resource in the determined first resource size to obtain a second resource size; When the network request type is the intensive computing resource access request type, reducing the size of the computing resources in the first resource size to obtain the second resource size; The resource for processing the network request received by the network card of the server is allocated based on the second resource size.

2. The method according to claim 1, characterized in that The determining, according to the data volume of the network request received by the network card of the server, a relationship with the preset resource volume flow rate to determine a first resource size of resources required for processing the data volume of the network request received by the network card of the server, includes: Determine a resource volume flow relationship corresponding to the data volume of the network request according to the data volume of the network request received by the network card of the server and the preset resource volume flow relationship; Based on the resource volume flow relationship corresponding to the data volume of the network request, a first resource size of resources required for processing the data volume of the network request is determined.

3. The method according to claim 1, characterized in that The parsing of the network request received by the network card of the server to obtain the network request type of the network request includes: The first preset number of bytes of the first data packet of the network request received by the network card of the server are parsed to obtain the network request type of the network request.

4. The method according to claim 1, characterized in that: The method further comprises: When the resource size of the resources required by the data volume of the network request received by the network card of the server is greater than the allocated resource size, storing other data of the network request except the data that can be processed by the resources in the hard disk of the server; When the allocated resources are in an idle state, other data of the network request stored in the hard disk of the server is processed.

5. The method according to any one of claims 1 to 4, characterized in that The resources include: memory resources and / or thread resources.

6. A resource allocation device, characterized in that: Applied to a server, the device comprises: A traffic determination module, used to determine the real-time network traffic of the server, wherein the real-time network traffic includes the data volume of the network request received by the network card of the server; Resource allocation module, including: A first resource determination submodule is used to determine a relationship between a preset resource volume flow rate and a data volume of a network request received by the network card of the server, so as to determine a first resource size of resources required for processing the data volume of the network request received by the network card of the server; the resource volume flow rate relationship is determined based on a pre-stated network flow and a resource size of resources used by the network flow; A network request type parsing submodule, used to parse the network request received by the network card of the server to obtain the network request type of the network request; the network request type includes: an intensive interface access request type or an intensive computing resource access request type; A resource adjustment submodule, configured to reduce the size of the memory resource in the determined first resource size to obtain a second resource size when the network request type is an intensive interface access request type; and to reduce the size of the computing resource in the determined first resource size to obtain a second resource size when the network request type is an intensive computing resource access request type; The second resource determination submodule is used to allocate the resources for processing the network request received by the network card of the server based on the second resource size.

7. The device according to claim 6, characterized in that The resources include: memory resources and thread resources.

8. A server, characterized in that: It includes a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other through the communication bus; Memory, used to store computer programs; A processor, for implementing the method steps described in any one of claims 1 to 5 when executing a program stored in a memory.

9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method steps described in any one of claims 1 to 5 are implemented.