<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 12pt;
font-family:Calibri
}
--></style></head>
<body class='hmmessage'><div dir='ltr'><font face="Times New Roman, sans-serif" size="3"><span style="line-height: 23.8px; background-color: rgb(255, 255, 255);">Hi Nginxers,</span><br style="line-height: 23.8px; background-color: rgb(255, 255, 255);"><br style="line-height: 23.8px; background-color: rgb(255, 255, 255);"><span style="line-height: 23.8px; background-color: rgb(255, 255, 255);">I'm writing a new module that syncs upstreams from conf-servers(consul, etcd...).</span></font><div><font face="Times New Roman, sans-serif" size="3"><span style="line-height: 23.8px; background-color: rgb(255, 255, 255);"> </span><br style="line-height: 23.8px; background-color: rgb(255, 255, 255);"><span style="line-height: 23.8px; background-color: rgb(255, 255, 255);">During the nginx offering service, the module makes requests to the conf-server(consul, etcd...)</span><span style="line-height: 23.8px; background-color: rgb(255, 255, 255);"> to pull upstreams backend list if upstreams value has changed and update upstreams peers to make new backend servers working.</span></font></div><div><span style="line-height: 23.8px; background-color: rgb(255, 255, 255);"><font face="Times New Roman, sans-serif" size="3"><br></font></span></div><div><font face="Times New Roman, sans-serif" size="3"><span style="line-height: 23.8px; background-color: rgb(255, 255, 255);">The reason I write the module is that: </span></font></div><div><font color="#333333" face="Times New Roman, sans-serif" size="3"><span style="line-height: 25.6px; background-color: rgb(255, 255, 255);">      Last the Spring Festival, the company need extend the backend resources for the festival, need reload the new configuration of nginx, and find that partly requests cost much more time during the reloading, suspect it's caused by reloading. </span></font></div><div><font face="Times New Roman, sans-serif" size="3"><font color="#333333"><span style="line-height: 25.6px; background-color: rgb(255, 255, 255);">      The last, I think the fact prove it's true. The contrast between reloading and using module.</span></font></font></div><div><font color="#333333" style="font-family: 'Times New Roman', sans-serif; font-size: medium;"><span style="line-height: 25.6px; background-color: rgb(255, 255, 255);">      Other refer: </span></font><a href="https://www.nginx.com/blog/dynamic-reconfiguration-with-nginx-plus/" target="_blank" style="font-family: 'Times New Roman', sans-serif; font-size: medium;">https://www.nginx.com/blog/dynamic-reconfiguration-with-nginx-plus/</a><font face="Times New Roman, sans-serif"> .</font></div><div><font face="Times New Roman, sans-serif" size="3"><br style="line-height: 23.8px; background-color: rgb(255, 255, 255);"><span style="line-height: 23.8px; background-color: rgb(255, 255, 255);">On the other hand, the module I am writing is mostly different than other modules I could learn from, and </span><span style="line-height: 23.8px; background-color: rgb(255, 255, 255);">all my knowledge about nginx is from looking at how other </span><span style="line-height: 23.8px; background-color: rgb(255, 255, 255);">modules is written, I'm wondering and hoping if anyone could comment on how I </span><span style="line-height: 23.8px; background-color: rgb(255, 255, 255);">designed the module and raise any issues if I did anything problematic, </span><span style="line-height: 23.8px; background-color: rgb(255, 255, 255);">wrong,  weird or even stupid.</span><br style="line-height: 23.8px; background-color: rgb(255, 255, 255);"><br>Any convenience, the module is here: <a href="https://github.com/weibocom/nginx-upsync-module" target="_blank">https://github.com/weibocom/nginx-upsync-module</a></font></div>







<div><font face="Times New Roman, sans-serif" size="3"><br></font></div><div><font face="Times New Roman, sans-serif" size="3">As everyone knows every work process has it's conf, so the module realizes that every work-process pulls upstreams independently and updates its own peers. I think that's easy and more reliable. </font><span style="font-family: 'Times New Roman', sans-serif; font-size: 12pt; line-height: 23.8px; background-color: rgb(255, 255, 255);">Every peers is a array, so every updating need a new array and delete old peers, but, when delete old peers needing judge if having old requests use that. It's a little </span><span style="font-family: 'Times New Roman', sans-serif; font-size: 12pt;">complicated.</span><span style="font-family: 'Times New Roman', sans-serif; font-size: 12pt;">What do you think?</span></div><div><span style="font-family: 'Times New Roman', sans-serif; font-size: 12pt;"><br></span></div><div><font face="Times New Roman, sans-serif" size="3">work-process flow: startup->pull from conf-servers->pull success->try to update->work;</font></div><div><font face="Times New Roman, sans-serif" size="3">                                startup->pull from conf-servers->failed, parse dump file->try to update->work;</font></div><div><font face="Times New Roman, sans-serif" size="3"><br style="line-height: 23.8px; background-color: rgb(255, 255, 255);"><span style="line-height: 23.8px; background-color: rgb(255, 255, 255);">I am not sure I make that clear, but I really want to get you advise. Any comments, suggestions, warnings are welcome.</span><br></font><br>-----<div>Regards,</div><div>Xiaokai</div></div>                                      </div></body>
</html>