Skip to content

Commit

Permalink
修复io编译, 更新性能测试数据
Browse files Browse the repository at this point in the history
  • Loading branch information
davyxu committed Jan 8, 2017
1 parent 1caec2d commit cb0ad13
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
12 changes: 9 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,19 @@

命令行: go test -v github.com/davyxu/cellnet/benchmark/io

CPU: i7 6700 3.4GHz 8核
平台: Windows 7 x64/CentOS 6.5 x64

测试用例: localhost 1000连接 同时对服务器进行实时PingPong测试

平台: Windows 7 x64/CentOS 6.5 x64
配置1: i7 6700 3.4GHz 8核

QPS: 11.7w

配置2: i5 4590 3.3GHz 4核

QPS: 10.1w


QPS: 13.7w


# 例子
Expand Down
12 changes: 6 additions & 6 deletions benchmark/io/io_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@ var signal *test.SignalTester
const benchmarkAddress = "127.0.0.1:7201"

// 客户端并发数量
const clientCount = 1000
const clientCount = 100

// 测试时间(秒)
const benchmarkSeconds = 10

func server() {

queue := cellnet.NewEventQueue2()
queue := cellnet.NewEventQueue()
qpsm := benchmark.NewQPSMeter(queue, func(qps int) {

log.Infof("QPS: %d", qps)
Expand All @@ -36,7 +36,7 @@ func server() {

evd := socket.NewAcceptor(queue).Start(benchmarkAddress)

socket.RegisterSessionMessage(evd, "gamedef.TestEchoACK", func(content interface{}, ses cellnet.Session) {
socket.RegisterMessage(evd, "gamedef.TestEchoACK", func(content interface{}, ses cellnet.Session) {

if qpsm.Acc() > benchmarkSeconds {
signal.Done(1)
Expand All @@ -53,17 +53,17 @@ func server() {

func client() {

queue := cellnet.NewEventQueue2()
queue := cellnet.NewEventQueue()

evd := socket.NewConnector(queue).Start(benchmarkAddress)

socket.RegisterSessionMessage(evd, "gamedef.TestEchoACK", func(content interface{}, ses cellnet.Session) {
socket.RegisterMessage(evd, "gamedef.TestEchoACK", func(content interface{}, ses cellnet.Session) {

ses.Send(&gamedef.TestEchoACK{})

})

socket.RegisterSessionMessage(evd, "gamedef.SessionConnected", func(content interface{}, ses cellnet.Session) {
socket.RegisterMessage(evd, "gamedef.SessionConnected", func(content interface{}, ses cellnet.Session) {

ses.Send(&gamedef.TestEchoACK{})

Expand Down

0 comments on commit cb0ad13

Please sign in to comment.