Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tracking issue for speed up PiTR by pre-compacting logs #56522

Open
14 of 16 tasks
YuJuncen opened this issue Oct 10, 2024 · 0 comments
Open
14 of 16 tasks

Tracking issue for speed up PiTR by pre-compacting logs #56522

YuJuncen opened this issue Oct 10, 2024 · 0 comments
Labels
affects-8.1 This bug affects the 8.1.x(LTS) versions. component/br This issue is related to BR of TiDB. type/enhancement The issue or PR belongs to an enhancement.

Comments

@YuJuncen
Copy link
Contributor

YuJuncen commented Oct 10, 2024

Enhancement

For now PiTR is slow. Because we need:

  • Download the logs to the leader.
  • Leader duplicating the mutations to all peers by raft (Requires a sync of Disk).
  • Sort this run in the memtable.
  • Flush and compact the mutations in the LSM tree.

This routine includes many overheads:

  • Write amplification.
  • Sorting the mutations.
  • One extra write in the raft engine.

We may "pre-compact" the backup data to SSTs, and use the download/ ingest API to put them into the cluster.

Progress Tracking

Generate SSTs from Logs Offline

This Issue tracks the subcommand compact-log-backup of tikv-ctl.

Manage the Metadata of Compactions

We will introduce the migration system for log backup storages. Generally, we now modify the "stabilized" logs by putting an atomic "migration".

Point in Time Restore with SSTs

The whole changes is in #54813

Implement a More Friendly User Interface.

Testing

General Workload

This is an internal workload, with:

  • Cluster Size: 23 TB
  • QPS: 6k inserts/18k updates

(Short Duration Compaction) Restore Performance:

  • Log Restore: Completed in 2 hours(24 hours data Retention)
  • Log Restore with Log Compaction: Completed in 40 minutes (There's still room for improvement:As the data in the log backup retention period grows, the effectiveness of compaction improves, demonstrating an optimization effect that exceeds linear growth, because of less write amplification and less Raft I/O)

(Long Duration Compaction) Restore Performance:

  • Log Restore: There is data skew during restoring hence the disk space isn't enough. We scaled out to 10 TiKV stores. The restore takes 10 hours to finish with several breaks(break due to disk almost full, because compact SST consumes too many space during log restore, so it will take much more space when restore with a longer interval(7 days)).
  • Log Restore with Log Compaction: Without split, we finished the restoration in about 3hrs.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects-8.1 This bug affects the 8.1.x(LTS) versions. component/br This issue is related to BR of TiDB. type/enhancement The issue or PR belongs to an enhancement.
Projects
None yet
Development

No branches or pull requests

2 participants