thisismyfirstclone
Senior Member
Ai da.Ý bác là doublewrite buffer? Nếu vậy thì mình nghĩ cái này không đúng. WAL là tận dụng tốc độ sequential write để tăng tốc độ write ( commit) của DB. Tuy vậy không phải vì doublewrite buffer nên phải có WAL, vì WAL xảy ra trước.
Doublewrite buffer xảy ra sau này, khi cần flush dirty innodb pages xuống disk, ở đây dirty pages được gom lại vào một buffer -> ghi xuống disk sequentially -> sau đó mới write tiếp đến đúng vị trí page trên disk. Doublewrite buffer lúc này dùng để recovery torn page, những chỗ "sau đó mới write tiếp đến đúng vị trí page trên disk" mà lỗi.
Bạn có thể đọc thêm về WAL tại đây
28.3. Write-Ahead Logging (WAL)
28.3. Write-Ahead Logging (WAL) # Write-Ahead Logging (WAL) is a standard method for ensuring data integrity. A detailed description can be …
Write-Ahead Logging (WAL) is a standard method for ensuring data integrity. A detailed description can be found in most (if not all) books about transaction processing. Briefly, WAL's central concept is that changes to data files (where tables and indexes reside) must be written only after those changes have been logged, that is, after WAL records describing the changes have been flushed to permanent storage. If we follow this procedure, we do not need to flush data pages to disk on every transaction commit, because we know that in the event of a crash we will be able to recover the database using the log: any changes that have not been applied to the data pages can be redone from the WAL records. (This is roll-forward recovery, also known as REDO.)
PS, à hình như mình hiểu ý bạn rồi. Đúng WAL enable senquential writes, nhưng mà enable gián tiếp, nghĩa là sử dụng WAL cho phép bạn sử dụng buffer writes (cái này mới là trực tiếp) mà không lo lắng về việc mất dữ liệu trong trường hợp xảy ra crash.
Sửa lần cuối:



Thằng Java + Spring nó chạy chậm vì nó load quá nhiều các component vào để việc dev được nhanh chóng hơn. Đến một ngày, framework của Go cũng nhúng nhiều thứ vào cho tiện thì nó cũng sẽ bắt đầu chậm dần đều
)
