CN112199043A - Server selection method and device, electronic equipment and storage medium - Google Patents

Server selection method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN112199043A
CN112199043A CN202011070019.5A CN202011070019A CN112199043A CN 112199043 A CN112199043 A CN 112199043A CN 202011070019 A CN202011070019 A CN 202011070019A CN 112199043 A CN112199043 A CN 112199043A
Authority
CN
China
Prior art keywords
server
servers
weight
weights
storage space
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202011070019.5A
Other languages
Chinese (zh)
Inventor
曹春辉
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
OneConnect Smart Technology Co Ltd
OneConnect Financial Technology Co Ltd Shanghai
Original Assignee
OneConnect Financial Technology Co Ltd Shanghai
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by OneConnect Financial Technology Co Ltd Shanghai filed Critical OneConnect Financial Technology Co Ltd Shanghai
Priority to CN202011070019.5A priority Critical patent/CN112199043A/en
Publication of CN112199043A publication Critical patent/CN112199043A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0602Interfaces specially adapted for storage systems specifically adapted to achieve a particular effect
    • G06F3/0604Improving or facilitating administration, e.g. storage management
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0629Configuration or reconfiguration of storage systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0653Monitoring storage devices or systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0668Interfaces specially adapted for storage systems adopting a particular infrastructure
    • G06F3/067Distributed or networked storage systems, e.g. storage area networks [SAN], network attached storage [NAS]
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5027Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals
    • G06F9/505Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals considering the load

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Human Computer Interaction (AREA)
  • Software Systems (AREA)
  • Computer And Data Communications (AREA)

Abstract

The application relates to cluster storage and discloses a server selection method, a device, electronic equipment and a storage medium, wherein the method comprises the following steps: acquiring data to be stored; if it is detected that no server with a residual storage space smaller than a preset storage space exists in N servers of a server cluster, N first weights corresponding to the N servers one to one are obtained, wherein N is an integer larger than 1; determining N third weights corresponding to the N servers one to one according to a difference between a second weight and the N first weights, wherein the second weight is any one weight in a weight interval, the minimum value of the weight interval is zero, and the maximum value of the weight interval is the sum of the N first weights; and determining a first server for storing the data to be stored according to the N third weights. The method and the device can improve the storage performance and the access performance, and are suitable for medical informatization, electronic information archive management and the like in the digital medical field.

Description

