CN105511813A - Method, device and system for accessing server disk - Google Patents

Method, device and system for accessing server disk Download PDF

Info

Publication number
CN105511813A
CN105511813A CN201510921157.2A CN201510921157A CN105511813A CN 105511813 A CN105511813 A CN 105511813A CN 201510921157 A CN201510921157 A CN 201510921157A CN 105511813 A CN105511813 A CN 105511813A
Authority
CN
China
Prior art keywords
server
terminal
locking
data content
disk
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
CN201510921157.2A
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.)
Beijing Qihoo Technology Co Ltd
Beijing Qianxin Technology Co Ltd
Original Assignee
Beijing Qihoo Technology Co Ltd
Beijing Qianxin Technology Co Ltd
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 Beijing Qihoo Technology Co Ltd, Beijing Qianxin Technology Co Ltd filed Critical Beijing Qihoo Technology Co Ltd
Priority to CN201510921157.2A priority Critical patent/CN105511813A/en
Publication of CN105511813A publication Critical patent/CN105511813A/en
Pending legal-status Critical Current

Links

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/0668Interfaces specially adapted for storage systems adopting a particular infrastructure
    • G06F3/0671In-line storage system
    • G06F3/0673Single storage device
    • G06F3/0674Disk device
    • 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
    • G06F3/0631Configuration or reconfiguration of storage systems by allocating resources to storage systems

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Human Computer Interaction (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention discloses a method, a device and a system for accessing a server disk and relates to the technical field of internet in order to solve the problem that a large number of terminals access the server disk simultaneously. The method comprises steps as follows: a terminal accesses a server memory and reads data content; if the data content is stored in the server memory, a server returns the data content in the server memory to the terminal; if the data content is not stored in the server memory, the terminal requests the server for locking; if the server does not lock another terminal, the server starts a locking program to lock the terminal; the terminal after locking accesses the server disk and reads the data content; if the server locks another terminal, the terminal requests the server for locking again after the another terminal is unlocked. The method, the device and the system for accessing the server disk are mainly applied to an intranet management process of an enterprise.

Description

Method, device and system for accessing server disk
Technical Field
The invention relates to the technical field of internet, in particular to a method, a device and a system for accessing a server disk.
Background
In an intranet, there are often cases where a plurality of terminals request the same resource from a server. For example, an employee computer requests a server to update a virus library, or requests to obtain monitoring configuration information. In the prior art, data resources requested by a terminal are usually stored on a disk of a server, and different terminals respectively establish connection with the server, access the disk of the server, and read the required data resources.
Because each terminal independently initiates a disk access request to the server, the read-write pressure of the server disk is very large. In order to reduce the read-write pressure of a server disk, people improve the existing access mode: the server caches the data resource needed by the terminal in the server memory, and when the terminal requests the data resource, the server reads the data resource from the memory and returns the data resource to the terminal. The method can effectively reduce the times of the terminal accessing the server disk. However, the way of reading data resources from the server memory also has certain problems: the server memory can not store data permanently, and the data resource requested by the terminal does not exist any more after the server clears the memory. According to the existing implementation, the terminal still needs to access the server disk for reading. This results in a large number of terminals simultaneously accessing the server disk at a moment, causing a greater impact on the server disk.
Disclosure of Invention
The invention provides a method, a device and a system for accessing a server disk, which can solve the problem that a large number of terminals simultaneously access the server disk.
In order to solve the above problem, in a first aspect, the present invention provides a method for accessing a server disk, where the method is applied to a terminal side, and the method includes:
accessing a server memory and reading data contents;
if the data content is not stored in the server memory, requesting to lock the server;
if the server does not lock other terminals, accessing a server disk after locking, and reading data content;
if the server locks other terminals, the server requests locking to the server again after waiting for unlocking of other terminals;
wherein, the locking program of the server only allows one terminal to access the server disk at the same time.
In a second aspect, the present invention further provides a method for accessing a server disk, where the method is applied to a server side, and the method includes:
receiving a data request sent by a terminal, wherein the data request is used for requesting data content of a server side;
if the data content is stored in the server memory, returning the data content in the server memory to the terminal;
if the data content is not stored in the memory of the server, starting a locking program to lock the terminal, so that the terminal in a locked state accesses a server disk, acquires the data content, and enables other terminals which are not locked to wait for locking;
wherein, the locking program only allows one terminal to access the server disk at the same time.
In a third aspect, the present invention further provides an apparatus for accessing a server disk, where the apparatus is located at a terminal side, and the apparatus includes:
the read-write unit is used for accessing the memory of the server and reading data contents;
the request unit is used for requesting the server to lock when the data content is not stored in the memory of the server;
the read-write unit is used for accessing the server disk after locking when the server does not lock other terminals and reading data contents;
the request unit is used for requesting locking to the server again after waiting for unlocking of other terminals when the server locks other terminals;
wherein, the locking program of the server only allows one terminal to access the server disk at the same time.
In a fourth aspect, the present invention further provides an apparatus for accessing a server disk, where the apparatus is located on a server side, and the apparatus includes:
the receiving unit is used for receiving a data request sent by a terminal, and the data request is used for requesting data content of a server side;
the sending unit is used for returning the data content in the server memory to the terminal when the data content is stored in the server memory;
the locking and unlocking unit is used for starting a locking program to lock the terminal when the data content is not stored in the memory of the server, so that the terminal in a locked state accesses the disk of the server, acquires the data content and enables other terminals which are not locked to wait for locking;
wherein, the locking program only allows one terminal to access the server disk at the same time.
In a fifth aspect, the present invention further provides a system for accessing a server disk, where the system includes a terminal and a server, where:
the terminal comprises the device of the third aspect;
the server comprises the apparatus of the fourth aspect.
The method, the device and the system for accessing the server disk can enable the terminal to access the server memory firstly when the terminal needs to request the data content of the server side, and if the data content is stored in the server memory, the server returns the data content to the terminal; and if the data content is not stored in the memory of the server, the terminal accesses the disk of the server. Before accessing a server disk, a terminal firstly requests locking to the server, the terminal can access the server disk only after locking, and otherwise, the terminal requests locking after waiting for the server to unlock other terminals. The invention can limit the number of the terminals accessing the server disk by the locking degree, and only one terminal is allowed to access the server disk at the same time. Compared with the prior art, the number of the terminals requesting to call the I/O port of the server disk at the same time does not exceed one no matter the number of the terminals accessing the server disk, so the invention can effectively eliminate the impact on the server disk caused by simultaneous access of a large number of terminals.
The foregoing description is only an overview of the technical solutions of the present invention, and the embodiments of the present invention are described below in order to make the technical means of the present invention more clearly understood and to make the above and other objects, features, and advantages of the present invention more clearly understandable.
Drawings
Various other advantages and benefits will become apparent to those of ordinary skill in the art upon reading the following detailed description of the preferred embodiments. The drawings are only for purposes of illustrating the preferred embodiments and are not to be construed as limiting the invention. Also, like reference numerals are used to refer to like parts throughout the drawings. In the drawings:
fig. 1 is a flowchart illustrating a first method for accessing a server disk according to an embodiment of the present invention;
fig. 2 is a flowchart illustrating a second method for accessing a server disk according to an embodiment of the present invention;
FIG. 3 is a flowchart illustrating a third method for accessing a server disk according to an embodiment of the present invention;
fig. 4 is a flowchart illustrating a fourth method for accessing a server disk according to an embodiment of the present invention;
FIG. 5 is a block diagram illustrating a first apparatus for accessing a server disk according to an embodiment of the present invention;
FIG. 6 is a block diagram illustrating a second apparatus for accessing a server disk according to an embodiment of the present invention;
FIG. 7 is a block diagram illustrating a third apparatus for accessing a server disk according to an embodiment of the present invention;
fig. 8 is a schematic diagram of a system for accessing a server disk according to an embodiment of the present invention.
Detailed Description
Exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be embodied in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.
The embodiment of the invention provides a method for accessing a server disk, which is applied to a terminal side. As shown in fig. 1, the method includes:
101. and accessing the memory of the server and reading the data content.
When a terminal needs to request a certain data content from a server (for example, a virus library to be updated), the terminal initiates a Transmission Control Protocol (TCP) connection to the server, completes establishment of the TCP connection between the server and the terminal after three-way handshake, and sends a data request carrying a data content identifier to the server. The server searches the data content corresponding to the content identification in the memory, and if the data content is cached, the server returns the searched data content to the terminal. If the data content is not cached, the terminal performs step 102 to request locking and access the server disk.
In this embodiment, if the server does not cache the corresponding data content, the server may send a notification to the terminal based on the TCP connection, and notify that the data content is not stored in the memory of the terminal server, and the terminal starts to execute step 102 according to the notification. Or the server may not notify the terminal server, and the terminal does not receive the data content within a preset time after initiating the data request, then step 102 is automatically executed.
102. And if the data content is not stored in the server memory, requesting the server for locking.
The server side is deployed with a set of locking program, the program is used for locking terminals accessing the server disk, only the locked terminals can access the server disk, and terminals which are not locked (for example, terminals waiting to be locked) cannot access the server disk. In this embodiment, the locking program of the server only allows one terminal to access the server disk at the same time. Therefore, a large number of terminals can be effectively prevented from accessing the server disk at the same time.
In one implementation of this embodiment, the locking program is a spin lock program. Spin locks provide a mechanism for exclusive use of resources, i.e., at most one keeper can be allowed to access a resource at any time, i.e., at most one execution unit can obtain a lock at any time.
103. And if the server does not lock other terminals, accessing the server disk after locking, and reading the data content.
And if the locking program is idle, namely no other terminal locks to access the server disk currently, the server executes the locking program to lock the terminal requesting locking. After the locking is completed, the terminal is allowed to access the server disk and read the data content corresponding to the content identification from the server disk.
104. And if the server locks other terminals, waiting for unlocking of other terminals and then requesting locking from the server again.
And if the locking program is occupied, namely other terminals access the server disk by using the locking service at present, the server does not respond to the locking request of the terminal. Before the locking response is not received, the terminal is in a continuous waiting state, and the locking request of the terminal is responded after the server unlocks other terminals.
And when the locked other terminals finish accessing the server disk, the server unlocks the server disk, the locking program is idle after unlocking, and the server locks the terminal waiting for locking so that the locked terminal accesses the server disk.
When a plurality of terminals wait for locking, the server can respond to the locking requests of the terminals according to the sequence of the locking requests, and can also respond to the locking according to the priority level or the grading level of the terminals. The scoring refers to scoring for services given by the terminal side, and a user can score the data request according to the service requirement of the user, wherein the higher the score is, the more urgent the service is. And the terminal sends the scores to the server together when reporting the data request.
The method for accessing the server disk provided by the embodiment of the invention can firstly enable the terminal to access the server memory when the terminal needs to request the data content of the server side, and if the data content is stored in the server memory, the server returns the data content to the terminal; and if the data content is not stored in the memory of the server, the terminal accesses the disk of the server. Before accessing a server disk, a terminal firstly requests locking to the server, the terminal can access the server disk only after locking, and otherwise, the terminal requests locking after waiting for the server to unlock other terminals. The embodiment of the invention can limit the number of the terminals accessing the server disk by the locking degree, and only one terminal is allowed to access the server disk at the same time. Compared with the prior art, the number of the terminals requesting to call the I/O port of the server disk at the same time does not exceed one no matter the number of the terminals accessing the server disk, so the embodiment of the invention can effectively eliminate the impact on the server disk caused by simultaneous access of a large number of terminals.
Further, the embodiment of the invention also provides a method for accessing the server disk, which is applied to the server side. As shown in fig. 2, the method includes:
201. and receiving a data request sent by the terminal.
After establishing a TCP connection with a terminal, a server receives a data request sent by the terminal, wherein the data request carries a content identifier of data content required to be requested by the terminal and is used for requesting the data content of a server side. And the server searches the data content required by the terminal according to the content identification.
When a plurality of terminals send data requests to the server, the server responds to the terminals according to the sequence of receiving the data requests. Of course, in some implementations, the server may also decide the response order according to the priority level of the terminal, or according to the ranking order of the terminal. The scoring refers to scoring for the service given by the terminal side, and a user can score the data request according to the service requirement of the user, wherein the higher the score is, the more urgent the service is. And the terminal sends the scores to the server together when reporting the data request.
202. And if the data content is stored in the server memory, returning the data content in the server memory to the terminal.
After receiving the data request, the server first searches the data content corresponding to the content identifier in the memory, and if the data content is cached in the memory, the server responds to the terminal and returns the searched data content to the terminal.
When a plurality of terminals request data contents, the server can respond to each terminal one by one according to the request sequence or priority and the like, and the cached data contents are sent to each terminal. It is also possible to respond to all terminals simultaneously when parallel processing conditions exist.
203. And if the data content is not stored in the memory of the server, starting a locking program to lock the terminal.
In one implementation of this embodiment, the locking program is a spin lock program. When a plurality of terminals request data contents and the requested data contents are not cached in a server memory, the server locks a certain terminal to access a server disk, and other terminals are in a waiting state through a locking mechanism. The selection mode for a certain terminal may be:
1. and locking the terminal corresponding to the data request received first according to the sequence of the received data requests.
2. And locking the terminal with the highest priority according to the sequence of the terminal priorities from high to low.
3. And locking the terminal with the highest score according to the sequence of the scores from high to low.
In this embodiment, the locking program only allows one terminal to access the server disk at the same time. Therefore, the situation that a plurality of terminals access the server disk simultaneously can be avoided.
And after the locked terminal completes the access of the server disk and obtains the data content, the server unlocks the terminal and then locks the next terminal so that the next terminal accesses the server disk. The selection of the next terminal may be determined according to the sorting manner given in the above 1, 2, or 3, which is not described again in this embodiment.
The method for accessing the server disk provided by the embodiment of the invention can firstly enable the terminal to access the server memory when the terminal needs to request the data content of the server side, and if the data content is stored in the server memory, the server returns the data content to the terminal; and if the data content is not stored in the memory of the server, the terminal accesses the disk of the server. Before accessing a server disk, a terminal firstly requests locking to the server, the terminal can access the server disk only after locking, and otherwise, the terminal requests locking after waiting for the server to unlock other terminals. The embodiment of the invention can limit the number of the terminals accessing the server disk by the locking degree, and only one terminal is allowed to access the server disk at the same time. Compared with the prior art, the number of the terminals requesting to call the I/O port of the server disk at the same time does not exceed one no matter the number of the terminals accessing the server disk, so the embodiment of the invention can effectively eliminate the impact on the server disk caused by simultaneous access of a large number of terminals.
Further, as a refinement of the method shown in fig. 1 or fig. 2, an embodiment of the present invention further provides a method for accessing a server disk, where the method involves a terminal and two sides of a server. As shown in fig. 3, the method includes:
301. and the terminal accesses the memory of the server and reads the data content.
302. And if the data content is stored in the server memory, the server returns the data content in the server memory to the terminal.
303. And if the data content is not stored in the server memory, the terminal requests the server for locking.
When the terminal requests the server for locking, two situations can be met, one is that the locking program at the server side is occupied by other terminals, and the step 304 is executed in the situation; secondly, the locking program on the server side is not occupied by other terminals, in which case steps 305 to 309 are performed.
304. And if the server locks other terminals, the terminal requests the server for locking again after waiting for unlocking other terminals.
When the locking program is occupied by other terminals, the server does not respond to the locking request of the terminal, the terminal is in a continuous waiting state, and after waiting for unlocking of other terminals and the locking of the terminal is started, steps 305 to 309 are executed.
Further, in practical applications, such problems may be encountered: the number of terminals requesting data content from the server is large, the time for a certain terminal to wait for locking may be long, and the long waiting time cannot be received by the service quality of the terminal side. Thus in a refinement of this embodiment, the terminal may give up waiting if after waiting for a period of time if the locking has not been successful, thereby preventing long occupation of the TCP connection and indefinite waiting for the user. This is of course done at the expense of a data request failure. Specifically, the server may start a timer for the terminal when the terminal requests locking, and record the current waiting time from the start of the terminal requesting locking. When the waiting time exceeds the preset maximum waiting time (for example, 1 minute or 30 seconds), the server stops timing and sends a notification of canceling the waiting to the terminal. And after receiving the notification, the terminal does not wait for locking and returns a message of data request failure to the front end.
Or, the terminal starts a timer when requesting to lock, and records the waiting time from the start of requesting to lock to the current time. And when the waiting time length exceeds the preset maximum waiting time length, the locking response of the server is not received, the terminal sends a notification of canceling the waiting to the server, and returns a message of data request failure to the front end.
305. And if the server does not lock other terminals, the server starts a locking program to lock the terminals.
306. And the terminal accesses the server disk after locking and reads the data content.
307. After reading the data content, the terminal informs the server to unlock so that the server locks other terminals.
308. And the server unlocks the terminal.
309. And the server locks other terminals to be locked.
In this embodiment, when the time for the terminal to wait for locking is too long, the terminal may actively or passively abandon the waiting for locking, thereby preventing long-time occupation of the TCP connection and indefinite waiting for the user.
Further, as a refinement of the method shown in fig. 1 or fig. 2, an embodiment of the present invention further provides a method for accessing a server disk, where the method involves a terminal and two sides of a server. Different from the method shown in fig. 3, in the method, after the terminal that accesses the server disk first reads the data content, the data content is written into the server memory. Therefore, other terminals can directly access the server memory to obtain the data content without requesting or waiting for the server to lock. As shown in fig. 4, the method includes:
401. and the terminal accesses the memory of the server and reads the data content.
402. And if the data content is stored in the server memory, the server returns the data content in the server memory to the terminal.
403. And if the data content is not stored in the server memory, the terminal requests the server for locking.
404. And if the server locks other terminals, the terminal accesses the memory of the server again.
In the scheme shown in fig. 3, if the server locks other terminals, the terminal waits for the server to unlock other terminals, and then locks to access the server disk. In this embodiment, after the terminal that first requests the data content completes access to the server disk, the server caches the data content acquired from the disk in the server memory. Therefore, the terminal waiting for locking directly obtains the data content from the memory of the server without accessing the server disk, thereby reducing the access times of the server disk and further reducing the load pressure of the server disk.
Specifically, when the terminal requests locking and the locking program of the server is occupied, the terminal may access the server memory again by itself or according to a notification returned by the server. If the other terminal obtains the data content from the server disk after step 401, the server writes the data content into the server memory. At this time, the terminal accesses the server memory again to obtain the newly added data content.
405. And if the data content is newly added in the memory of the server, the terminal reads the data content.
406. The terminal cancels the request for locking again to the server.
After the data content is acquired from the server memory, the terminal does not need to wait for locking to access the server disk, so that the terminal cancels the requirement of locking to the server again.
407. And if the data content is not stored in the memory of the server, the terminal requests the server for locking again.
If the data content is not stored in the memory of the server, the terminal is the first terminal requesting the data content. To obtain the data content, the terminal must request a lock from the server to access the server disk.
408. And if the server does not lock other terminals, the server starts a locking program to lock the terminals.
409. And the terminal accesses the server disk after locking and reads the data content.
410. And after the terminal finishes accessing the server disk, the server writes the data content read from the server disk into the server memory.
Thus, when the same data content is requested by the other terminal in the following, the data content can be acquired by performing step 401 without performing steps 402 to 410.
Further, as an implementation of the methods shown in fig. 1, fig. 3, and fig. 4, an embodiment of the present invention further provides a device for accessing a server disk, where the device is located at a terminal side, or is independent of the terminal but has a data interaction relationship with the terminal. As shown in fig. 5, the apparatus includes: a read/write unit 51 and a request unit 52. Wherein,
the read-write unit 51 is used for accessing a server memory and reading data contents;
a requesting unit 52, configured to request the server to lock when the server memory does not store the data content;
the read-write unit 51 is used for accessing a server disk after locking when the server does not lock other terminals, and reading data contents;
the requesting unit 52 is configured to, when the server locks another terminal, wait for the other terminal to unlock and then request the server for locking again;
wherein, the locking program of the server only allows one terminal to access the server disk at the same time.
Further, the read-write unit 51 is configured to:
after other terminals are unlocked, the memory of the server is accessed again;
if the data content is newly added in the memory of the server, reading the data content;
a request unit 52 for canceling the lock request from the server again.
Further, the requesting unit 52 is configured to request locking from the server again when the data content is not stored in the server memory.
Further, the requesting unit 52 is configured to notify the server to unlock after accessing the server disk and reading the data content, so that the server locks other terminals.
Further, the locking program requested to be executed by the requesting unit 52 is a spinlock program.
The device for accessing the server disk provided by the embodiment of the invention can firstly enable the terminal to access the server memory when the terminal needs to request the data content of the server side, and if the data content is stored in the server memory, the server returns the data content to the terminal; and if the data content is not stored in the memory of the server, the terminal accesses the disk of the server. Before accessing a server disk, a terminal firstly requests locking to the server, the terminal can access the server disk only after locking, and otherwise, the terminal requests locking after waiting for the server to unlock other terminals. The embodiment of the invention can limit the number of the terminals accessing the server disk by the locking degree, and only one terminal is allowed to access the server disk at the same time. Compared with the prior art, the number of the terminals requesting to call the I/O port of the server disk at the same time does not exceed one no matter the number of the terminals accessing the server disk, so the embodiment of the invention can effectively eliminate the impact on the server disk caused by simultaneous access of a large number of terminals.
Further, as an implementation of the methods shown in fig. 2, fig. 3, and fig. 4, an embodiment of the present invention further provides an apparatus for accessing a server disk, where the apparatus is located on a server side, or is independent of the server but has a data interaction relationship with the server. As shown in fig. 6, the apparatus includes: a receiving unit 61, a transmitting unit 62 and an unlocking unit 63. Wherein,
a receiving unit 61, configured to receive a data request sent by a terminal, where the data request is used to request data content on a server side;
a sending unit 62, configured to return the data content in the server memory to the terminal when the data content is stored in the server memory;
the locking and unlocking unit 63 is used for starting a locking program to lock the terminal when the data content is not stored in the memory of the server, so that the terminal in a locked state accesses the server disk, obtains the data content, and enables other terminals which are not locked to wait for locking;
wherein, the locking program only allows one terminal to access the server disk at the same time.
Further, as shown in fig. 7, the apparatus further includes a read-write unit 64, configured to write the data content read from the server disk into the server memory after the terminal completes accessing the server disk, so that another terminal waiting for locking reads the data content from the server memory.
Further, the locking and unlocking unit 63 is configured to:
after the terminal finishes accessing the server disk, unlocking the terminal;
and locking other terminals to be locked.
Further, the locking program executed by the locking and unlocking unit 63 is a spin lock program.
The device for accessing the server disk provided by the embodiment of the invention can firstly enable the terminal to access the server memory when the terminal needs to request the data content of the server side, and if the data content is stored in the server memory, the server returns the data content to the terminal; and if the data content is not stored in the memory of the server, the terminal accesses the disk of the server. Before accessing a server disk, a terminal firstly requests locking to the server, the terminal can access the server disk only after locking, and otherwise, the terminal requests locking after waiting for the server to unlock other terminals. The embodiment of the invention can limit the number of the terminals accessing the server disk by the locking degree, and only one terminal is allowed to access the server disk at the same time. Compared with the prior art, the number of the terminals requesting to call the I/O port of the server disk at the same time does not exceed one no matter the number of the terminals accessing the server disk, so the embodiment of the invention can effectively eliminate the impact on the server disk caused by simultaneous access of a large number of terminals.
Further, as an implementation of the method shown in fig. 1 to fig. 4, an embodiment of the present invention further provides a system for accessing a server disk, as shown in fig. 8, where the system includes a terminal 81 and a server 82, where:
the terminal 81 includes the device shown in fig. 5, or is independent of the device but has a data interaction relationship with the device;
the server 82 includes the apparatus shown in fig. 6 or fig. 7 described above, or is independent of the apparatus but has a data interaction relationship with the apparatus.
The system for accessing the server disk provided by the embodiment of the invention can firstly enable the terminal to access the server memory when the terminal needs to request the data content of the server side, and if the data content is stored in the server memory, the server returns the data content to the terminal; and if the data content is not stored in the memory of the server, the terminal accesses the disk of the server. Before accessing a server disk, a terminal firstly requests locking to the server, the terminal can access the server disk only after locking, and otherwise, the terminal requests locking after waiting for the server to unlock other terminals. The embodiment of the invention can limit the number of the terminals accessing the server disk by the locking degree, and only one terminal is allowed to access the server disk at the same time. Compared with the prior art, the number of the terminals requesting to call the I/O port of the server disk at the same time does not exceed one no matter the number of the terminals accessing the server disk, so the embodiment of the invention can effectively eliminate the impact on the server disk caused by simultaneous access of a large number of terminals.
The embodiment of the invention discloses:
a1, a method for accessing server disk, the method is applied to terminal side, characterized in that, the method includes:
accessing a server memory and reading data contents;
if the data content is not stored in the server memory, requesting to lock the server;
if the server does not lock other terminals, accessing a server disk after locking, and reading the data content;
if the server locks other terminals, the server requests locking to the server again after waiting for unlocking of other terminals;
wherein, the locking program of the server only allows one terminal to access the server disk at the same time.
A2, the method according to A1, wherein after the other terminal is unlocked, the method further comprises:
the memory of the server is accessed again;
if the data content is newly added in the memory of the server, reading the data content;
canceling again the request for locking to the server.
A3, the method according to A2, wherein the requesting locking again from the server comprises:
and if the data content is not stored in the memory of the server, locking is requested to the server again.
A4, the method according to A1, wherein after accessing a server disk and reading the data content, the method further comprises:
and informing the server to unlock so that the server locks other terminals.
A5, the method according to any of A1 to 4, wherein the locking program is a spin lock program.
B6, a method for accessing a server disk, the method being applied to the server side, the method comprising:
receiving a data request sent by a terminal, wherein the data request is used for requesting data content of a server side;
if the data content is stored in the server memory, returning the data content in the server memory to the terminal;
if the data content is not stored in the memory of the server, starting a locking program to lock the terminal, so that the terminal in a locked state accesses a server disk, acquires the data content, and enables other terminals which are not locked to wait for locking;
wherein the locking program allows only one terminal to access the server disk at the same time.
B7, the method according to B6, characterized in that the method further comprises:
and after the terminal finishes accessing the server disk, writing the data content read from the server disk into a server memory, so that other terminals waiting for locking read the data content from the server memory.
B8, the method according to B6, characterized in that the method further comprises:
after the terminal finishes accessing a server disk, unlocking the terminal;
and locking other terminals to be locked.
B9, the method according to any of B6 to 8, wherein the locking program is a spin lock program.
C10, an apparatus for accessing a server disk, the apparatus being located on a terminal side, the apparatus comprising:
the read-write unit is used for accessing the memory of the server and reading data contents;
the request unit is used for requesting the server to lock when the data content is not stored in the server memory;
the read-write unit is used for accessing the server disk after locking when the server does not lock other terminals, and reading the data content;
the request unit is used for requesting locking to the server again after waiting for unlocking of other terminals when the server locks other terminals;
wherein, the locking program of the server only allows one terminal to access the server disk at the same time.
C11, the device according to C10, wherein the read-write unit is configured to:
after other terminals are unlocked, the memory of the server is accessed again;
if the data content is newly added in the memory of the server, reading the data content;
and the request unit is used for canceling the locking request from the server again.
C12, the apparatus according to C11, wherein the requesting unit is configured to request locking from the server again when the data content is not stored in the server memory.
C13, the device according to the claim C10, wherein the request unit is used for informing the server to unlock after accessing the server disk and reading the data content, so that the server locks other terminals.
C14, the device according to any of C10 to 13, wherein the locking program requested to be executed by the request unit is a spin lock program.
D15, an apparatus for accessing a server disk, the apparatus being located on the server side, the apparatus comprising:
the device comprises a receiving unit, a sending unit and a receiving unit, wherein the receiving unit is used for receiving a data request sent by a terminal, and the data request is used for requesting data content of a server side;
the sending unit is used for returning the data content in the server memory to the terminal when the data content is stored in the server memory;
the locking and unlocking unit is used for starting a locking program to lock the terminal when the data content is not stored in the memory of the server, so that the terminal in a locked state accesses a server disk, acquires the data content and enables other terminals which are not locked to wait for locking;
wherein the locking program allows only one terminal to access the server disk at the same time.
D16, the device according to D15, wherein the device further includes a read/write unit, configured to write the data content read from the server disk into the server memory after the terminal completes access to the server disk, so that another terminal waiting for locking reads the data content from the server memory.
D17, the device according to D15, wherein the locking and unlocking unit is used for:
after the terminal finishes accessing a server disk, unlocking the terminal;
and locking other terminals to be locked.
D18, the device according to any of the D15 to 17, wherein the locking program executed by the locking and unlocking unit is a spin lock program.
E19, a system for accessing server disks, the system comprising a terminal and a server, wherein:
the terminal comprises an apparatus as described in any of C10-C14;
the server comprises an apparatus as claimed in any one of D15 to D18.
In the foregoing embodiments, the descriptions of the respective embodiments have respective emphasis, and for parts that are not described in detail in a certain embodiment, reference may be made to related descriptions of other embodiments.
It will be appreciated that the relevant features of the method and apparatus described above are referred to one another. In addition, "first", "second", and the like in the above embodiments are for distinguishing the embodiments, and do not represent merits of the embodiments.
It is clear to those skilled in the art that, for convenience and brevity of description, the specific working processes of the above-described systems, apparatuses and units may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
The algorithms and displays presented herein are not inherently related to any particular computer, virtual machine, or other apparatus. Various general purpose systems may also be used with the teachings herein. The required structure for constructing such a system will be apparent from the description above. Moreover, the present invention is not directed to any particular programming language. It is appreciated that a variety of programming languages may be used to implement the teachings of the present invention as described herein, and any descriptions of specific languages are provided above to disclose the best mode of the invention.
In the description provided herein, numerous specific details are set forth. It is understood, however, that embodiments of the invention may be practiced without these specific details. In some instances, well-known methods, structures and techniques have not been shown in detail in order not to obscure an understanding of this description.
Similarly, it should be appreciated that in the foregoing description of exemplary embodiments of the invention, various features of the invention are sometimes grouped together in a single embodiment, figure, or description thereof for the purpose of streamlining the disclosure and aiding in the understanding of one or more of the various inventive aspects. However, the disclosed method should not be interpreted as reflecting an intention that: that the invention as claimed requires more features than are expressly recited in each claim. Rather, as the following claims reflect, inventive aspects lie in less than all features of a single foregoing disclosed embodiment. Thus, the claims following the detailed description are hereby expressly incorporated into this detailed description, with each claim standing on its own as a separate embodiment of this invention.
Those skilled in the art will appreciate that the modules in the device in an embodiment may be adaptively changed and disposed in one or more devices different from the embodiment. The modules or units or components of the embodiments may be combined into one module or unit or component, and furthermore they may be divided into a plurality of sub-modules or sub-units or sub-components. All of the features disclosed in this specification (including any accompanying claims, abstract and drawings), and all of the processes or elements of any method or apparatus so disclosed, may be combined in any combination, except combinations where at least some of such features and/or processes or elements are mutually exclusive. Each feature disclosed in this specification (including any accompanying claims, abstract and drawings) may be replaced by alternative features serving the same, equivalent or similar purpose, unless expressly stated otherwise.
Furthermore, those skilled in the art will appreciate that while some embodiments described herein include some features included in other embodiments, rather than other features, combinations of features of different embodiments are meant to be within the scope of the invention and form different embodiments. For example, in the following claims, any of the claimed embodiments may be used in any combination.
The various component embodiments of the invention may be implemented in hardware, or in software modules running on one or more processors, or in a combination thereof. Those skilled in the art will appreciate that a microprocessor or Digital Signal Processor (DSP) may be used in practice to implement some or all of the functionality of some or all of the components in the title of the invention (e.g., means for determining the level of links within a web site) in accordance with embodiments of the invention. The present invention may also be embodied as apparatus or device programs (e.g., computer programs and computer program products) for performing a portion or all of the methods described herein. Such programs implementing the present invention may be stored on computer-readable media or may be in the form of one or more signals. Such a signal may be downloaded from an internet website or provided on a carrier signal or in any other form.
It should be noted that the above-mentioned embodiments illustrate rather than limit the invention, and that those skilled in the art will be able to design alternative embodiments without departing from the scope of the appended claims. In the claims, any reference signs placed between parentheses shall not be construed as limiting the claim. The word "comprising" does not exclude the presence of elements or steps not listed in a claim. The word "a" or "an" preceding an element does not exclude the presence of a plurality of such elements. The invention may be implemented by means of hardware comprising several distinct elements, and by means of a suitably programmed computer. In the unit claims enumerating several means, several of these means may be embodied by one and the same item of hardware. The usage of the words first, second and third, etcetera do not indicate any ordering. These words may be interpreted as names.

Claims (10)

1. A method for accessing a server disk, the method being applied to a terminal side, the method comprising:
accessing a server memory and reading data contents;
if the data content is not stored in the server memory, requesting to lock the server;
if the server does not lock other terminals, accessing a server disk after locking, and reading the data content;
if the server locks other terminals, the server requests locking to the server again after waiting for unlocking of other terminals;
wherein, the locking program of the server only allows one terminal to access the server disk at the same time.
2. The method of claim 1, wherein after the other terminal is unlocked, the method further comprises:
the memory of the server is accessed again;
if the data content is newly added in the memory of the server, reading the data content;
canceling again the request for locking to the server.
3. The method of claim 2, wherein requesting locking from the server again comprises:
and if the data content is not stored in the memory of the server, locking is requested to the server again.
4. The method of claim 1, wherein after accessing a server disk and reading the data content, the method further comprises:
and informing the server to unlock so that the server locks other terminals.
5. The method according to any of claims 1 to 4, wherein the locking program is a spin lock program.
6. A method for accessing a server disk, the method being applied to a server side, the method comprising:
receiving a data request sent by a terminal, wherein the data request is used for requesting data content of a server side;
if the data content is stored in the server memory, returning the data content in the server memory to the terminal;
if the data content is not stored in the memory of the server, starting a locking program to lock the terminal, so that the terminal in a locked state accesses a server disk, acquires the data content, and enables other terminals which are not locked to wait for locking;
wherein the locking program allows only one terminal to access the server disk at the same time.
7. The method of claim 6, further comprising:
and after the terminal finishes accessing the server disk, writing the data content read from the server disk into a server memory, so that other terminals waiting for locking read the data content from the server memory.
8. An apparatus for accessing a server disk, the apparatus being located on a terminal side, the apparatus comprising:
the read-write unit is used for accessing the memory of the server and reading data contents;
the request unit is used for requesting the server to lock when the data content is not stored in the server memory;
the read-write unit is used for accessing the server disk after locking when the server does not lock other terminals, and reading the data content;
the request unit is used for requesting locking to the server again after waiting for unlocking of other terminals when the server locks other terminals;
wherein, the locking program of the server only allows one terminal to access the server disk at the same time.
9. An apparatus for accessing a server disk, the apparatus being located on a server side, the apparatus comprising:
the device comprises a receiving unit, a sending unit and a receiving unit, wherein the receiving unit is used for receiving a data request sent by a terminal, and the data request is used for requesting data content of a server side;
the sending unit is used for returning the data content in the server memory to the terminal when the data content is stored in the server memory;
the locking and unlocking unit is used for starting a locking program to lock the terminal when the data content is not stored in the memory of the server, so that the terminal in a locked state accesses a server disk, acquires the data content and enables other terminals which are not locked to wait for locking;
wherein the locking program allows only one terminal to access the server disk at the same time.
10. A system for accessing a server disk, the system comprising a terminal and a server, wherein:
the terminal comprises the apparatus of claim 8;
the server comprising the apparatus of claim 9.
CN201510921157.2A 2015-12-11 2015-12-11 Method, device and system for accessing server disk Pending CN105511813A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201510921157.2A CN105511813A (en) 2015-12-11 2015-12-11 Method, device and system for accessing server disk

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201510921157.2A CN105511813A (en) 2015-12-11 2015-12-11 Method, device and system for accessing server disk

Publications (1)

Publication Number Publication Date
CN105511813A true CN105511813A (en) 2016-04-20

Family

ID=55719833

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201510921157.2A Pending CN105511813A (en) 2015-12-11 2015-12-11 Method, device and system for accessing server disk

Country Status (1)

Country Link
CN (1) CN105511813A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109407987A (en) * 2018-10-18 2019-03-01 北京奇艺世纪科技有限公司 A kind of method for reading data and device
CN112947677A (en) * 2021-02-05 2021-06-11 北京深之度科技有限公司 Timer reading method, computing device and readable storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101364230A (en) * 2008-09-24 2009-02-11 金蝶软件(中国)有限公司 Concurrent access control method and device
US20110225373A1 (en) * 2010-03-11 2011-09-15 Hitachi, Ltd. Computer system and method of data cache management
CN103761240A (en) * 2013-12-12 2014-04-30 北京奇虎科技有限公司 Database access method and database access device
CN105138587A (en) * 2015-07-31 2015-12-09 小米科技有限责任公司 Data access method, apparatus and system

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101364230A (en) * 2008-09-24 2009-02-11 金蝶软件(中国)有限公司 Concurrent access control method and device
US20110225373A1 (en) * 2010-03-11 2011-09-15 Hitachi, Ltd. Computer system and method of data cache management
CN103761240A (en) * 2013-12-12 2014-04-30 北京奇虎科技有限公司 Database access method and database access device
CN105138587A (en) * 2015-07-31 2015-12-09 小米科技有限责任公司 Data access method, apparatus and system

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109407987A (en) * 2018-10-18 2019-03-01 北京奇艺世纪科技有限公司 A kind of method for reading data and device
CN112947677A (en) * 2021-02-05 2021-06-11 北京深之度科技有限公司 Timer reading method, computing device and readable storage medium
CN112947677B (en) * 2021-02-05 2024-02-27 北京深之度科技有限公司 Timer reading method, computing device and readable storage medium

Similar Documents

Publication Publication Date Title
CN107943594B (en) Data acquisition method and device
CN104598459B (en) database processing, data access method and system
US7836338B2 (en) Distributed transaction processing method, distributed transaction processing system, transaction management device, and computer product
EP3991389B1 (en) File upload control for client-side applications in proxy solutions
CN112052264B (en) Business data query method and device, electronic equipment and readable storage medium
CN103634411B (en) A kind of marketing data real time broadcasting system and method with state consistency
US8190857B2 (en) Deleting a shared resource node after reserving its identifier in delete pending queue until deletion condition is met to allow continued access for currently accessing processor
CN104184832A (en) Data submitting method and device in network application
US9471896B2 (en) Memo synchronization system, mobile system, and method for synchronizing memo data
CN102932370A (en) Safety scanning method, equipment and system
CN108173839B (en) Authority management method and system
KR20180074774A (en) How to identify malicious websites, devices and computer storage media
CN107544849A (en) A kind of WEB server concurrency management method and system
CN105592083B (en) Method and device for terminal to access server by using token
CN110753084A (en) Uplink data reading method, cache server and computer readable storage medium
CN111309805B (en) Data reading and writing method and device for database
US20070118597A1 (en) Processing proposed changes to data
US11288263B2 (en) Change service for shared database object
CN105511813A (en) Method, device and system for accessing server disk
CN110837521A (en) Data query method and device and server
CN106598706B (en) Method and device for improving stability of server and server
CN113448976B (en) Data processing method, device, computer equipment and storage medium
CN114553521A (en) Remote memory access method, device, equipment and medium
JP7221652B6 (en) External change detection
CN110515959B (en) Data consistency implementation method and device and readable storage medium

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20160420