Skip to content
This repository has been archived by the owner on Nov 24, 2023. It is now read-only.

*: improve performance #606

Merged
merged 9 commits into from
Apr 17, 2020
7 changes: 7 additions & 0 deletions dm/config/subtask.go
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,13 @@ func (c *SubTaskConfig) Adjust(verifyDecryptPassword bool) error {
c.LoaderConfig.Dir += dirSuffix
}

if c.SyncerConfig.QueueSize == 0 {
c.SyncerConfig.QueueSize = defaultQueueSize
}
if c.SyncerConfig.CheckpointFlushInterval == 0 {
c.SyncerConfig.CheckpointFlushInterval = defaultCheckpointFlushInterval
}

c.From.Adjust()
c.To.Adjust()

Expand Down
16 changes: 12 additions & 4 deletions dm/config/task.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,10 @@ var (
defaultPoolSize = 16
defaultDir = "./dumped_data"
// SyncerConfig
defaultWorkerCount = 16
defaultBatch = 100
defaultWorkerCount = 16
defaultBatch = 100
defaultQueueSize = 1024 // do not give too large default value to avoid OOM
defaultCheckpointFlushInterval = 30 // in seconds
)

// Meta represents binlog's meta pos
Expand Down Expand Up @@ -204,6 +206,10 @@ type SyncerConfig struct {
MetaFile string `yaml:"meta-file" toml:"meta-file" json:"meta-file"` // meta filename, used only when load SubConfig directly
WorkerCount int `yaml:"worker-count" toml:"worker-count" json:"worker-count"`
Batch int `yaml:"batch" toml:"batch" json:"batch"`
QueueSize int `yaml:"queue-size" toml:"queue-size" json:"queue-size"`
// checkpoint flush interval in seconds.
CheckpointFlushInterval int `yaml:"checkpoint-flush-interval" toml:"checkpoint-flush-interval" json:"checkpoint-flush-interval"`

// deprecated
MaxRetry int `yaml:"max-retry" toml:"max-retry" json:"max-retry"`

Expand All @@ -217,8 +223,10 @@ type SyncerConfig struct {

func defaultSyncerConfig() SyncerConfig {
return SyncerConfig{
WorkerCount: defaultWorkerCount,
Batch: defaultBatch,
WorkerCount: defaultWorkerCount,
Batch: defaultBatch,
QueueSize: defaultQueueSize,
CheckpointFlushInterval: defaultCheckpointFlushInterval,
}
}

Expand Down
Loading