Server selection method and device, electronic equipment and storage medium
Technical Field
The present application relates to the field of computer technologies, and in particular, to a server selection method and apparatus, an electronic device, and a storage medium.
Background
For a server cluster, in the prior art, in order to better allocate resources, a weight is generally set to a server based on the performance of the server, and a server with a large weight is selected from the server cluster by the weight to store an electronic information archive.
However, in the actual application process, there may be a case where the number of server applications is too large. In this case, the weight corresponding to the server is not dynamically adjusted, and when a server is selected from the server cluster by the weight, a server to which the application is excessive is still selected. Therefore, in the existing scheme, there is a case where the storage is unbalanced. This results in reduced storage performance and reduced access performance.
Disclosure of Invention
The embodiment of the application provides a server selection method, a server selection device, electronic equipment and a storage medium, and storage performance and access performance are improved.
A first aspect of the present application provides a server selection method, including:
acquiring data to be stored;
if it is detected that no server with a residual storage space smaller than a preset storage space exists in N servers of a server cluster, N first weights corresponding to the N servers one to one are obtained, wherein N is an integer larger than 1;
determining N third weights corresponding to the N servers one to one according to a difference between a second weight and the N first weights, wherein the second weight is any one weight in a weight interval, the minimum value of the weight interval is zero, and the maximum value of the weight interval is the sum of the N first weights;
and determining a first server for storing the data to be stored from the N servers according to the N third weights, wherein the first server is a server corresponding to the maximum weight in at least one fourth weight, and the at least one fourth weight is a weight which is smaller than a preset weight in the N third weights.
A second aspect of the present application provides a server selection apparatus comprising a first obtaining module, a second obtaining module, a first determining module, and a second determining module, wherein,
the first acquisition module is used for acquiring data to be stored;
the second obtaining module is configured to obtain N first weights corresponding to N servers one to one if it is detected that there is no server with a remaining storage space smaller than a preset storage space among the N servers of the server cluster, where N is an integer greater than 1;
the first determining module is configured to determine N third weights corresponding to the N servers one to one according to a difference between a second weight and the N first weights, where the second weight is any one weight in a weight interval, a minimum value of the weight interval is zero, and a maximum value of the weight interval is a sum of the N first weights;
the second determining module is configured to determine, according to the N third weights, a first server that stores the data to be stored from the N servers, where the first server is a server corresponding to a maximum weight in at least one fourth weight, and the at least one fourth weight is a weight that is smaller than a preset weight in the N third weights.
A third aspect of the application provides a server-selected electronic device comprising a processor, a memory, a communication interface, and one or more programs, wherein the one or more programs are stored in the memory and are generated as instructions that are executed by the processor to perform steps in any one of the methods of a server selection method.
A fourth aspect of the present application provides a computer readable storage medium for storing a computer program for execution by the processor to implement the method of any one of the server selection methods.
It can be seen that, in the above technical solution, the weight interval is determined based on the sum of the weights corresponding to the servers, so as to determine the server storing the data to be stored according to the weight interval, thereby avoiding a situation that when a server is selected from the server cluster through the weight in the existing solution, too many servers are still selected due to the fact that the weight is not dynamically adjusted, avoiding a situation of unbalanced storage, and further improving the storage performance and the access performance.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present application, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
Wherein:
fig. 1A is a schematic diagram of a server selection system provided in an embodiment of the present application;
FIG. 1B is a block diagram of a system architecture according to an embodiment of the present application;
fig. 2 is a schematic flowchart of a server selection method according to an embodiment of the present application;
fig. 3 is a schematic flowchart of another server selection method according to an embodiment of the present application;
fig. 4 is a schematic diagram illustrating determination of a first average speed of data processed by a third server according to an embodiment of the present application;
fig. 5 is a schematic diagram of a server selection apparatus according to an embodiment of the present application;
fig. 6 is a schematic structural diagram of an electronic device in a hardware operating environment according to an embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
The following are detailed below.
The terms "first" and "second" in the description and claims of the present application and the above-described drawings are used for distinguishing between different objects and not for describing a particular order. Furthermore, the terms "include" and "have," as well as any variations thereof, are intended to cover non-exclusive inclusions. For example, a process, method, system, article, or apparatus that comprises a list of steps or elements is not limited to only those steps or elements listed, but may alternatively include other steps or elements not listed, or inherent to such process, method, article, or apparatus.
Referring to fig. 1A, fig. 1A is a schematic diagram of a server selection system provided in an embodiment of the present application, where the server selection system 100 includes a server selection apparatus 110. The server selection device 110 is used for processing and storing data to be stored. The server selection system 100 may include an integrated single device or multiple devices, and for convenience of description, the server selection system 100 is generally referred to as an electronic device. It will be apparent that the electronic device may include various handheld devices, vehicle-mounted devices, wearable devices, computing devices or other processing devices connected to a wireless modem having wireless communication capability, as well as various forms of User Equipment (UE), Mobile Stations (MS), terminal Equipment (terminal device), and the like.
Referring to fig. 1B, fig. 1B is a schematic diagram of a system architecture provided in the embodiment of the present application. As shown in fig. 1B, it can be seen that the system architecture involves an electronic device and N servers. And interacting with one or more servers in the N servers through the electronic equipment to realize the storage of the data to be stored in the one or more servers.
In addition, for a server cluster, in the prior art, in order to better allocate resources, generally, a weight is set to a server based on the performance of the server, and a server with a large weight is selected from the server cluster by the weight to store data.
However, in the actual application process, there may be a case where the number of server applications is too large. In this case, the weight corresponding to the server is not dynamically adjusted, and when a server is selected from the server cluster by the weight, a server to which the application is excessive is still selected. Therefore, in the existing scheme, there is a case where the storage is unbalanced. This results in reduced storage performance and reduced access performance.
Based on this, the present embodiment provides a server selection method to solve the above problem, and the following describes the present embodiment in detail. The method and the device are suitable for scenes such as medical informatization, electronic information archive management and the like in the digital medical field.
Referring to fig. 2, fig. 2 is a schematic flowchart of a server selection method according to an embodiment of the present application. The server selection method can be applied to an electronic device, as shown in fig. 2, and the method includes:
201. and acquiring data to be stored.
The data to be stored may be, for example, an electronic information file, and the like, which is not limited herein.
202. If it is detected that no server with a residual storage space smaller than a preset storage space exists in the N servers of the server cluster, N first weights corresponding to the N servers one to one are obtained.
Wherein N is an integer greater than 1.
The preset storage space can be set by an administrator or configured in a configuration file of the electronic device.
203. Determining N third weights corresponding to the N servers one by one according to a difference value between a second weight and the N first weights, wherein the second weight is any one weight in a weight interval, the minimum value of the weight interval is zero, and the maximum value of the weight interval is the sum of the N first weights.
For example, the N first weights include weight 1 and weight 2, where weight 1 is 18 and weight 2 is 33. Then, the weight interval is (0, 51) the second weight may be any one of (0, 51).
204. And determining a first server for storing the data to be stored from the N servers according to the N third weights.
The first server is a server corresponding to the maximum weight in at least one fourth weight, and the at least one fourth weight is a weight smaller than a preset weight in the N third weights.
The preset weight may be set by an administrator or may be configured in a configuration file.
It can be seen that, in the above technical solution, the weight interval is determined based on the sum of the weights corresponding to the servers, so as to determine the server storing the data to be stored according to the weight interval, thereby avoiding a situation that when a server is selected from the server cluster through the weight in the existing solution, too many servers are still selected due to the fact that the weight is not dynamically adjusted, avoiding a situation of unbalanced storage, and further improving the storage performance and the access performance.
Referring to fig. 3, fig. 3 is a schematic flowchart of another server selection method provided in the embodiment of the present application. The server selection method may be applied to an electronic device in which, as shown in fig. 3,
301. and acquiring data to be stored.
The data to be stored may refer to the description related to fig. 2, which is not repeated herein.
302. And sending N pieces of first indication information to the N servers.
The N servers correspond to the N first indication information one to one, and each of the N first indication information is used to indicate each of the N servers to feed back the remaining storage space of each of the N servers.
303. And receiving the residual storage space sent by each server in the N servers.
304. And detecting whether a server with the residual storage space smaller than the preset storage space exists in the N servers or not according to the residual storage space sent by each server in the N servers.
For the preset storage space, reference may be made to the related description of fig. 2, which is not repeated herein.
Optionally, if it is detected that there is no server with a remaining storage space smaller than the preset storage space in the N servers of the server cluster, step 305 is executed.
Optionally, if it is detected that a server with a remaining storage space smaller than a preset storage space exists in N servers of a server cluster, sending N second indication information to the N servers, where the N servers correspond to the N second indication information one to one, and each of the N second indication information is used to indicate each of the N servers to feed back remaining resources and total resources of each of the N servers; receiving the residual resources and the total resources sent by each server in the N servers; determining a second server from the N servers according to the residual resources and the total resources corresponding to each server in the N servers; and storing the data to be stored to the second server.
Optionally, the remaining resources of each server of the N servers include at least one of: remaining storage space, remaining memory availability, remaining network availability, and remaining CPU availability. The total resources of each of the N servers include at least one of: total storage space, total memory usage, total network occupiable capacity, and total CPU utilizable capacity.
Optionally, the determining a second server from the N servers according to the remaining resources and the total resources sent by each server of the N servers includes:
determining a ratio between the remaining resources corresponding to each of the N servers and the total resources corresponding to each of the N servers to obtain N ratios;
and determining the server corresponding to the maximum ratio according to the N ratios to obtain a second server.
It can be seen that, in the above technical solution, when the remaining storage space is smaller than the preset storage space, the server for storing the data to be stored is determined according to the ratio between the remaining resources of each server and the sum of the remaining resources of each server, which avoids a situation that when a server is selected from a server cluster by a weight in the existing scheme, too many servers are still selected due to no dynamic adjustment of the weight, and also avoids a situation of unbalanced storage, thereby improving the storage performance and the access performance.
305. And acquiring N first weights corresponding to the N servers one to one.
306. And determining N third weights corresponding to the N servers one to one according to the difference between the second weight and the N first weights.
Optionally, the second weight is any one weight in a weight interval, a minimum value of the weight interval is zero, and a maximum value of the weight interval is a sum of the N first weights.
Optionally, the N first weights include a first weight a1 corresponding to the server B1, a first weight a2 corresponding to the server B2, and a first weight A3 corresponding to the server B3, where the first weight a1 is greater than the first weight a2, the first weight a2 is greater than the first weight A3, and the N third weights corresponding to the N servers one to one are determined according to a difference between the second weight and the N first weights, including:
determining the difference between the second weight and the first weight A1 to obtain a difference C1;
determining the difference value C1 as a third weight corresponding to the server B1;
determining the difference between the difference C1 and the first weight A2 to obtain a difference C1;
determining the difference value C1 as a third weight corresponding to the server B2;
determining the difference between the difference C1 and the first weight A3 to obtain a difference C2;
the difference C2 is determined as the third weight for the server B3.
The N third weights include a third weight corresponding to the server B1, a third weight corresponding to the server B2, and a third weight corresponding to the server B3. It is appreciated that the third weight corresponding to server B1 is greater than the third weight corresponding to server B2, and the third weight corresponding to server B2 is greater than the third weight corresponding to server B3.
307. And determining a first server for storing the data to be stored from the N servers according to the N third weights.
For the first server, reference may be made to the related description in fig. 2, which is not repeated herein.
It can be seen that, in the above technical solution, the weight interval is determined based on the sum of the weights corresponding to the servers, so as to determine the server storing the data to be stored according to the weight interval, thereby avoiding a situation that when a server is selected from the server cluster through the weight in the existing solution, too many servers are still selected due to no dynamic adjustment of the weight, and also avoiding a situation of unbalanced storage, thereby improving the storage performance and the access performance.
Optionally, the obtaining N first weights corresponding to the N servers one to one includes:
acquiring a first average speed of processing data of each server in the N servers within a preset time period;
determining the N first weights according to a ratio between a first average speed at which each of the N servers processes data and a sum of first average speeds at which each of the N servers processes data.
The preset time period may be set by an administrator or may be configured in a configuration file.
Optionally, the N servers include a first server and a second server, and a sum of the first average speeds of each of the N servers for processing data is a sum of the first average speed of the first server and the first average speed of the second server. If the sum of the first average speed of the first server and the first average speed of the second server is A, the first average speed of the first server for processing data and the first average speed of the first server are B, and the first average speed of the second server for processing data is C, the first weight corresponding to the first server is B/A, and the first weight corresponding to the second server is C/A.
It can be seen that, in the above technical solution, the first weight corresponding to each server is determined according to the ratio between the average speed of each server and the sum of the average speeds of each server, so as to prepare for subsequently selecting a server to store data based on the adjusted weight.
Optionally, the preset time period includes J times, where J is an integer greater than 1, and the obtaining a first average speed of processing data by each server of the N servers within the preset time period includes:
s1: setting j as an integer with an initial value of 1;
s2: if J is less than or equal to J, performing step S2, and if J is greater than J, performing step S8;
s3: numbering the N servers according to the sequence of the rest storage spaces fed back by the N servers to obtain the N numbers;
s4: sending M test requests to each server in the N servers at the jth moment according to the sequence of the N numbers from small to large, wherein M is an integer larger than 1;
s5: taking the jth moment as a reference, stopping timing when each server in the N servers feeds back a test response Q, to obtain a time length for processing the test request corresponding to each server in the N servers, where the test response Q is a response fed back latest in the M test responses corresponding to each server in the N servers, and the M test responses corresponding to each server in the N servers are determined according to the M test requests corresponding to each server in the N servers;
s6: determining a second average speed of processing data by each server in the N servers according to the data size of the M test requests corresponding to each server in the N servers and the time length of processing the test requests corresponding to each server in the N servers;
s7: assigning (j +1) to j, returning to execute S2;
s8: acquiring a second average speed of processing data of each server in the N servers, which is determined at each time of the J times;
s9: and determining a first average speed of processing data by each server in the N servers according to the average value of the second average speeds of processing data by each server in the N servers determined at each time in the J times.
Exemplarily, referring to fig. 4, fig. 4 is a schematic diagram illustrating determination of a first average speed of processing data by a third server according to an embodiment of the present application. The third server is any one of the N servers. Referring to fig. 4, the process of determining the first average speed at which the third server processes data includes the following steps:
401. and the electronic equipment sends M test requests to the third server by taking the jth moment as a reference. Correspondingly, the third server receives the M test requests sent by the electronic device.
It will be appreciated that the electronic device starts timing when M test requests are sent to the third server.
Optionally, after receiving the M test requests, the third server may process each test request in the M test requests, and after the processing is completed, the third server may send the M test requests to the electronic device. For example, the test request P is any one of the M test requests, and when the third server completes processing of the test request P, a test response corresponding to the test request P may be sent to the electronic device.
It should be noted that the M test requests are different test requests. Therefore, the time spent by the third server in processing the test request may be different, i.e., different resulting in different times when the M test responses are received by the electronic device.
402. And the third server sends a test response Q to the electronic equipment. Correspondingly, the electronic device receives the test response Q sent by the third server.
Optionally, when the electronic device receives the test response Q sent by the third server, the electronic device stops timing.
403. The electronic equipment determines a second average speed of the third server for processing the data according to the data sizes of the M test requests corresponding to the third server and the first time length of the third server for processing the test requests.
Optionally, the starting time corresponding to the first time length is j times, and the ending time corresponding to the first time length is a time when the electronic device receives the test response Q sent by the third server.
404. And the electronic equipment sends M test requests to the third server by taking the j +1 th time as a reference. Correspondingly, the third server receives the M test requests sent by the electronic device.
It will be appreciated that the electronic device starts timing when M test requests are sent to the third server.
402. And the third server sends a test response Q to the electronic equipment. Correspondingly, the electronic device receives the test response Q sent by the third server.
Optionally, when the electronic device receives the test response Q sent by the third server, the electronic device stops timing.
403. And the electronic equipment determines a second average speed of the third server for processing the data according to the data sizes of the M test requests corresponding to the third server and a second time length of the third server for processing the test requests.
Optionally, the starting time corresponding to the second time length is j +1 times, and the ending time corresponding to the first time length is a time when the electronic device receives the test response Q sent by the third server.
407. The electronic equipment determines a first average speed of the third server for processing the data according to the average value of the second average speed of the third server for processing the data determined at each of the J moments.
It is understood that, before step 407, the electronic device may send the M test request to the third server based on the J +2 th time, and stop sending the M test request to the third server after sending the M test request to the third server based on the J time. For the other time points except the jth time point and the J +1 th time point in the J time points, reference may be made to step 401 and 403, which are not described herein again.
It can be seen that, in the above technical solution, the average speed of processing data by each server is determined according to the number, so as to prepare for determining the weight based on the average speed of processing data by each server subsequently.
Optionally, the obtaining N first weights corresponding to the N servers one to one includes:
acquiring the residual resources corresponding to each server in the N servers;
determining the N first weights according to the residual resources corresponding to each server in the N servers;
wherein the remaining resources corresponding to each of the N servers include at least one of: remaining storage space, remaining memory availability, remaining network availability, and remaining CPU availability.
Optionally, the more the remaining resources corresponding to each of the N servers, the greater the first weight corresponding to each of the N servers.
It can be seen that, in the above technical solution, the weight of the server is determined according to the remaining resources of the server.
Referring to fig. 5, fig. 5 is a schematic diagram of a server selection apparatus according to an embodiment of the present application. As shown in fig. 5, a server selection apparatus 500 provided in this embodiment of the present application includes a first obtaining module 501, a second obtaining module 502, a first determining module 503, a second determining module 504, a transceiver module 505, a detecting module 506, a processing module 507, and a storage module 508,
the first obtaining module 501 is configured to obtain data to be stored;
the second obtaining module 502 is configured to obtain N first weights corresponding to N servers one to one if it is detected that there is no server with a remaining storage space smaller than a preset storage space among the N servers of the server cluster, where N is an integer greater than 1;
the first determining module 503 is configured to determine N third weights corresponding to the N servers one to one according to a difference between a second weight and the N first weights, where the second weight is any one weight in a weight interval, a minimum value of the weight interval is zero, and a maximum value of the weight interval is a sum of the N first weights;
the second determining module 504 is configured to determine, according to the N third weights, a first server that stores the data to be stored from the N servers, where the first server is a server corresponding to a maximum weight in at least one fourth weight, and the at least one fourth weight is a weight that is smaller than a preset weight in the N third weights.
Optionally, before obtaining N first weights corresponding to the N servers one to one, the transceiver module 505 is configured to send N first indication information to the N servers, where the N servers correspond to the N first indication information one to one, and each of the N first indication information is used to indicate each of the N servers to feed back the remaining storage space of each of the N servers; receiving the residual storage space sent by each server in the N servers;
the detecting module 506 is configured to detect whether a server with a remaining storage space smaller than the preset storage space exists in the N servers according to the remaining storage space sent by each server in the N servers.
Optionally, the second obtaining module 502 is configured to, when N first weights corresponding to the N servers are obtained, obtain, within a preset time period, a first average speed of processing data by each server of the N servers;
the first determining module 503 is configured to determine the N first weights according to a ratio between a first average speed at which each of the N servers processes data and a sum of the first average speeds at which each of the N servers processes data.
Optionally, the preset time period includes J times, where J is an integer greater than 1, and the processing module 507 is configured to, when a first average speed of processing data by each server of the N servers is obtained within the preset time period, S1: setting j as an integer with an initial value of 1; s2: if J is less than or equal to J, performing step S2, and if J is greater than J, performing step S8; s3: numbering the N servers according to the sequence of the rest storage spaces fed back by the N servers to obtain the N numbers;
s4: the second obtaining module 502 is configured to send M test requests to each server of the N servers at a jth time according to a sequence from a small number to a large number of the N numbers, where M is an integer greater than 1;
s5: the processing module 507 is configured to stop timing when each server in the N servers feeds back a test response Q with the jth time as a reference, so as to obtain a time length of processing the test request corresponding to each server in the N servers, where the test response Q is a response fed back latest in M test responses corresponding to each server in the N servers, and the M test responses corresponding to each server in the N servers are determined according to the M test requests corresponding to each server in the N servers; s6: determining a second average speed of processing data by each server in the N servers according to the data size of the M test requests corresponding to each server in the N servers and the time length of processing the test requests corresponding to each server in the N servers; s7: assigning (j +1) to j, returning to execute S2;
s8: the second obtaining module 502 is configured to obtain a second average speed of processing data by each of the N servers, which is determined at each of the J times;
s9: the processing module 507 is configured to determine a first average speed at which each of the N servers processes data according to an average value of second average speeds at which each of the N servers processes data, which is determined at each of the J times.
Optionally, the first obtaining module 501 is configured to obtain the remaining resources corresponding to each server in the N servers when obtaining the N first weights corresponding to the N servers one to one;
a first determining module 503, configured to determine the N first weights according to the remaining resources corresponding to each server in the N servers;
wherein the remaining resources corresponding to each of the N servers include at least one of: remaining storage space, remaining memory availability, remaining network availability, and remaining CPU availability.
Optionally, the transceiver module 505 is configured to send N second indication information to the N servers if it is detected that a server whose remaining storage space is smaller than the preset storage space exists in the N servers, where the N servers correspond to the N second indication information one to one, and each of the N second indication information is used to indicate each of the N servers to feed back remaining resources and total resources of each of the N servers; receiving the residual resources and the total resources sent by each server in the N servers;
a first determining module 503, configured to determine, according to the remaining resources and the total resources corresponding to each of the N servers, a ratio between the remaining resources corresponding to each of the N servers and the total resources corresponding to each of the N servers, so as to obtain N ratios;
a first determining module 503, configured to determine, according to the N ratios, a server corresponding to the maximum ratio, so as to obtain a second server. (ii) a
A storage module 508, configured to store the data to be stored in the second server.
Referring to fig. 6, fig. 6 is a schematic structural diagram of an electronic device in a hardware operating environment according to an embodiment of the present application.
Embodiments of the present application provide a server-selected electronic device, comprising a processor, a memory, a communication interface, and one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the processor to perform instructions comprising steps in any of the server selection methods. As shown in fig. 6, an electronic device of a hardware operating environment according to an embodiment of the present application may include:
a processor 601, such as a CPU.
The memory 602 may alternatively be a high speed RAM memory or a stable memory such as a disk memory.
A communication interface 603 for implementing connection communication between the processor 601 and the memory 602.
Those skilled in the art will appreciate that the configuration of the electronic device shown in fig. 6 is not intended to be limiting and may include more or fewer components than shown, or some components in combination, or a different arrangement of components.
As shown in fig. 6, the memory 602 may include an operating system, a network communication module, and one or more programs. An operating system is a program that manages and controls the server hardware and software resources, supporting the execution of one or more programs. The network communication module is used for communication among the components in the memory 602 and with other hardware and software in the electronic device.
In the electronic device shown in fig. 6, the processor 601 is configured to execute one or more programs in the memory 602, and implement the following steps:
acquiring data to be stored;
if it is detected that no server with a residual storage space smaller than a preset storage space exists in N servers of a server cluster, N first weights corresponding to the N servers one to one are obtained, wherein N is an integer larger than 1;
determining N third weights corresponding to the N servers one to one according to a difference between a second weight and the N first weights, wherein the second weight is any one weight in a weight interval, the minimum value of the weight interval is zero, and the maximum value of the weight interval is the sum of the N first weights;
and determining a first server for storing the data to be stored from the N servers according to the N third weights, wherein the first server is a server corresponding to the maximum weight in at least one fourth weight, and the at least one fourth weight is a weight which is smaller than a preset weight in the N third weights.
For specific implementation of the electronic device related to the present application, reference may be made to each embodiment of the server selection method, which is not described herein again.
The present application further provides a computer readable storage medium for storing a computer program, the stored computer program being executable by the processor to perform the steps of:
acquiring data to be stored;
if it is detected that no server with a residual storage space smaller than a preset storage space exists in N servers of a server cluster, N first weights corresponding to the N servers one to one are obtained, wherein N is an integer larger than 1;
determining N third weights corresponding to the N servers one to one according to a difference between a second weight and the N first weights, wherein the second weight is any one weight in a weight interval, the minimum value of the weight interval is zero, and the maximum value of the weight interval is the sum of the N first weights;
and determining a first server for storing the data to be stored from the N servers according to the N third weights, wherein the first server is a server corresponding to the maximum weight in at least one fourth weight, and the at least one fourth weight is a weight which is smaller than a preset weight in the N third weights.
For specific implementation of the computer-readable storage medium related to the present application, reference may be made to the embodiments of the server selection method, which are not described herein again.
It should be noted that, for simplicity of description, the above-mentioned method embodiments are described as a series of acts or combination of acts, but those skilled in the art should understand that the present application is not limited by the order of acts described, as some steps may be performed in other orders or simultaneously according to the present application. Further, those skilled in the art should also appreciate that the embodiments described in this specification are preferred embodiments and that the acts and modules involved are not necessarily required for this application.
The above embodiments are only used for illustrating the technical solutions of the present application, and not for limiting the same; although the present application has been described in detail with reference to the foregoing embodiments, it should be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and the modifications or the substitutions do not make the essence of the corresponding technical solutions depart from the scope of the technical solutions of the embodiments of the present application.

