Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

DMRAC cache swapping

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Cache swapping

According to the current hardware development, the transmission speed of the network is faster than the read and write speed of the disk. Therefore, the DMRAC cluster introduces the cache exchange (Buffer Swap) technology, and the data pages between nodes are transmitted through the network as far as possible, so as to avoid transferring data between nodes through disk writing and re-reading, so as to reduce the IO waiting time of the database and improve the response speed of the system.

The implementation of cache exchange is based on GBS/LBS services, and the relevant information of Buffer data pages is maintained in GBS/LBS. Including: 1. Lock authority of the latch (LATCH); 2. Which sites have visited this data page (Access MAP); 3. Which node (Fresh EP) is the latest data stored in? 4. And information such as the LSN value (Fresh LSN) of the latest data page. This information is passed as additional information for LBS blockade, GBS authorization, and GBS permission recall requests, so there is no additional communication overhead.

Next, take the two-node DMRAC cluster (EP0/EP1) access data page P1 as an example. The initial page P1 is located on the shared storage, and the GBS control structure of P1 is located on the node EP1. The initial page P1 has not been accessed by any node, and the LSN of the initial page P1 is 10000. Through the analysis of several common scenarios, the principle of cache exchange is analyzed step by step.

Scenario 1

The node EP0 accesses the data page P1.

1. The local LBS of node EP0 requests the S LATCH permission of data page P1 from GBS of EP1.

two。 The GBS of the node EP1 modifies the P1 control structure, records the blocking mode of the access node EP0 as S LATCH (the data distribution node is EP0), and responds to the LBS request of EP0

3. After the LBS of the node EP0 is authorized by the GBS, the authorization mode obtained by the record is that the P1 data is not in the Buffer of other nodes, and the local IO request is initiated to read the data from the disk.

After the IO is completed, modify the LBS control structure to record the LSN information on the data page.

Scenario 2

The node EP1 accesses the data page P1.

1. The node EP1 local LBS requests the S LATCH permission of data page P1 from the GBS of EP1

two。 The GBS of the node EP1 modifies the control structure, records that the blocking mode of the access node EP1 is S LATCH (the data distribution node is EP0/EP1), and responds to the LBS request of EP1

3. After the LBS of node EP1 is authorized by GBS, the authorization mode obtained by the record is S LATCH. According to the data distribution, EP1 initiates a P1 read request to EP0 and obtains it from EP0 through the internal network.

Data instead of re-reading P1 data from disk

Scenario 3

Node EP0 modifies the data page P1.

1. The node EP0 local LBS requests the X LATCH permission of the data page P1 from the GBS of EP1 (additional LSN information)

two。 The GBS of node EP1 modifies the LSN value of the control structure to retrieve P1 permissions from the LBS of EP1.

3. Modify the blocking mode of the access node EP0 to S + X LATCH and respond to the LBS request of EP0

4. After the LBS of node EP0 is authorized by GBS, the authorization mode obtained by the record is S + X LATCH.

5. Node EP0 modification data page P1Magol LSN modified to 11000

In this process, there are only global Latch requests, and the data page is not passed between nodes.

After modification, the LSN of data page P1 is modified to 11000. As follows:

Scenario 4

Node EP1 modifies the data page P1.

1. The node EP1 local LBS requests the X LATCH permission of the data page P1 from the GBS of EP1

two。 The GBS of node EP1 discovers that P1 is blocked by EP0 in S + X mode and initiates a request to EP0 to reclaim P1 rights.

3. Node EP0 releases the global LATCH of P1, responds to GBS, and appends the latest PAGE LSN value to the response message

4. After receiving the response from EP0, the GBS of node EP1 modifies the GBS control structure to record the latest data saved in EP0, the latest LSN value information, and records that the authorization mode obtained by EP0 is S + X LATCH.

(at this point, the data distribution node is still EP0/EP1) and authorize the LBS of EP1

5. After the LBS of the node EP1 receives the authorization information, the record obtains the authorization mode S + X LATCH, and according to the data distribution, it initiates a read request for the data page P1 to the node EP0.

6. Node EP1 modification data page P1Magol LSN modified to 12000

After modification, the LSN of data page P1 is modified to 12000. As follows:

During this process, the latest data from the data page P1 is passed from EP0 to EP1, but no disk IO is generated.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report