salt as a distribution platform for large files
The idea is to stream large files between random minions with optimal network efficiency (given a well-designed salt topology) and without extra delays.
- Any minion has a module function to grab a file from a minion, with an ACL mechanism to establish who can grab what from who, or simply what can be grabbed from who (somewhat like publish.publish).
- A syndic-like agent, let's call it "cacher" here, runs on each master and ensures that the file gets transmitted everywhere.
- The receiving minions requests request for the file to their master's cacher.
- For each request, the first common master ancestor has to be established. The file request is forwarded recursivelyfrom cacher to cacher down to the minion holding the file.
- The cachers forward the chunks as they arrive to the subscribing cachers (their parent if the file comes from a minion below them, and/or their minions if they subscribed).
- Each cacher caches every chunk, and locking ensures that a chunk is not requested multiple times by the same cacher.
- As each cacher gets new subscriptions, it serves every cached chunk and keeps receiving chunks.
- Once the file is entirely provided to a minion, the module call ends.
This is good stuff, but will take some thinking, I might have to push this beyond 1.0 if I can't figure out the best way to do it
Why not considering using something like Murder developed by Twitter for such a use case. The github repo is here: https://github.com/lg/murder. Also Etsy recently wrote an article on how they use BitTorrent to replicate the Solr indexes between machines http://codeascraft.etsy.com/2012/01/23/solr-bittorrent-index-replication/
I think that the concept here is that we should get some more modules written for things like murder and bit torrent. Then these mediums can be used for file transfer as well as the built in Salt mechanism. Also, a lot of this ticket is to just expand the functionality of the built in file server, which already does a great job or distributing files in parallel.
If you're dealing with actual / large files, you probably should have something dedicated to that outside of Salt that gets setup through States. I'm not sure where Salt has advantages as a general purpose file server over existing solutions, though it is a very fast network protocol and tempting to think about.
Yes, I think that the syndic should have a caching/distribution capability, but beyond that, moving the salt file server into a general purpose zeromq fileserver might be a good idea
Bittorrent seems like a good idea..
I found these reference cases..
eBay http://www.ebaytechblog.com/2012/01/31/bittorrent-for-package-distribution-in-the-enterprise/
Facebook http://torrentfreak.com/facebook-uses-bittorrent-and-they-love-it-100625/
Twitter http://torrentfreak.com/twitter-uses-bittorrent-for-server-deployment-100210/
Some university http://torrentfreak.com/university-uses-utorrent-080306/
For distributing large files we're now going to have a look at Murder, http://engineering.twitter.com/2010/07/murder-fast-datacenter-code-deploys.html, but it hasn't been updated for over 2 years. When messaging a bit with Larry (formerly Twitter) he says Murder is still active and being used on many projects. In fact, more and more internal twitter projects are using it today, along with companies like eBay and Zynga using it for certain internal transfers.. Would be cool to see if Salt could be used for this instead, or developed to integrate with or support Murder.
A few quotes from yesterdays IRC discussion on this topic:
"Murder is a very specialized deployment tool that uses bittorrent. I would not necessarily suggest solving that with salt. on the other hand, I could see making murder nodes deployed using salt to handle the deployment. If you used salt modules, you could generate a simple CI server with very little work and a deploy server as well.".. "this isn't to say that salt couldn't do deployment, but you'd need to build something to make it work with the salt tools at a minimum. I'm not a big fan of capistrano or jenkins personally, but right now nobody has built a salt-deploy or salt-ci toolchain." "Looking at the bittornado docs, I think it would be pretty simple to have salt set up a tracker on the master, or anywhere else for that matter, and then have the targeted minions start pulling down the file through bittorrent."
Funny you mention torrents, I had thought about that for large file support. But that might also mean opening up some more ports on the machines, and not everyone is willing to do that.
About a tracker we might get away with populating DHT nodes ourselves. Might be worth investigating...
Pedro Algarvio
----- Reply message ----- De: "s0l4r" [email protected] Para: "saltstack/salt" [email protected] Assunto: [salt] salt as a distribution platform for large files (#285) Data: qui, Out 4, 2012 19:38 Bittorrent seems like a good idea..
I found these reference cases..
eBay http://www.ebaytechblog.com/2012/01/31/bittorrent-for-package-distribution-in-the-enterprise/
Facebook http://torrentfreak.com/facebook-uses-bittorrent-and-they-love-it-100625/
Twitter http://torrentfreak.com/twitter-uses-bittorrent-for-server-deployment-100210/
Some university http://torrentfreak.com/university-uses-utorrent-080306/
For distributing large files we're now going to have a look at Murder, http://engineering.twitter.com/2010/07/murder-fast-datacenter-code-deploys.html, but it hasn't been updated for over 2 years. When messaging a bit with Larry (formerly Twitter) he says Murder is still active and being used on many projects. In fact, more and more internal twitter projects are using it today, along with companies like eBay and Zynga using it for certain internal transfers.. Would be cool to see if Salt could be used for this instead, or developed to integrate with or support Murder.
A few quotes from yesterdays IRC discussion on this topic:
"Murder is a very specialized deployment tool that uses bittorrent. I would not necessarily suggest solving that with salt. on the other hand, I could see making murder nodes deployed using salt to handle the deployment.
If you used salt modules, you could generate a simple CI server with very little work
and a deploy server as well.".. "this isn't to say that salt couldn't do deployment, but you'd need to build something to make it work with the salt tools at a minimum. I'm not a big fan of capistrano or jenkins personally, but right now nobody has built a salt-deploy or salt-ci toolchain."
"Looking at the bittornado docs, I think it would be pretty simple to have salt set up a tracker on the master, or anywhere else for that matter, and then have the targeted minions start pulling down the file through bittorrent."
—
Reply to this email directly or view it on GitHub.
More and more I get the feeling a clever person could setup Salt as it stands now to do very effective files distribution that beats murder, etc at a certain level.
I agree with you, following a similar behaviour as libtorrent does, the issue might be, will the salt(smart setup) behave better at it? Will it be worth the effort just to end-up thinking, "dam, let's try libtorrent"?
On 05-10-2012 15:45, Sean Channel wrote:
More and more I get the feeling a clever person could setup Salt as it stands now to do very effective files distribution that beats murder, etc at a certain level.
— Reply to this email directly or view it on GitHub https://github.com/saltstack/salt/issues/285#issuecomment-9177836.
This is a big problem, and the torrent does work well for it. But yes, there are a number of ways of thinking about it
For the record, I'm a big fan of the idea of getting salt to manage files quickly and to a large swath of machines in a short time period. I'm also the person who s0l4r quoted above. The challenge here is not one of state management, where copying a small amount (generally) of files around is the norm. Salt does this very well. The challenge is a performant way of distributing files across thousands of nodes.
In my opinion, salt is very fast. In fact it's the fastest CM tool I've used, and that's amazing. The problem is that transfer time of a file is transfer time of a file. If you watch the video sol4r linked from above, twitter uses bittorrent to make possibly large amounts of data go across their thousands of nodes in a very short time. However, the initial transaction takes the longest, of course, but so does the second one. Once two seeders are in place, things go much faster, since that's the value of chunking with bittorrent. I think bittorent is a very elegant platform and protocol for distributing large amounts of data to many disparate locations. Or, in the case of twitter, distributing large amounts of data in a semi-tree-like manner very quickly.
To make salt be able to do this would require a chunking and verification mechanism, which it already has, plus the ability to have systems be able to contact other nodes and ask for the data. It is possible to do this, but I don't know that salt was designed with the express intent of distributing files as bittorent.
My concern is that salt is really two things, a remote execution system and a state management tool. To make it do things that it aren't intended is the nature of free software folks. I've seen it a million times, and these manipulations can be good. The real questions to ask are what Pedro has already argued. Why not just have salt setup libtorrent (or bittornado) to do the work? That's what salt excels at, it's intent. Make a salt state that enables the concepts of murder and let bittorrent do the job it was built for.
I hope my comment can help the thought process here. I only intend them as suggestions and thoughts of value toward your idea. If you decide to do something like Murder with Salt and it works out really well, I'd love to see it.
Cheers,
Clint
On Fri, Oct 5, 2012 at 9:03 AM, Pedro Algarvio [email protected]:
I agree with you, following a similar behaviour as libtorrent does, the issue might be, will the salt(smart setup) behave better at it? Will it be worth the effort just to end-up thinking, "dam, let's try libtorrent"?
On 05-10-2012 15:45, Sean Channel wrote:
More and more I get the feeling a clever person could setup Salt as it stands now to do very effective files distribution that beats murder, etc at a certain level.
— Reply to this email directly or view it on GitHub https://github.com/saltstack/salt/issues/285#issuecomment-9177836.
— Reply to this email directly or view it on GitHubhttps://github.com/saltstack/salt/issues/285#issuecomment-9178423.
Hi Clint!
I had that chunking/verification on my mind also, to "skip" libtorrent. The thing is, for it to perform, it can't be the master serving to all minions. Or better, it can, like it does for state files, the checking is also done. I imagine salt sending chunked data as events which the minion's would pickup, if interested. The other problem would be, what about chunk's which fail verification, how do we get that chunk back? The minion waits for the master to say I'm finished, and asks the chunks it does not have? Or do we enable a torrent like system which will ask for missing chunks and any minion can reply to that?
On 05-10-2012 16:50, Clint Savage wrote:
For the record, I'm a big fan of the idea of getting salt to manage files quickly and to a large swath of machines in a short time period. I'm also the person who s0l4r quoted above. The challenge here is not one of state management, where copying a small amount (generally) of files around is the norm. Salt does this very well. The challenge is a performant way of distributing files across thousands of nodes.
In my opinion, salt is very fast. In fact it's the fastest CM tool I've used, and that's amazing. The problem is that transfer time of a file is transfer time of a file. If you watch the video sol4r linked from above, twitter uses bittorrent to make possibly large amounts of data go across their thousands of nodes in a very short time. However, the initial transaction takes the longest, of course, but so does the second one. Once two seeders are in place, things go much faster, since that's the value of chunking with bittorrent. I think bittorent is a very elegant platform and protocol for distributing large amounts of data to many disparate locations. Or, in the case of twitter, distributing large amounts of data in a semi-tree-like manner very quickly.
To make salt be able to do this would require a chunking and verification mechanism, which it already has, plus the ability to have systems be able to contact other nodes and ask for the data. It is possible to do this, but I don't know that salt was designed with the express intent of distributing files as bittorent.
My concern is that salt is really two things, a remote execution system and a state management tool. To make it do things that it aren't intended is the nature of free software folks. I've seen it a million times, and these manipulations can be good. The real questions to ask are what Pedro has already argued. Why not just have salt setup libtorrent (or bittornado) to do the work? That's what salt excels at, it's intent. Make a salt state that enables the concepts of murder and let bittorrent do the job it was built for.
I hope my comment can help the thought process here. I only intend them as suggestions and thoughts of value toward your idea. If you decide to do something like Murder with Salt and it works out really well, I'd love to see it.
Cheers,
Clint
On Fri, Oct 5, 2012 at 9:03 AM, Pedro Algarvio [email protected]:
I agree with you, following a similar behaviour as libtorrent does, the issue might be, will the salt(smart setup) behave better at it? Will it be worth the effort just to end-up thinking, "dam, let's try libtorrent"?
On 05-10-2012 15:45, Sean Channel wrote:
More and more I get the feeling a clever person could setup Salt as it stands now to do very effective files distribution that beats murder, etc at a certain level.
— Reply to this email directly or view it on GitHub https://github.com/saltstack/salt/issues/285#issuecomment-9177836.
— Reply to this email directly or view it on GitHubhttps://github.com/saltstack/salt/issues/285#issuecomment-9178423.
— Reply to this email directly or view it on GitHub https://github.com/saltstack/salt/issues/285#issuecomment-9180078.
I have worked a lot of this out already in my head. The only thing is finding the time to set it up. This will be a non-trivial undertaking :)
This would be an awesome challenge!
On 05-10-2012 17:02, Thomas S Hatch wrote:
I have worked a lot of this out already in my head. The only thing is finding the time to set it up. This will be a non-trivial undertaking :)
— Reply to this email directly or view it on GitHub https://github.com/saltstack/salt/issues/285#issuecomment-9180467.
Since you're already using ZMQ, perhaps using its PGM capability would be a good solution? If you don't have a lossy network, this should be reasonably efficient. Should. Granted it'd take setting up more ZMQ connections but that could be triggered over the control channel.
Good call, I will have to look into it!
Any update on this? Perhaps instead of file.managed some file.distributed.managed so torrent is used to distribute that file or a torrent like distributed setup.
I think it's just been lost in the shuffle. I've put it on the current milestone so we can get eyes on it again.
Any updates? I too would like to see a feature like this.
ping