Browse Source
Merge pull request #173 from fsdfsffdsf/optimization_off_cpu
optimization: config async update branch goroutine num
pull/175/head
yedf2
4 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with
15 additions and
10 deletions
-
conf.sample.yml
-
dtmsvr/config/config.go
-
dtmsvr/svr.go
|
|
|
@ -48,6 +48,7 @@ |
|
|
|
# TimeoutToFail: 35 # timeout for XA, TCC to fail. saga's timeout default to infinite, which can be overwritten in saga options |
|
|
|
# RetryInterval: 10 # the subtrans branch will be retried after this interval |
|
|
|
|
|
|
|
# UpdateBranchAsyncGoroutineNum: 1 # num of async goroutine to update branch status |
|
|
|
# LogLevel: 'info' # default: info. can be debug|info|warn|error |
|
|
|
# HttpPort: 36789 |
|
|
|
# GrpcPort: 36790 |
|
|
|
|
|
|
|
@ -62,15 +62,16 @@ func (s *Store) GetDBConf() dtmcli.DBConf { |
|
|
|
} |
|
|
|
|
|
|
|
type configType struct { |
|
|
|
Store Store `yaml:"Store"` |
|
|
|
TransCronInterval int64 `yaml:"TransCronInterval" default:"3"` |
|
|
|
TimeoutToFail int64 `yaml:"TimeoutToFail" default:"35"` |
|
|
|
RetryInterval int64 `yaml:"RetryInterval" default:"10"` |
|
|
|
HTTPPort int64 `yaml:"HttpPort" default:"36789"` |
|
|
|
GrpcPort int64 `yaml:"GrpcPort" default:"36790"` |
|
|
|
MicroService MicroService `yaml:"MicroService"` |
|
|
|
UpdateBranchSync int64 `yaml:"UpdateBranchSync"` |
|
|
|
LogLevel string `yaml:"LogLevel" default:"info"` |
|
|
|
Store Store `yaml:"Store"` |
|
|
|
TransCronInterval int64 `yaml:"TransCronInterval" default:"3"` |
|
|
|
TimeoutToFail int64 `yaml:"TimeoutToFail" default:"35"` |
|
|
|
RetryInterval int64 `yaml:"RetryInterval" default:"10"` |
|
|
|
HTTPPort int64 `yaml:"HttpPort" default:"36789"` |
|
|
|
GrpcPort int64 `yaml:"GrpcPort" default:"36790"` |
|
|
|
MicroService MicroService `yaml:"MicroService"` |
|
|
|
UpdateBranchSync int64 `yaml:"UpdateBranchSync"` |
|
|
|
UpdateBranchAsyncGoroutineNum int64 `yaml:"UpdateBranchAsyncGoroutineNum" default:"1"` |
|
|
|
LogLevel string `yaml:"LogLevel" default:"info"` |
|
|
|
} |
|
|
|
|
|
|
|
// Config 配置
|
|
|
|
|
|
|
|
@ -46,7 +46,10 @@ func StartSvr() { |
|
|
|
err := s.Serve(lis) |
|
|
|
logger.FatalIfError(err) |
|
|
|
}() |
|
|
|
go updateBranchAsync() |
|
|
|
|
|
|
|
for i := 0; i < int(conf.UpdateBranchAsyncGoroutineNum); i++ { |
|
|
|
go updateBranchAsync() |
|
|
|
} |
|
|
|
|
|
|
|
time.Sleep(100 * time.Millisecond) |
|
|
|
err = dtmdriver.Use(conf.MicroService.Driver) |
|
|
|
|