Claims (10)

1. A method for server selection, the method comprising:
acquiring data to be stored;
if it is detected that no server with a residual storage space smaller than a preset storage space exists in N servers of a server cluster, N first weights corresponding to the N servers one to one are obtained, wherein N is an integer larger than 1;
determining N third weights corresponding to the N servers one to one according to a difference between a second weight and the N first weights, wherein the second weight is any one weight in a weight interval, the minimum value of the weight interval is zero, and the maximum value of the weight interval is the sum of the N first weights;
and determining a first server for storing the data to be stored from the N servers according to the N third weights, wherein the first server is a server corresponding to the maximum weight in at least one fourth weight, and the at least one fourth weight is a weight which is smaller than a preset weight in the N third weights.
2. The method of claim 1, wherein before obtaining the N first weights corresponding to the N servers one to one, the method further comprises:
sending N pieces of first indication information to the N servers, wherein the N servers correspond to the N pieces of first indication information one by one, and each piece of first indication information in the N pieces of first indication information is used for indicating each server in the N servers to feed back the residual storage space of each server in the N servers;
receiving the residual storage space sent by each server in the N servers;
and detecting whether a server with the residual storage space smaller than the preset storage space exists in the N servers or not according to the residual storage space sent by each server in the N servers.
3. The method of claim 1, wherein the obtaining N first weights corresponding to the N servers one to one comprises:
acquiring a first average speed of processing data of each server in the N servers within a preset time period;
determining the N first weights according to a ratio between a first average speed at which each of the N servers processes data and a sum of first average speeds at which each of the N servers processes data.
4. The method according to claim 3, wherein the preset time period includes J moments, J is an integer greater than 1, and the obtaining the first average speed of processing data by each of the N servers within the preset time period includes:
s1: setting j as an integer with an initial value of 1;
s2: if J is less than or equal to J, performing step S2, and if J is greater than J, performing step S8;
s3: numbering the N servers according to the sequence of the rest storage spaces fed back by the N servers to obtain the N numbers;
s4: sending M test requests to each server in the N servers at the jth moment according to the sequence of the N numbers from small to large, wherein M is an integer larger than 1;
s5: taking the jth moment as a reference, stopping timing when each server in the N servers feeds back a test response Q, to obtain a time length for processing the test request corresponding to each server in the N servers, where the test response Q is a response fed back latest in the M test responses corresponding to each server in the N servers, and the M test responses corresponding to each server in the N servers are determined according to the M test requests corresponding to each server in the N servers;
s6: determining a second average speed of processing data by each server in the N servers according to the data size of the M test requests corresponding to each server in the N servers and the time length of processing the test requests corresponding to each server in the N servers;
s7: assigning (j +1) to j, returning to execute S2;
s8: acquiring a second average speed of processing data of each server in the N servers, which is determined at each time of the J times;
s9: and determining a first average speed of processing data by each server in the N servers according to the average value of the second average speeds of processing data by each server in the N servers determined at each time in the J times.
5. The method of claim 1, wherein the obtaining N first weights corresponding to the N servers one to one comprises:
acquiring the residual resources corresponding to each server in the N servers;
determining the N first weights according to the residual resources corresponding to each server in the N servers;
wherein the remaining resources corresponding to each of the N servers include at least one of: remaining storage space, remaining memory availability, remaining network availability, and remaining CPU availability.
6. The method according to any one of claims 1-5, further comprising:
if it is detected that a server with a remaining storage space smaller than the preset storage space exists in the N servers, sending N pieces of second indication information to the N servers, wherein the N servers correspond to the N pieces of second indication information one by one, and each piece of second indication information in the N pieces of second indication information is used for indicating each server in the N servers to feed back the remaining resources and the total resources of each server in the N servers;
receiving the residual resources and the total resources sent by each server in the N servers;
determining a ratio between the residual resources corresponding to each server in the N servers and the total resources corresponding to each server in the N servers according to the residual resources and the total resources corresponding to each server in the N servers to obtain N ratios;
determining a server corresponding to the maximum ratio according to the N ratios to obtain a second server;
and storing the data to be stored to the second server.
7. A server selection apparatus, comprising a first obtaining module, a second obtaining module, a first determining module, and a second determining module, wherein,
the first acquisition module is used for acquiring data to be stored;
the second obtaining module is configured to obtain N first weights corresponding to N servers one to one if it is detected that there is no server with a remaining storage space smaller than a preset storage space among the N servers of the server cluster, where N is an integer greater than 1;
the first determining module is configured to determine N third weights corresponding to the N servers one to one according to a difference between a second weight and the N first weights, where the second weight is any one weight in a weight interval, a minimum value of the weight interval is zero, and a maximum value of the weight interval is a sum of the N first weights;
the second determining module is configured to determine, according to the N third weights, a first server that stores the data to be stored from the N servers, where the first server is a server corresponding to a maximum weight in at least one fourth weight, and the at least one fourth weight is a weight that is smaller than a preset weight in the N third weights.
8. The apparatus of claim 7, wherein before obtaining the N first weights corresponding to the N servers, the apparatus further comprises a transceiver module and a detection module,
the transceiver module is configured to send N pieces of first indication information to the N servers, where the N servers correspond to the N pieces of first indication information one to one, and each piece of first indication information in the N pieces of first indication information is used to indicate each server in the N servers to feed back a remaining storage space of each server in the N servers; receiving the residual storage space sent by each server in the N servers;
the detection module is configured to detect whether a server with a remaining storage space smaller than the preset storage space exists in the N servers according to the remaining storage space sent by each server in the N servers.
9. A server-selected electronic device comprising a processor, a memory, a communication interface, and one or more programs, wherein the one or more programs are stored in the memory and are generated as instructions that are executed by the processor to perform the steps of the method of any of claims 1-6.
10. A computer-readable storage medium, characterized in that the computer-readable storage medium is used to store a computer program, which is executed by the processor, to implement the method of any of claims 1-6.
CN202011070019.5A 2020-09-30 2020-09-30 Server selection method and device, electronic equipment and storage medium Pending CN112199043A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011070019.5A CN112199043A (en) 2020-09-30 2020-09-30 Server selection method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011070019.5A CN112199043A (en) 2020-09-30 2020-09-30 Server selection method and device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN112199043A true CN112199043A (en) 2021-01-08

