Browse Source

Merge pull request #80 from li-xiao-shuang/feature_bench

Feature bench
pull/81/head
yedf2 5 years ago
committed by GitHub
parent
commit
5c9698f92b
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      app/main.go
  2. 2
      bench/http.go
  3. 39
      bench/main.go

3
app/main.go

@ -11,7 +11,6 @@ import (
"os" "os"
"strings" "strings"
"github.com/yedf/dtm/bench"
"github.com/yedf/dtm/common" "github.com/yedf/dtm/common"
"github.com/yedf/dtm/dtmcli" "github.com/yedf/dtm/dtmcli"
"github.com/yedf/dtm/dtmcli/dtmimp" "github.com/yedf/dtm/dtmcli/dtmimp"
@ -66,8 +65,6 @@ func main() {
// quick_start 比较独立,单独作为一个例子运行,方便新人上手 // quick_start 比较独立,单独作为一个例子运行,方便新人上手
examples.QsStartSvr() examples.QsStartSvr()
examples.QsFireRequest() examples.QsFireRequest()
case "bench":
bench.StartSvr()
case "dev", "dtmsvr": case "dev", "dtmsvr":
default: default:
// 下面是各类的例子 // 下面是各类的例子

2
bench/http.go

@ -4,7 +4,7 @@
* license that can be found in the LICENSE file. * license that can be found in the LICENSE file.
*/ */
package bench package main
import ( import (
"database/sql" "database/sql"

39
bench/main.go

@ -0,0 +1,39 @@
package main
import (
"fmt"
"github.com/yedf/dtm/common"
"github.com/yedf/dtm/dtmcli"
"github.com/yedf/dtm/dtmcli/dtmimp"
"github.com/yedf/dtm/dtmsvr"
"github.com/yedf/dtm/examples"
"os"
)
var hint = `To start the bench server, you need to specify the parameters:
Available commands:
http start bench server
`
func main() {
if len(os.Args) <= 1 {
fmt.Printf(hint)
return
}
dtmimp.Logf("starting dtm....")
if os.Args[1] == "http" {
fmt.Println("start bench server")
common.MustLoadConfig()
dtmcli.SetCurrentDBType(common.DtmConfig.DB["driver"])
common.WaitDBUp()
dtmsvr.PopulateDB(true)
examples.PopulateDB(true)
dtmsvr.StartSvr() // 启动dtmsvr的api服务
go dtmsvr.CronExpiredTrans(-1) // 启动dtmsvr的定时过期查询
StartSvr()
select {}
} else {
fmt.Printf(hint)
}
}
Loading…
Cancel
Save