ngx_http_dyups_module icon indicating copy to clipboard operation
ngx_http_dyups_module copied to clipboard

关于多个worker同步upstream更新信息失败的问题

Open huhaipeng opened this issue 5 years ago • 7 comments

看了代码,在更新upstream信息时是其中一个worker先主动更新,其他worker从共享内存处获取msg来同步更新upstream。若其中某些worker更新信息失败,造成不一致,应该怎么解决?我见代码里没有相应的解决方法。

huhaipeng avatar Oct 10 '19 07:10 huhaipeng

@yzprofile @chobits 大佬们可以解答一下小弟的疑惑嘛?

huhaipeng avatar Oct 10 '19 08:10 huhaipeng

this module do not work normally when has worker processes more than two. i want to know when will be updated.

jhseodev avatar Jul 31 '20 02:07 jhseodev

这个问题在多核多worker下出现了同步的问题,请问这个怎么解决呀~~~

LucienCheng avatar Nov 11 '20 01:11 LucienCheng

这个问题在多核多worker下出现了同步的问题,请问这个怎么解决呀~~~

你说的同步问题具体是什么问题?具体是怎么造成的?其实程序正常运行的情况下应该是不会出现同步的问题的吧,感觉和多核无关。

huhaipeng avatar Nov 11 '20 02:11 huhaipeng

this module do not work normally when has worker processes more than two. i want to know when will be updated.

I test this module with multiple worker processes but nerver found any problems.So what is your specified problem ?

huhaipeng avatar Nov 11 '20 02:11 huhaipeng

@huhaipeng I'm using zone in upstream context as follow.

upstream my_ups {
  ...
  server ... ;
  zone ...;
  ...
}

location my_loc {
  ...
  set $dyups my_ups;
  proxy_pass http://$dyups;
  ...
}

When updating themy_ups upstream context, a new upstream context is created but zone is not initialized. One worker process that received request is updated and the others are not updated. This is what I have checked so far.

Please let me know if I am misunderstanding. Thank for comment.

jhseodev avatar Nov 11 '20 04:11 jhseodev

可以考虑在init_worker阶段给每个worker写个定时器,在定时器中处理upstream更新。

dzhcool avatar Nov 16 '20 03:11 dzhcool