上传服务配置

This commit is contained in:
liwei1dao 2023-09-06 16:44:07 +08:00
parent d3d0461934
commit 22283a26ff
14 changed files with 178 additions and 35 deletions

View File

@ -1,14 +1,23 @@
RobotTotal:1
SuccRobot:1
FailRobot:0
MessageTotal:9
机器人总数: 1
成功数量: 1
失败数量: 0
消息总吞吐量: 46
---消息压测详情----------------------------------------------------------------------------------------------------
消息名:user.login 请求次数:1 耗时最小:348 ms 耗时最大:348 ms 平均耗时:348.00ms 中位耗时:348.00ms
消息名:sys.funcgetlist 请求次数:1 耗时最小:7 ms 耗时最大:7 ms 平均耗时:7.00 ms 中位耗时:7.00 ms
消息名:hero.list 请求次数:1 耗时最小:4 ms 耗时最大:4 ms 平均耗时:4.00 ms 中位耗时:4.00 ms
消息名:equipment.getlist 请求次数:1 耗时最小:2 ms 耗时最大:2 ms 平均耗时:2.00 ms 中位耗时:2.00 ms
消息名:mainline.info 请求次数:1 耗时最小:4 ms 耗时最大:4 ms 平均耗时:4.00 ms 中位耗时:4.00 ms
消息名:user.create 请求次数:1 耗时最小:1 ms 耗时最大:1 ms 平均耗时:1.00 ms 中位耗时:1.00 ms
消息名:hero.talentlist 请求次数:1 耗时最小:2 ms 耗时最大:2 ms 平均耗时:2.00 ms 中位耗时:2.00 ms
消息名:items.getlist 请求次数:1 耗时最小:3 ms 耗时最大:3 ms 平均耗时:3.00 ms 中位耗时:3.00 ms
消息名:wtask.info 请求次数:1 耗时最小:5 ms 耗时最大:5 ms 平均耗时:5.00 ms 中位耗时:5.00 ms
消息名:wtask.accept 请求次数:12 耗时最小:1 ms 耗时最大:5 ms 平均耗时:2.83 ms 中位耗时:3.00 ms
消息名:wtask.completecondi 请求次数:3 耗时最小:1 ms 耗时最大:5 ms 平均耗时:3.67 ms 中位耗时:5.00 ms
消息名:wtask.finish 请求次数:10 耗时最小:2 ms 耗时最大:19 ms 平均耗时:8.40 ms 中位耗时:9.00 ms
消息名:practice.practice 请求次数:1 耗时最小:6 ms 耗时最大:6 ms 平均耗时:6.00 ms 中位耗时:6.00 ms
消息名:mainline.info 请求次数:1 耗时最小:5 ms 耗时最大:5 ms 平均耗时:5.00 ms 中位耗时:5.00 ms
消息名:sys.funcgetlist 请求次数:1 耗时最小:21 ms 耗时最大:21 ms 平均耗时:21.00ms 中位耗时:21.00ms
消息名:equipment.getlist 请求次数:1 耗时最小:0 ms 耗时最大:0 ms 平均耗时:0.00 ms 中位耗时:0.00 ms
消息名:wtask.info 请求次数:1 耗时最小:0 ms 耗时最大:0 ms 平均耗时:0.00 ms 中位耗时:0.00 ms
消息名:wtask.battlefinish 请求次数:4 耗时最小:1 ms 耗时最大:9 ms 平均耗时:3.50 ms 中位耗时:2.00 ms
消息名:practice.info 请求次数:1 耗时最小:8 ms 耗时最大:8 ms 平均耗时:8.00 ms 中位耗时:8.00 ms
消息名:user.login 请求次数:1 耗时最小:586 ms 耗时最大:586 ms 平均耗时:586.00ms 中位耗时:586.00ms
消息名:user.create 请求次数:1 耗时最小:16 ms 耗时最大:16 ms 平均耗时:16.00ms 中位耗时:16.00ms
消息名:items.getlist 请求次数:1 耗时最小:0 ms 耗时最大:0 ms 平均耗时:0.00 ms 中位耗时:0.00 ms
消息名:sys.funcactivate 请求次数:1 耗时最小:3 ms 耗时最大:3 ms 平均耗时:3.00 ms 中位耗时:3.00 ms
消息名:hero.list 请求次数:1 耗时最小:1 ms 耗时最大:1 ms 平均耗时:1.00 ms 中位耗时:1.00 ms
消息名:hero.talentlist 请求次数:1 耗时最小:0 ms 耗时最大:0 ms 平均耗时:0.00 ms 中位耗时:0.00 ms
消息名:wtask.battlestart 请求次数:4 耗时最小:1 ms 耗时最大:4 ms 平均耗时:2.25 ms 中位耗时:2.00 ms
消息名:hero.drawcard 请求次数:1 耗时最小:15 ms 耗时最大:15 ms 平均耗时:15.00ms 中位耗时:15.00ms

