Git Product home page Git Product logo

server's Introduction

Build Status GoDoc Go Report Card

Introduce

Server is a game server with horizontally-scalable and high-available. It was powered by go-micro and running in docker container. All services are disaster-tolerant and dynamically expandable.

Requirement

  • Golang 1.18 (with generics)
  • MongoDB
  • Consul (in release)
  • Nsq (in release)

Benchmark

Test device: macbook pro 16 2021 with Apple M1 Pro, 16G Mem
Robots number: 6000
Send message frequency: 2 messages per second 
Save Mongodb frequency: 12k per second
  • The machine cpu and memory usage are as follows:

    CPU usage: 15.16% user, 30.77% sys, 54.6% idle

  • The process occupies cpu and memory as follows:

    PID COMMAND %CPU MEM
    86643 gate 111.1 619M+
    86646 game 80.9 751M+
    86662 client_bots 71.3 679M+
    1512 mongod 30.6 160M
    71456 consul 1.9 53M-
    71121 nsqd 0.2 12M
    86656 mail 0.1 38M
  • The MongoDB operations performance are as follows:

    benchmark_mongodb

  • The players' message processing latency are as follows:

    benchmark_prometheus

Getting Started

  • Download - git clone this repo and cd in its root path

  • Start MongoDB - running in docker-compose:

docker-compose run --service-ports -d mongo
  • Start Gate - cd to apps/gate, run following command:
go run main.go
  • Start Game - open another terminal session, cd to apps/game, run following command:
go run main.go
  • Start Combat - open another terminal session, cd to apps/combat, run following command:
go run main.go
  • Start Client - open another terminal session, cd to apps/client, run following command:
go run main.go

now you can communicate with server using (up down left right enter): text mud

License

server is MIT licensed.

server's People

Contributors

hellodudu avatar kayuii avatar dependabot[bot] avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.