Process of Skynet 1

Source: Internet
Author: User

LogPath = "."
Harbor = 1
Address = "127.0.0.1:2526"
master = "127.0.0.1:2013"
Start = "Main"--main script
Bootstrap = "Snlua Bootstrap"-The service for Bootstrap
standalone = "0.0.0.0:2013"
Luaservice = root: " service/?. Lua; ". Root: " Test/?. Lua; ". Root: " Examples/?. Lua
Lualoader = "Lualib/loader.lua"
--preload = "./examples/preload.lua"--run Preload.lua before every LUA service run
Snax = root: " Examples/?. Lua; ". Root: " Test/?. Lua
--Snax_interface_g = "Snax_g"
CPath = root: " cservice/?. So
--Daemon = "./skynet.pid"

The above is the configuration file:

Skynet will first start the C service Logger log output in the service responsible for logging

Bootstrap is the second service that Skynet runs, and the default bootstrap configuration item is "snlua bootstrap" , which means that Skynet initiates the snlua of the service and passes bootstrap as a parameter to it. Snlua is the LUA sandbox service, Bootstrap will match to the final Lua script based on the configured Luaservice. If you press the default configuration, the script should be Service/bootstrap.lua

Next, the bootstrap script will start launcher, depending on the number of nodes (up to 255) to determine if single-node mode

Then use Skynet in multi-process mode according to standalone.

Determines whether the current node is the primary node and the primary node needs to open a control center and interact with other nodes

Typically standalone and master address ports, the Cslave service is turned on after Cmaster is turned on two services are also responsible for synchronizing the globally visible service names in the Skynet network

Master listens on this address (Master-slave (1:n), control node-work node)

The control node (which can also be a working node) needs to run a master service

A slave service needs to be run on each work node (the active connection master is configured as per the standalone configuration, waiting for the existing slave to connect to itself)

All nodes that need to communicate with other nodes are running a harbor service

In the case of multi-node mode, for the master node, the Cmaster service needs to be started for node scheduling. In addition, each node (including the master node itself) needs to start the Cslave service for message forwarding between nodes, as well as synchronizing global names.

Next on the master node, you also need to start the DataCenter service.

Then, start the management for UniqueService service_mgr .

Finally, it reads the start configuration item from Config and runs as a user-defined service startup portal script. After success, put yourself out.

The start configuration item is the user-defined startup script, the default value is "main"

And then there's the Lua script, and here's how LUAAPI is used.

Https://github.com/cloudwu/skynet/wiki/LuaAPI

Process of Skynet 1

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.