View File

@ -0,0 +1,34 @@
package robot
import (
cfg "go_dreamfactory/sys/configure/structs"
"google.golang.org/protobuf/proto"
)
//用户模块 机器人
type ModuleRobot_GM struct {
}
func (this *ModuleRobot_GM) Init() (err error) {
return
}
//接收到消息
func (this *ModuleRobot_GM) Receive(robot IRobot, stype string, message proto.Message) (err error) {
return
}
//机器人执行流
func (this *ModuleRobot_GM) DoPipeline(robot IRobot) (err error) {
return
}
//做任务
func (this *ModuleRobot_GM) DoTask(robot IRobot, taskconf *cfg.GameWorldTaskData, condconf *cfg.GameBuriedCondiData) (err error) {
return
}

View File

@ -145,12 +145,13 @@ locp:
case comm.Rtype104:
module = comm.ModuleShop
default:
log.Error("[Robot DoTask]", log.Field{Key: "ctype", Value: cconf.Type}, log.Field{Key: "conld", Value: cconf.Id}, log.Field{Key: "err", Value: "Not Achieved !"})
err = fmt.Errorf("[Robot DoTask] ctype:%d conld:%d Not Achieved !", cconf.Type, cconf.Id)
// log.Error("[Robot DoTask]", log.Field{Key: "ctype", Value: cconf.Type}, log.Field{Key: "conld", Value: cconf.Id}, log.Field{Key: "err", Value: "Not Achieved !"})
break locp
}
if err = robot.DoTask(tconf, cconf, module); err != nil {
log.Error("[Robot DoTask]", log.Field{Key: "task", Value: tconf.Key}, log.Field{Key: "conld", Value: cconf.Id}, log.Field{Key: "err", Value: err.Error()})
// log.Error("[Robot DoTask]", log.Field{Key: "task", Value: tconf.Key}, log.Field{Key: "conld", Value: cconf.Id}, log.Field{Key: "err", Value: err.Error()})
break locp
}
time.Sleep(time.Second * 2)

View File