Family

ID=74013094

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011070019.5A Pending CN112199043A (en) 2020-09-30 2020-09-30 Server selection method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN112199043A (en)

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2002374290A (en) * 2001-06-13 2002-12-26 Nippon Telegr & Teleph Corp <Ntt> Server selection device, method, program and recording medium stored with the program
US20050027862A1 (en) * 2003-07-18 2005-02-03 Nguyen Tien Le System and methods of cooperatively load-balancing clustered servers
CN102541655A (en) * 2010-12-31 2012-07-04 ***股份有限公司 Method and device for implementing dynamic load balancing
CN107124472A (en) * 2017-06-26 2017-09-01 杭州迪普科技股份有限公司 Load-balancing method and device, computer-readable recording medium
CN108093009A (en) * 2016-11-21 2018-05-29 百度在线网络技术(北京)有限公司 The load-balancing method and device of a kind of server
CN109597800A (en) * 2018-12-11 2019-04-09 东软集团股份有限公司 A kind of log distribution method and device
CN110333937A (en) * 2019-05-30 2019-10-15 平安科技(深圳)有限公司 Task distribution method, device, computer equipment and storage medium
CN111176843A (en) * 2019-12-23 2020-05-19 中国平安财产保险股份有限公司 Multi-dimension-based load balancing method and device and related equipment

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2002374290A (en) * 2001-06-13 2002-12-26 Nippon Telegr & Teleph Corp <Ntt> Server selection device, method, program and recording medium stored with the program
US20050027862A1 (en) * 2003-07-18 2005-02-03 Nguyen Tien Le System and methods of cooperatively load-balancing clustered servers
CN102541655A (en) * 2010-12-31 2012-07-04 ***股份有限公司 Method and device for implementing dynamic load balancing
CN108093009A (en) * 2016-11-21 2018-05-29 百度在线网络技术(北京)有限公司 The load-balancing method and device of a kind of server
CN107124472A (en) * 2017-06-26 2017-09-01 杭州迪普科技股份有限公司 Load-balancing method and device, computer-readable recording medium
CN109597800A (en) * 2018-12-11 2019-04-09 东软集团股份有限公司 A kind of log distribution method and device
CN110333937A (en) * 2019-05-30 2019-10-15 平安科技(深圳)有限公司 Task distribution method, device, computer equipment and storage medium
CN111176843A (en) * 2019-12-23 2020-05-19 中国平安财产保险股份有限公司 Multi-dimension-based load balancing method and device and related equipment

