Reputation: 379
I have this piece of software, let's call it an agent, deployed on every machine in a local network. Every once in a while, it needs to pull an update from the server. That means, each machine in that network connects to my server and downloads the new version which is a few MB.
What i want to achieve: Once the first machine pulls the update from the server, the other machines should get the update from the one(s) that already got it, in a peer network.
The ideas i have so far:
Use a shared folder in the network, first machine that gets the update places it into that shared folder. Every machine checks the shared folder first before going to my server. This works, but i get problems if sharing is not enabled in windows, firewalls, access rights, etc.
Each agent opens a socket available to the internal network (probably open a tcp socket on 127.0.0.1 on a random port that all the agents know about). Before pulling the update, broadcast to the network that you request an update, and if nobody replies that they have the update, proceed to the server. Else, get the update from the agent who replied, since they probably already got the update from the server or from some other agents. The problems i have here is that i don't really know how to proceed with the network discovery, nor the performance impact this could have.
Build a local server app, publish it on some node of the internal network (one of the computers) that all the other agents connect to for updates. This local server gets the update only the first time, and it "caches" it, giving it to any agent requesting it. This is my least favorite option, since it implies a local server. If that one fails, no other node can get updates. Of course, i can implement fallback mechanism to go to the real server, but still. And also, every agent will need to know exactly who the "master" is, and that would be even harder to manage.
If you guys have any better ideas, or any guides to lead me to, would be much appreciated.
Thank you.
Upvotes: 0
Views: 674
Reputation: 1836
Essentially you
I would go with the broadcast in the spirit of peer-to-peer.
Upvotes: 1