@ -8,14 +8,15 @@ import (
type (
Options struct {
modules.Options
OutFilePath string //输出文件报表
ServerAddr string //服务地址
ServerID string //服务ID
RobotTotalNum int32 //机器人总数
RobotSingleNum int32 //单词机器人进入数量
Intervals int32 //间隔时间 单位秒
RobotName string //机器人名称
RobotStart int32 //机器人初始下标
OutFilePath string //输出文件报表
ServerAddr string //服务地址
ServerID string //服务ID
RobotTotalNum int32 //机器人总数
RobotSingleNum int32 //单词机器人进入数量
Intervals int32 //间隔时间 单位秒
RobotName string //机器人名称
RobotStart int32 //机器人初始下标
RobotLog bool
Pipeline []string //执行流水线
}
)

View File

@ -25,6 +25,7 @@ type RobotStatistics struct {
type Robot struct {
Client
monitor IRobotMonitor
debug bool
index int32 //编号
account, serverId string
curreq string //当前请求
@ -54,6 +55,7 @@ func (this *Robot) Init(addr string, client IClient) (err error) {
this.statistics = make([]*RobotStatistics, 0, 100)
this.modules[comm.ModuleUser] = new(ModuleRobot_User)
this.modules[comm.ModuleSys] = new(ModuleRobot_Sys)
this.modules[comm.ModuleGM] = new(ModuleRobot_GM)
this.modules[comm.ModuleHero] = new(ModuleRobot_Hero)
this.modules[comm.ModuleEquipment] = new(ModuleRobot_Equipment)
this.modules[comm.ModuleItems] = new(ModuleRobot_Item)
@ -154,7 +156,9 @@ func (this *Robot) SendMessage(mtype, stype string, msg proto.Message) (resp pro
message: fmt.Sprintf("%s.%s", mtype, stype),
time: time.Since(stime).Milliseconds(),
})
// log.Debug("[机器人 Message]", log.Field{Key: "t", Value: time.Since(stime).Milliseconds()}, log.Field{Key: "Account", Value: this.account}, log.Field{Key: "message", Value: fmt.Sprintf("%s.%s", mtype, stype)}, log.Field{Key: "resp", Value: errdata == nil})
if this.debug {
log.Debug("[机器人 Message]", log.Field{Key: "t", Value: time.Since(stime).Milliseconds()}, log.Field{Key: "Account", Value: this.account}, log.Field{Key: "message", Value: fmt.Sprintf("%s.%s", mtype, stype)}, log.Field{Key: "resp", Value: errdata == nil})
}
}
return
}
@ -185,11 +189,14 @@ func (this *Robot) SendTaskMessage(task, comdi int32, mtype, stype string, msg p
messageresp = <-this.await //等待回应
resp = messageresp.resp
errdata = messageresp.errdata
if errdata == nil {
log.Debug("[机器人 Message]", log.Field{Key: "t", Value: time.Since(stime).Milliseconds()}, log.Field{Key: "Account", Value: this.account}, log.Field{Key: "Task", Value: fmt.Sprintf("[%d-%d]", task, comdi)}, log.Field{Key: "message", Value: fmt.Sprintf("%s.%s", mtype, stype)}, log.Field{Key: "errdata", Value: errdata == nil})
} else {
log.Error("[机器人 Message]", log.Field{Key: "t", Value: time.Since(stime).Milliseconds()}, log.Field{Key: "Account", Value: this.account}, log.Field{Key: "Task", Value: fmt.Sprintf("[%d-%d]", task, comdi)}, log.Field{Key: "message", Value: fmt.Sprintf("%s.%s", mtype, stype)}, log.Field{Key: "errdata", Value: errdata.String()})
if this.debug {
if errdata == nil {
log.Debug("[机器人 Message]", log.Field{Key: "t", Value: time.Since(stime).Milliseconds()}, log.Field{Key: "Account", Value: this.account}, log.Field{Key: "Task", Value: fmt.Sprintf("[%d-%d]", task, comdi)}, log.Field{Key: "message", Value: fmt.Sprintf("%s.%s", mtype, stype)}, log.Field{Key: "errdata", Value: errdata == nil})
} else {
log.Error("[机器人 Message]", log.Field{Key: "t", Value: time.Since(stime).Milliseconds()}, log.Field{Key: "Account", Value: this.account}, log.Field{Key: "Task", Value: fmt.Sprintf("[%d-%d]", task, comdi)}, log.Field{Key: "message", Value: fmt.Sprintf("%s.%s", mtype, stype)}, log.Field{Key: "errdata", Value: errdata.String()})
}
}
this.statistics = append(this.statistics, &RobotStatistics{
message: fmt.Sprintf("%s.%s", mtype, stype),
time: time.Since(stime).Milliseconds(),

View File

@ -60,6 +60,7 @@ func (this *robotmgrComp) createRobot(index int32) {
err error
)
robot = &Robot{
debug: this.module.options.RobotLog,
monitor: this.module.statisticalComp,
index: index,
account: fmt.Sprintf("%s_%d", this.module.options.RobotName, this.module.options.RobotStart+index),

View File

@ -4,6 +4,7 @@ import (
"fmt"
"go_dreamfactory/lego/core"
"go_dreamfactory/lego/core/cbase"
"go_dreamfactory/lego/sys/log"
"os"
"sort"
"sync"
@ -100,4 +101,5 @@ func (this *statisticalComp) OutReport() {
}
file.WriteString(fmt.Sprintf("消息名:%-20s 请求次数:%-5d 耗时最小:%-5dms 耗时最大:%-5dms 平均耗时:%-5.2fms 中位耗时:%-5.2fms \n", message, len(data), min, max, avg, median))
}
log.Debugf("机器人报表已输出!")
}

View File

@ -92,7 +92,6 @@ func (this *apiComp) BattleFinish(session comm.IUserSession, req *pb.WTaskBattle
}
//触发任务
go this.module.ModuleBuried.TriggerBuried(session.Clone(), comm.GetBuriedParam(comm.Rtype70, 1, req.BattleConfId))
} else {
go this.module.ModuleBuried.TriggerBuried(session.Clone(), comm.GetBuriedParam(comm.Rtype227, 1, req.BattleConfId))
}

View File

@ -353,9 +353,8 @@ func convertServiceSttings(config *comm.GameConfig, id int, stype string, ip str
"Alias": sseting.Id,
"FileName": fmt.Sprintf("./log/%s.log", sseting.Id),
"IsDebug": false,
"Loglevel": log.ErrorLevel,
"Loglevel": log.InfoLevel,
"MaxAgeTime": 7,
"UniqueLog": true,
}
}

View File

@ -20,6 +20,7 @@ type GameBuriedCondiData struct {
Type int32
Valid int32
Head *Gameatn
NpcEventType int32
NPC int32
Value int32
Filter []int32
@ -55,6 +56,7 @@ func (_v *GameBuriedCondiData)Deserialize(_buf map[string]interface{}) (err erro
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["type"].(float64); !_ok_ { err = errors.New("type error"); return }; _v.Type = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["valid"].(float64); !_ok_ { err = errors.New("valid error"); return }; _v.Valid = int32(_tempNum_) }
{ var _ok_ bool; var _x_ map[string]interface{}; if _x_, _ok_ = _buf["head"].(map[string]interface{}); !_ok_ { err = errors.New("head error"); return }; if _v.Head, err = DeserializeGameatn(_x_); err != nil { return } }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["Npc_event_type"].(float64); !_ok_ { err = errors.New("Npc_event_type error"); return }; _v.NpcEventType = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["NPC"].(float64); !_ok_ { err = errors.New("NPC error"); return }; _v.NPC = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["value"].(float64); !_ok_ { err = errors.New("value error"); return }; _v.Value = int32(_tempNum_) }
{

View File

@ -0,0 +1,42 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
package cfg
type GameBuzkashiQteLv struct {
_dataMap map[int32]*GameBuzkashiQteLvData
_dataList []*GameBuzkashiQteLvData
}
func NewGameBuzkashiQteLv(_buf []map[string]interface{}) (*GameBuzkashiQteLv, error) {
_dataList := make([]*GameBuzkashiQteLvData, 0, len(_buf))
dataMap := make(map[int32]*GameBuzkashiQteLvData)
for _, _ele_ := range _buf {
if _v, err2 := DeserializeGameBuzkashiQteLvData(_ele_); err2 != nil {
return nil, err2
} else {
_dataList = append(_dataList, _v)
dataMap[_v.Num] = _v
}
}
return &GameBuzkashiQteLv{_dataList:_dataList, _dataMap:dataMap}, nil
}
func (table *GameBuzkashiQteLv) GetDataMap() map[int32]*GameBuzkashiQteLvData {
return table._dataMap
}
func (table *GameBuzkashiQteLv) GetDataList() []*GameBuzkashiQteLvData {
return table._dataList
}
func (table *GameBuzkashiQteLv) Get(key int32) *GameBuzkashiQteLvData {
return table._dataMap[key]
}

View File

@ -0,0 +1,39 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
package cfg
import "errors"
type GameBuzkashiQteLvData struct {
Num int32
Time float32
Value int32
}
const TypeId_GameBuzkashiQteLvData = 795602659
func (*GameBuzkashiQteLvData) GetTypeId() int32 {
return 795602659
}
func (_v *GameBuzkashiQteLvData)Deserialize(_buf map[string]interface{}) (err error) {
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["num"].(float64); !_ok_ { err = errors.New("num error"); return }; _v.Num = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["time"].(float64); !_ok_ { err = errors.New("time error"); return }; _v.Time = float32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["value"].(float64); !_ok_ { err = errors.New("value error"); return }; _v.Value = int32(_tempNum_) }
return
}
func DeserializeGameBuzkashiQteLvData(_buf map[string]interface{}) (*GameBuzkashiQteLvData, error) {
v := &GameBuzkashiQteLvData{}
if err := v.Deserialize(_buf); err == nil {
return v, nil
} else {
return nil, err
}
}

View File

@ -19,8 +19,8 @@ type GameQualifyingData struct {
MatefailReward []*Gameatn
RankwinReward []*Gameatn
RankfailReward []*Gameatn
WinValue float32
FailValue float32
WinValue int32
FailValue int32
SettlementReward []*Gameatn
Png string
}
@ -92,8 +92,8 @@ func (_v *GameQualifyingData)Deserialize(_buf map[string]interface{}) (err error
}
}
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["win_value"].(float64); !_ok_ { err = errors.New("win_value error"); return }; _v.WinValue = float32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["fail_value"].(float64); !_ok_ { err = errors.New("fail_value error"); return }; _v.FailValue = float32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["win_value"].(float64); !_ok_ { err = errors.New("win_value error"); return }; _v.WinValue = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["fail_value"].(float64); !_ok_ { err = errors.New("fail_value error"); return }; _v.FailValue = int32(_tempNum_) }
{
var _arr_ []interface{}
var _ok_ bool

View File

@ -176,6 +176,7 @@ type Tables struct {
Navigation *GameNavigation
BuzkashiMount *GameBuzkashiMount
BuzkashiLv *GameBuzkashiLv
BuzkashiQteLv *GameBuzkashiQteLv
BuzkashiGrade *GameBuzkashiGrade
BuzkashiReward *GameBuzkashiReward
BuzkashiFm *GameBuzkashiFm
@ -1255,6 +1256,12 @@ func NewTables(loader JsonLoader) (*Tables, error) {
if tables.BuzkashiLv, err = NewGameBuzkashiLv(buf) ; err != nil {
return nil, err
}
if buf, err = loader("game_buzkashiqtelv") ; err != nil {
return nil, err
}
if tables.BuzkashiQteLv, err = NewGameBuzkashiQteLv(buf) ; err != nil {
return nil, err
}
if buf, err = loader("game_buzkashigrade") ; err != nil {
return nil, err
}