Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

能做游戏服务器吗?有没热更新支持 #1622

Open
yingnierxiao opened this issue Sep 12, 2024 · 7 comments
Open

能做游戏服务器吗?有没热更新支持 #1622

yingnierxiao opened this issue Sep 12, 2024 · 7 comments

Comments

@yingnierxiao
Copy link

No description provided.

@Barenboim
Copy link
Contributor

优雅重启吗?我们tutorial里有个示例。我们的优雅重启是所有框架里最精确的。

@Barenboim
Copy link
Contributor

@yingnierxiao
Copy link
Author

不是,应该是不停止服务的情况,替换出问题的逻辑,而不是重启

@Barenboim
Copy link
Contributor

Barenboim commented Sep 13, 2024

对,优雅重启就是这个意思。listen过程不中断,服务中的任务也不中断。

原理是,我们的server启动可以直接传入listen_fd(通过server.serve()接口)。引导程序创建好listen fd,再fork()执行server程序(fd通过main函数参数传给server)。server通过这个listen_fd启动。

重启时,用户发生信号给server。server收到退出信号,调用shutdown()操作。shutdown()操作关闭server的listen fd,关闭不在服务中的持久连接。shutdown完毕server通知引导程序,引导程序会再fork()启动新server。原server调用wait_finish等待处理中的任务结束。

整个过程,除了旧server的持久连接会被关闭,client需要重写connect之外,对client是完全无感的。connect一定会被新的server处理。由于旧server关闭监听之后,新server就会立刻启动,所以中间也是没有缝隙的。

@yingnierxiao
Copy link
Author

那有共享内存相关的东西吗,还有个就是window下好像没有实现WFTaskFactory::create_pread_task的接口,另外window版本上也没有这个https://github.com/sogou/workflow/tree/master/tutorial/tutorial-16-graceful_restart 用例,window的版本是不是和linux上还有一定差异

@Barenboim
Copy link
Contributor

Windows下的我们就不会了……连fork操作都没有。目前Windows和Unix平台的功能无法对齐,windows下,强烈建议装个WSL运行Linux版本。共享内存的话,可以用户自己解决,和框架没有什么关系。

@yingnierxiao
Copy link
Author

好 大致了解了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants