Disclosure of Invention
In order to solve the above problems in the prior art, the present invention provides a data reading method in cloud computing.
The technical scheme adopted by the invention is as follows:
a data reading method in cloud computing comprises the following steps:
step 1: a cloud computing task executed by a cloud computing server A sends a reading request to a logic storage layer of the cloud computing server A;
step 2: the logic storage layer analyzes the reading request and determines the actual storage position of the reading target; the actual storage positions comprise local and other n cloud computing servers;
and step 3: the logic storage layer estimates the time T of reading data from the local according to the reading request and the actual storage position of the reading target0And the time to read data from each of the other n cloud computing servers;
and 4, step 4: the logic storage layer is used for sequencing the data reading time of the n cloud computing servers from large to small; the n sorted data have the reading time T1,T2,……,Tn;TiThe corresponding cloud computing server is marked as Bi(1≤i≤n);
And 5: the logic storage layer sequentially sends data reading requests to corresponding cloud computing servers according to the sequence;
step 6: for data needing local reading, the logic storage layer judges T0And T1If T is0≥T1Then the logical storage layer is facing to cloud computing server B1Sending a data reading request to a local physical storage layer at the same time of sending the data reading request; if T is0<T1Then the logical storage layer is facing to cloud computing server B1After sending the data read request, wait for T1-T0Sending a data reading request to a local physical storage layer;
and 7: each cloud computing server BiReading corresponding data according to the received data reading request, and returning the corresponding data to the logic storage layer of the cloud computing server A; the physical storage layer of the cloud computing server A also reads corresponding data from the local according to the received data reading request and returns the data to the logic storage layer; the logic storage layer stores the received data in a designated cache region;
and 8: and the logic storage layer returns the pointer of the cache region to the cloud computing task.
Further, the logical storage layer estimates a time to read from local based on an amount of local data that needs to be read.
Further, the specific method for estimating the data reading time of the cloud computing server a for another cloud computing service B by the logic storage layer includes: counting the time of reading data from the cloud computing server B each time by the cloud computing server A in a past period of time, and estimating the time of reading data from the cloud computing server B this time based on the counting.
Further, the time when the cloud computing server a reads the data amount basically the same as that of the current reading from the cloud computing server B is counted, and the average value of the times is taken as the estimated value of the current reading time.
Further, the network transmission time of the data between the servers A and B is estimated through a transmission test, and after the network transmission time is deducted, the speed of reading the data locally by the server B is estimated every time, so that the time of reading the data locally by the server B is estimated according to the data volume read this time, and the estimated network transmission time is added to obtain the time of reading the data from the server B this time.
Further, the step 5 comprises:
the logical storage layer firstly sends the data to a cloud computing server B1Sending a data reading request to any other cloud computing server Bj(1 < j ≦ n), if Tj-1-TjIf the value is less than the predefined threshold value, the logic storage layer is facing the cloud computing server Bj-1After the data reading request is sent, the data is immediately sent to the cloud computing server BjSending a data reading request; if T isj-1-TjNot less than the predefined threshold, the logical storage layer is facing the cloud computing server Bj-1After sending the data reading request, waiting for Tj-1-TjAfter the time, the cloud computing server B is started againjA data read request is sent.
Further, after the cloud computing task acquires the data which needs to be read, the logic storage layer is informed to release the cache area.
The invention has the beneficial effects that: invalid occupation of the cache is reduced, and the utilization efficiency of system resources is improved.
Detailed Description
The present invention will now be described in detail with reference to the drawings and specific embodiments, wherein the exemplary embodiments and descriptions are provided only for the purpose of illustrating the present invention and are not to be construed as limiting the present invention.
Referring to fig. 1, a cloud computing system architecture to which the present invention relates is illustrated. The cloud computing system comprises a plurality of cloud computing servers which are connected together through a network, wherein the network can be a local area network or the internet, and each server can execute a specified cloud computing task.
In order to execute the cloud computing task, the storage system of each server is divided into an application layer, a logic storage layer and a physical storage layer. The application layer includes a server running each program, such as the cloud computing task. The logical storage layer is used for shielding the specific physical storage mode from the application layer and providing a corresponding storage interface for the application layer, and therefore the application layer does not need to care where the specific data is stored. The physical storage layer is used for managing a specific physical storage mode, receiving and executing a read-write command of the logic storage layer, and returning a corresponding result.
Based on the above system architecture, the data reading method of the present invention is described in detail below.
Step 1: the cloud computing task executed by the cloud computing server A sends a reading request to the logic storage layer of the cloud computing server A.
Specifically, the logic storage layer may provide a corresponding data reading interface, and the cloud computing task calls the data reading interface to make a reading request. The call parameters of the interface (also the content of the read request) include the target of the read (e.g. a file, or a logical object) and the amount of data read. Multiple read targets may also be included in a read request.
Step 2: the logic storage layer analyzes the read request and determines the actual storage position of the read target.
In the cloud computing system, data is stored in a distributed manner through a server cluster, and even if the same reading target is the same, the data can be stored in different cloud computing servers in a split manner. Therefore, the logical storage layer needs to determine the actual storage location of the read target according to the actual situation. The specific cloud computing storage organization method is already the content of the prior art, and is not described herein again.
Obviously, if the actual storage location is local, the logical storage layer reads data directly from the local physical storage layer. However, the method of the present invention is directed to the case where the actual storage location further includes other cloud computing servers.
Therefore, in particular, the logical storage layer determines that the actual storage location of the read target includes the local (i.e., the cloud computing server a itself), and the other n cloud computing servers.
And step 3: the logic storage layer estimates the time T of reading data from the local according to the reading request and the actual storage position of the reading target0And a time to read data from each of the other n cloud computing servers.
The time for reading the data from the local means the time for reading the local data to be read completely into the cache or the memory. In general, the time to read data locally depends on the amount of data read, so the logical storage layer can estimate the time to read locally (denoted as T) according to the amount of local data that needs to be read0The same applies below).
The time for reading data from the other servers depends on the one hand on the amount of data read and on the other hand on the time for transmitting data over the network, including the time for transmitting data requests from the cloud computing server a to the other servers and the time for transmitting read data from the other servers to the cloud computing server a. For example, if the logical storage layer is to estimate data reading time of the cloud computing server a for another cloud computing service B, the logical storage layer may count time of each time the cloud computing server a reads data from the cloud computing server B in a past period of time, and estimate time of this time of reading data from the cloud computing server B based on the statistics. An alternative mode is to count the time for reading the data volume (for example, the difference between the data volume and the data volume read this time is within 1 mbyte) from the cloud computing server B, and take the average value of the times as the estimated value of the time read this time. Another alternative is to estimate the network transmission time of the data between the servers a and B by a transmission test (e.g. ping), and after deducting the network transmission time, estimate the speed of reading the data locally by the server B each time, so as to estimate the time of reading the data locally by the server B according to the data amount read this time, and then, in combination with the estimated network transmission time, obtain the time of reading the data from the server B this time. Other estimation methods may be used by those skilled in the art, and the present invention is not limited in this regard.
And 4, step 4: and the logic storage layer is used for sequencing the data reading time of the n cloud computing servers from large to small.
Specifically, it is not necessary to set the n data read times after the sorting as T1,T2,……,Tn;TiThe corresponding cloud computing server is marked as Bi(i is more than or equal to 1 and less than or equal to n). Thus, it can be expected that from cloud computing server B1The time taken to read the data is the most, and the overall data reading time is actually determined by T1。
And 5: and the logic storage layer sequentially sends data reading requests to the corresponding cloud computing servers according to the sequence.
Specifically, the logical storage layer firstly sends the data to the cloud computing server B1Sending a data reading request and then sending the data reading request to a cloud computing server B2Sending a data reading request, and so on until the cloud computing server Bn。
For any one of the cloud computing servers Bj(1 < j ≦ n), if Tj-1-TjIf the value is less than the predefined threshold value, the logic storage layer is facing the cloud computing server Bj-1After the data reading request is sent, the data is immediately sent to the cloud computing server BjSending data readsFetching a request; that is, to Bj-1And BjThe transmission data read request is continuously transmitted. If T isj-1-TjNot less than the predefined threshold, the logical storage layer is facing the cloud computing server Bj-1After the data reading request is sent, waiting for a period of time, and sending the data to a cloud computing server BjSending a data read request, waiting for a time equal to Tj-1-Tj。
Based on this step 5, the logical storage layer allows each cloud computing server to return data in substantially the same time by controlling the sending time of the data read request.
Step 6: for data needing local reading, the logic storage layer judges T0And T1If T is0≥T1Then the logical storage layer is facing to cloud computing server B1Sending a data reading request to a local physical storage layer at the same time of sending the data reading request; if T is0<T1Then the logical storage layer is facing to cloud computing server B1After sending the data read request, wait for T1-T0And sending a data reading request to the local physical storage layer.
In general, the time estimate for reading data locally is reliable because it is not affected by network conditions, whereas reading data from other servers may be affected by network conditions, and thus even at T0≥T1For server B1Should also not be later than the local data read request, in which case both are starting data read requests as early as possible at the same time.
And 7: each cloud computing server BiReading corresponding data according to the received data reading request, and returning the corresponding data to the logic storage layer of the cloud computing server A; and the physical storage layer of the cloud computing server A also reads corresponding data from local according to the received data reading request and returns the data to the logic storage layer.
After step 7 is completed, the logical storage layer of the cloud computing server a receives data to be read from the other n cloud computing servers and the local physical storage layer, and the received data are stored in the designated cache area.
And 8: and the logic storage layer returns a cache region pointer for storing the read data to the cloud computing task.
Therefore, the cloud computing task of the application layer obtains the data which needs to be read, and then the cloud computing task can inform the logic storage layer to release the cache region.
Based on the steps of the method, the time for reading data is controlled by the logic storage layer, the invalid occupation of the cache is reduced, and the utilization efficiency of system resources is improved.
The above description is only a preferred embodiment of the present invention, and all equivalent changes or modifications of the structure, characteristics and principles described in the present invention are included in the scope of the present invention.