Disclosure of Invention
The present invention aims to overcome the problems in the prior art, and provides a server resource allocation method, in which an access server obtains the history of operating servers accessed by all currently accessed user terminals, respectively predicts the size of the operating space of the operating server currently accessed by each user terminal, and allocates the access space of each user terminal accessed to the server according to the proportion of the size of the operating space corresponding to each user terminal.
Therefore, the invention provides a server resource allocation method, which comprises the following steps:
the access server respectively obtains the size of the running space of the running server visited by all the user terminals to be accessed at the current moment.
And the access server respectively takes the average value of the operation space sizes of the operation servers accessed by each user terminal as the operation space size of the operation server to be accessed at the time.
The access server sets the current access space distribution proportion according to the size of the operation space of the operation server to be accessed by all the user terminals at this time.
And the access server allocates the access space to each user terminal according to the access space allocation proportion.
Further:
the access server distinguishes the user terminals by acquiring the access ID of the user terminals.
And a data storage library is arranged in the access server and is used for storing the access ID of each user terminal, the size of the running space of the running server accessed by the access ID of each user terminal and the access time of the access ID of each user terminal in the running server.
Further, when the access server obtains the size of the operating space of the operating server accessed by the user terminal to be accessed at the current moment, the access server obtains the size of the operating space of the accessed operating server within the set historical time.
And the access server obtains the size of the running space of the running server accessed by the access ID of the user terminal by screening the access ID of the user terminal and the access time of the access ID of the user terminal in the data storage library in accessing the running server.
Further, when the access server obtains the size of the operating space of the operating server accessed by the user terminal to be accessed at the current moment, the access server obtains the size of the operating space of the accessed operating server within the set historical access times.
And the access server screens the access ID of the user terminal in the data storage library, and sorts the access ID according to the access time of the user terminal in accessing the operation server to obtain the size of the operation space of the accessed operation server within the set historical access times.
Further, the access server respectively counts the size of the operating space of the operating server accessed by each user terminal and the number of accessed times.
The access server respectively calculates the sum of the sizes of the operating spaces of the operating servers accessed by each user terminal.
And the access server takes the quotient of the sum of the running space sizes of the running servers accessed by each user terminal and the access times accessed by the user terminal as the average value of the running space sizes of the running servers accessed by the user terminal.
Further, when the access server sets the current access space allocation proportion according to the size of the operating space of the operating server to be accessed by all the user terminals at this time, the method includes:
the access server obtains the size of the operation space of the operation server to be accessed by all the user terminals at this time and obtains the initial proportion.
The access server performs equal ratio simplification on the initial ratio to obtain a final ratio.
The access server sets the final proportion as the current access space allocation proportion.
Further, when a device requests to access the server, the access server respectively obtains the size of the operating space of the operating server accessed by all the user terminals to be accessed at the current moment.
The server resource allocation method provided by the invention has the following beneficial effects:
1. acquiring the history of the operation servers accessed by all currently accessed user terminals through an access server, respectively predicting the size of the operation space of the operation server to be accessed by each user terminal, and distributing the access space of each user terminal access server according to the proportion of the size of the operation space corresponding to each user terminal;
2. when the history of the operation server accessed by the user terminal is predicted, the average value of the operation space of the accessed operation server in the set history time period is used as the prediction of the operation space of the operation server to be accessed at this time.
Detailed Description
An embodiment of the present invention will be described in detail below with reference to the accompanying drawings, but it should be understood that the scope of the present invention is not limited to the embodiment.
In the present application, the type and structure of components that are not specified are all the prior art known to those skilled in the art, and those skilled in the art can set the components according to the needs of the actual situation, and the embodiments of the present application are not specifically limited.
Specifically, as shown in fig. 1 to 3, an embodiment of the present invention provides a server resource allocation method, including:
the access server respectively obtains the size of the running space of the running server visited by all the user terminals to be accessed at the current moment.
Specifically, the access server searches in a database recording user access history through a user ID of each user terminal to obtain an operating server accessed by each user terminal to be accessed, and obtains the size of an operating space of the operating servers, and meanwhile, when the access server accesses each user terminal to a corresponding operating server each time, the access server counts the access in the database.
And the access server respectively takes the average value of the operation space sizes of the operation servers accessed by each user terminal as the operation space size of the operation server to be accessed at the time.
As described above, the size of the operating space of the operating server accessed by each user terminal accessed at the current time is obtained, the size of the operating space of each accessed operating server is summed, and then an average value is obtained according to the sum, and the average value is used as the size of the operating space of the operating server to be accessed at this time.
The access server sets the current access space distribution proportion according to the size of the operation space of the operation server to be accessed by all the user terminals at this time.
The access server obtains the proportion between each user terminal according to the size of the running space of the running server to be visited by each user terminal at this time, and the proportion is used as the current access space distribution proportion.
And the access server allocates the access space to each user terminal according to the access space allocation proportion. This enables allocation of access space to individual user terminals by pre-estimation.
In this embodiment, the access server distinguishes the user terminals by acquiring the access ID of the user terminals. Each user terminal has a unique machine identification code, which is the access ID corresponding to the user terminal, so that the access ID corresponding to each user terminal is unique.
And a data storage library is arranged in the access server and is used for storing the access ID of each user terminal, the size of the running space of the running server accessed by the access ID of each user terminal and the access time of the access ID of each user terminal in the running server. After each user terminal accesses the running server, the access server records the running space size and the access time of the running server accessed by the user terminal in a list of the access ID of the corresponding user terminal in the data storage.
Meanwhile, in this embodiment, when the access server obtains the size of the operating space of the operating server accessed by the user terminal to be accessed at the current time, the access server obtains the size of the operating space of the accessed operating server within the set historical time.
In the set time period, the accessed time is a limited numerical value, and meanwhile, the statistical number of the access servers can be reduced, so that the calculation amount of the operation servers can be effectively saved, the calculation speed of the access servers is increased, and the speed of the user accessing the internet is also increased. For the set time period, a week period may be selected, or a month period may be selected.
And the access server obtains the size of the running space of the running server accessed by the access ID of the user terminal by screening the access ID of the user terminal and the access time of the access ID of the user terminal in the data storage library in accessing the running server. Therefore, the size of the running space of the running server accessed by the user terminal in the set time period can be counted.
Meanwhile, in this embodiment, when the access server obtains the size of the operating space of the operating server accessed by the user terminal to be accessed at the current time, the access server obtains the size of the operating space of the accessed operating server within the set historical access times.
Through the set access times, the operation space size of the operation server which has a certain amount of access can be obtained, and compared with the set time, the data is more accurate for some user terminals which do not frequently access the Internet. The number of accesses to be set is generally 10, and if the number of accesses is less than 10, the total number is counted, and if the number of accesses exceeds 10, the number of accesses in the latest time is counted.
During statistics, the access server screens the access ID of the user terminal from the data repository, and sorts the access ID according to the access time of the user terminal in accessing the operating server to obtain the size of the operating space of the accessed operating server within the set historical access times.
In this embodiment, the access server respectively counts the size of the operating space of the operating server accessed by each user terminal and the number of accessed times. During statistics, the access server calculates the sum of the size of the operating space of the operating server accessed by each user terminal. And then, the access server takes the quotient of the sum of the size of the running space of the running server accessed by each user terminal and the number of access times accessed by the user terminal as the average value of the size of the running space of the running server accessed by the user terminal. Thus, the size of the running space of the running server accessed by each user terminal and the number of accessed times can be obtained.
In this embodiment, the access server sets the current access space allocation ratio according to the size of the operating space of the operating server to be accessed by all the user terminals at this time. Firstly, the access server obtains the size of the operating space of the operating server to be accessed by all the user terminals at this time and obtains the initial proportion. Secondly, the access server performs equal ratio simplification on the initial ratio to obtain a final ratio. And finally, the access server sets the final proportion as the current access space distribution proportion.
Therefore, when the allocation is carried out, the size of the space accessed at this time can be expected through the size of the space of the operation server accessed historically, and therefore the access speed can be optimized to the maximum extent when the access is carried out by allocating the proper space.
In this embodiment, when a device requests to access a server, the access server respectively obtains the size of the operating space of the operating server accessed by all user terminals to be accessed at the current time. Therefore, the technical scheme provided by the invention can be carried out when an access request exists, and the access server is in a normal working state or a standby state when no access request exists, so that the workload of the access server can be effectively saved.
Meanwhile, the invention can be carried out in a multi-thread mode, each technical scheme flow provided by the invention is a thread, and each thread independently carries out operation.
The above disclosure is only for a few specific embodiments of the present invention, however, the present invention is not limited to the above embodiments, and any variations that can be made by those skilled in the art are intended to fall within the scope of the present invention.