2056

download 2056

If you can't read please download the document

Transcript of 2056

.http://2056.ru

[email protected]

UA PyCon

2 400

http://ua.pycon.org/

!!!

2056.ru

MMORPG

: , ,

,

Python 3

ZeroMQ

Redis

MySQL

MsgPack

ZeroGW

ProcessBoss

Coffee script

ECO templates

less

JQuery

Flash

class Game constructor: (@ui, @document) -> @connection = new Connection('/websock') @connection.onmessage = @message message: (event) => try cmd = JSON.parse(event.data) @do_dispatch(cmd) catch e console.log(e) call: (args...) -> try @connection.send(JSON.stringify(args)) catch e @connect_error()

ZeroGW

Frontend server HTTP WebSocket

ZeroMQ

json

WebSocket Long Polling

: ,

GMT

ZeroGW: output

connection ID (CID)

CID UID

CID

, ..

Output

web_out.send(b'add_output', cid, b'["home.', b'home_1')...encoded = json.dumps(data).encode('ascii')web_out.send(b'send', cid, encoded)...web_out.send(b'drop', cid)web_out.send(b'del_output', cid)

ZeroGW: topic

ID

Topic

web_out.send(b'subscribe', cid, b'chat:room_1')...encoded = json.dumps(data).encode('ascii')web_out.send(b'publish', b'chat:room_1', encoded)...web_out.send(b'unsubscribe', cid, b'chat:room_1')

ZeroGWChatUserUserBattleBattleBattleGlobalMap

Service Components

Battle2Chat User2Battle1User1

User2ChatBattle2User1Battle1Octopus1Octopus2

Node2

Node1

ZeroMQ Device

MySQL2MySQL1

FrontNode

ZeroGW

Redis 1

Redis 2

Octopus

OctopusOctopus 2

TCP Socket

ZMQ1ZMQ2ZMQ3

Unix sockets

ZeroMQ

RPC (Request-Reply)

Notify (Push-Pull)

RPC ,

RPC () ,

Notify ,

1

, (sharding)

, ,

/

/

ZeroMQ

!!!

msgpack

Redis ,

MySQL , MySQL Redis.

Redis .

MySQL

()

MyISAM ( )

SQL .

MySQL key-value storage

JSON

MySQL 2

relations

15

Redis . .

, + .

Login

ClientAuthUserBattleChatGlobalMap

Reload

Logout

(msgpack)

-

,

,


Yaml

, ..

...

bossdzerogw

redis-namedb

redis-user

redis-chat

user-1

user-2

chat

octopus

, ,

( ).

,

ZeroMQ

(SLOC)

Python: 55k

Python tests: 30k

Coffee: 31k

Coffee tests: 10k

ActionScript: 32k

Yaml: 84k

C (OpenSource): 20k

Art: 2GB

?

.http://2056.ru

[email protected]