3 ms·
The general idea is very interesting, but the drawback I see is that this architecture makes it impossible for apps to do work that accesses multiple grains. S
by xg15 11y ago
The general idea is very interesting, but the drawback I see is that this architecture makes it impossible for apps to do work that accesses multiple grains.
Search would be the most obvious example. This was solved pragmatically by implementing it in the framework and not in the apps, but that approach doesn't seem to scale for me. What if certain types of grains require application-specific indexing? What if there are other tasks that cross grain boundaries but only make sense for a specific app?
Additionally, this limitiation makes it critical to get the definition of what is a grain right from the very start, when you design your app - once you realized you got the granularity wrong, I figure it would be very hard to split or merge existing grains to change it.
If I remember correctly, the Sandstorm documentation itself had examples for a word processor and for a photo editor app. However, while a grain for the word processor represents a single document, a grain for the photo editor is a photo gallery. So choosing granularity is not always trivial.
- static_noise 11y agoI'm not deep into sandstorm or know how search is/will be implemented there but these thoughts might help understanding alternatives. It seems you see the search indexer as a process which has accesses all data from the outside in order to index it. What if each grain itself exposes its inner index via an interface that can be accessed by the global search indexer? This way the search indexer only sees what it shall see but not data meant to be hidden (like passwords). Also by exposing it via a security managed interface not every process/grain gets access to every other grains data. This method surely complicates things a bit compared to file system access but the minimum implementation of the grain presenting the search the whole internal file tree. Is no worse than the traditional way.
- kentonv 11y agoWhile having each grain implement a search API would be an elegant approach, it probably isn't practical. With the fine-grained model, we expect users to have hundreds, maybe thousands of grains, and possibly access to (and therefore searchability over) thousands more. Just replicating the query would probably be too expensive. Also keep in mind that a grain normally isn't running unless it is actively being used, and so such a search query would need to start up thousands of grains all at once. On the other hand, having a single central search index is a pretty big security liability. A bug in search would potentially give you read access to the contents of all documents on the server. Moreover, fine-grained encryption breaks down: since everyone can use the search index, it would need to be encrypted using a key that everyone has access to. Instead, each user should have a separate search index covering their own private data. This search index itself should run as a grain, to get the same protections / encryption as other grains. The search index grain should not be allowed to hold capabilities to any other grain. Communications between the search index and the grains being indexed should be one-way. The only two-way communication is the search query API, which should usually be accessible only to the user. As an (important) optimization, grains that are public or accessible to a large number of users should be indexed in shared indexes, not per-user.
- static_noise 11y agoWe were thinking about two/three different things what the grain does: 1) My idea was that the grain exposes selected data to a search indexer. 2) Your idea was that the grain performs the search itself. I see why 2) would not work very well in the current implementation. But 1) should work well and make it possible to only expose selected data. (Also with central/user specific search.) Both ideas could by combined via per-grain-search-grains which only hold the local index and are accessed via a central search interface. The problem, however, remains, that searchable data is exposed data. To me it seems useful that some applications can have fine-grained control about what to expose. (Think of List of Establishments where each has a List of Customers with Credit Card information. You might make one or two things searchable but not everything.)
- kentonv 11y agoYes, there are certainly some patterns that become challenging under the grain model (and some patterns that become easier). Note that nothing is impossible. You can always connect grains to each other using the powerbox (when it's ready, which will be very soon). Of course, if nearly every grain of some app needs to talk to all the others, that will get tedious. So the next thing you can do is fall back to course-grained apps, or write an app that creates its own grains internally and therefore can talk to all of them if it needs to. In this case, you're giving up a lot of the advantages of the granular model, but you gotta do what you gotta do. What you end up with is no worse than the status quo, at least. With that said, in practice we have found that aside from a small set of common features -- e.g. search and backup -- these kinds of problems really don't come up much. Most kinds of inter-grain communications do in fact fit nicely into the powerbox model. By adding platform features to cover the things that don't fit, we can cover, say, 90% of use cases without compromising the model, and that's a pretty big win. And frankly, these features usually make far more sense as platform features than as app features anyway. A search index that covers all your apps is a lot more useful than having to search each app separately. A backup system that backs up all your apps is one you'll be much more likely to actually configure. Etc. Also note that these kinds of systems that need access to "everything" are a security liability, and so probably not the kind of thing that you want every app implementing in their own special way. By moving them into the platform, we can make sure they are designed with restrictions that make them secure. For example, the backup system should only get access to encrypted copies of data. The search index should be prohibited from exfiltrating data in any way except as search results displayed to the user. Etc. Anyway, the point is, yes, there are challenges, but with a pragmatic approach, they can be minimized, and the gains far outweigh the losses.
- augb 11y agoDo you see sandstorm as ever hosting medium-to-large scale, externally-facing websites (as opposed to personal or intranet-type sites)?
- kentonv 11y agoSome day, yes. However, for now we are focused on the use case where the infrastructure reports to the user rather than the developer. Developers ship packages, users choose where to run them (whether on their own machines or a cloud host). We feel we have a lot more value to provide in this use case than we would have in the SaaS infrastructure market. Also, if we can make it just as easy to use apps on a user-controlled server as it is to use SaaS, then SaaS no longer makes sense -- it's biggest selling point is that it's easy. I believe a shift back towards more decentralized infrastructure would be a very good thing, so that's what we're aiming to create.