Similar Documents

Publication Publication Date Title
CN109246229B (en) Method and device for distributing resource acquisition request
CN109547286B (en) CDN node selection method, device and storage medium
CN108075934B (en) Network quality monitoring method, device and system
CN109451002B (en) CDN node selection method and equipment
CN109218133A (en) Network speed testing system, method, apparatus and computer readable storage medium
CN106714324B (en) A kind of method and device of scheduling of resource
CN110162270B (en) Data storage method, storage node and medium based on distributed storage system
CN110888658B (en) Method and device for dynamically changing function modules in application program and storage medium
CN112199175B (en) Task queue generating method, device and equipment
CN110650209A (en) Method and device for realizing load balance
CN106375102A (en) Service registration method, application method and correlation apparatus
CN112099982A (en) Collapse information positioning method, device, medium and electronic equipment
CN111538572A (en) Task processing method, device, scheduling server and medium
CN113422808B (en) Internet of things platform HTTP information pushing method, system, device and medium
CN114553762A (en) Method and device for processing flow table items in flow table
US20220035666A1 (en) Method and apparatus for data processing, server and storage medium
EP3672203A1 (en) Distribution method for distributed data computing, device, server and storage medium
CN111159131A (en) Performance optimization method, device, equipment and computer readable storage medium
CN112199043A (en) Server selection method and device, electronic equipment and storage medium
CN112187924A (en) Service request method, device, equipment and computer storage medium
CN109617988B (en) Request retry method and related product
CN111736761A (en) Data distribution method, device, storage system and computer readable storage medium
CN110209548B (en) Service control method, system, electronic device and computer readable storage medium
CN113271228B (en) Bandwidth resource scheduling method, device, equipment and computer readable storage medium
CN114338386A (en) Network configuration method and device, electronic equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
CB02 Change of applicant information

Address after: 518000 Room 201, building A, No. 1, Qian Wan Road, Qianhai Shenzhen Hong Kong cooperation zone, Shenzhen, Guangdong (Shenzhen Qianhai business secretary Co., Ltd.)

Applicant after: ONECONNECT FINANCIAL TECHNOLOGY Co.,Ltd. (SHANGHAI)

Address before: Room 201, Building A, No. 1 Qianwan Road, Qianhaisheng Cooperation Zone, Shenzhen City, Guangdong Province, 518000

Applicant before: ONECONNECT FINANCIAL TECHNOLOGY Co.,Ltd. (SHANGHAI)

CB02 Change of applicant information
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination