BlocktreeCloudPaper.tex 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275
  1. \documentclass{article}
  2. \usepackage[scale=0.8]{geometry}
  3. \usepackage{hyperref}
  4. \title{The Blocktree Cloud Orchestration Platform}
  5. \author{Matthew Carr}
  6. \begin{document}
  7. \maketitle
  8. \begin{abstract}
  9. This document is a proposal for a novel cloud platform called Blocktree.
  10. The system is described in terms of the actor model,
  11. where tasks and services are implemented as actors.
  12. The platform is responsible for orchestrating these actors on a set of native operating system processes.
  13. A service is provdied to actors which allows them access to a highly available distributed file system,
  14. which serves as the only source of persistent state for the system.
  15. High availability is achieved using the Raft consensus protocol to synchronize the state of files between processes.
  16. All data stored in the filesystem is secured with strong integrity and optional confidentiality protections.
  17. A network block device like interface allows for fast low-level read and write access to the encrypted data,
  18. with full support for client-side encryption.
  19. Well-known cryptographic primitives and constructions are employed to provide this protection,
  20. the system does not attempt to innovate in terms of cryptography.
  21. The system's trust model allows for mutual TLS authentication between all processes in the system,
  22. even those which are controlled by different owners.
  23. By integrating these ideas into a single platform,
  24. the system aims to advance the status quo in the security and reliability of software systems.
  25. \end{abstract}
  26. \section{Introduction}
  27. % Describe paths, actors, and files. Emphasize the benefit of actors and files sharing the same
  28. % namespace.
  29. Blocktree is an attempt to extend the Unix philosophy that everything is a file
  30. to the entire distributed system that comprises modern IT infrastructure.
  31. The system is organized around a global distributed filesystem which defines security
  32. principals, resources, and their authorization attributes.
  33. This filesystem provides a language for access control that can be used to securely grant principals
  34. access to resources from different organizations, without the need to setup federation.
  35. The system provides an actor runtime for orchestrating tasks and services.
  36. Resources are represented by actors, and actors are grouped into operating system processes.
  37. Each process has its own credentials which authenticate it as a unique security principal,
  38. and which specify the filesystem path where the process is located.
  39. A process has authorization attributes which determine the set of processes that may communicate with it.
  40. Every connection between processes is established using mutual TLS authentication,
  41. which is accomplished without the need to trust any third-party certificate authorities.
  42. The cryptographic mechanisms which make this possible are described in detail in section 3.
  43. Messages addressed to actors in a different process are forwarded over these connections,
  44. while messages delivered to actors in the same process are delivered with zero-copying.
  45. One of the major challenges in distributed systems is managing persistent state.
  46. Blocktree solves this issue using its distributed filesystem.
  47. Files are broken into segments called sectors.
  48. The sector size of a file can be configured when it is created,
  49. but cannot be changed after the fact.
  50. Reads and writes of individual sectors are guaranteed to be atomic.
  51. The sectors which comprise a file and its metadata are replicated by a set of processes running
  52. the sector service.
  53. This service is responsible for storing the sectors of files which are contained in the directory
  54. containing the process in which it is running.
  55. The actors providing the sector service in a given directory coordinate with one another using
  56. the Raft protocol to synchronize the state of the sectors they store.
  57. This method of partitioning the data in the filesystem based on directory
  58. allows the system to scale beyond the capabilities of a single consensus cluster.
  59. Sectors are secured with strong integrity protection,
  60. which allows anyone to verify that their contents were written by an authorized principal.
  61. Encryption can be optionally applied to sectors,
  62. with the system handling key management.
  63. The cryptographic mechanisms used to implement these protections are described in section 3.
  64. To reduce load on the sector service, and to allow the system to scale to a larger number of users,
  65. a peer-to-peer distribution system is implemented in the filesystem service.
  66. This system allows filesystem actors to download sectors from other filesystem actors
  67. that have the sectors in their local cache.
  68. The threat of malicious actors serving bad sector data is mitigated by the strong integrity
  69. protections applied to sectors.
  70. By using peer-to-peer distribution, the system can serve as a content delivery network.
  71. One of the design goals of Blocktree is to facilitate the creation of composable distributed
  72. systems.
  73. A major challenge to building such systems is the difficulty in pinning down bugs when they
  74. inevitably occur.
  75. Research into session types (a.k.a. Behavioral Types) promises to bring the safety benefits
  76. of type checking to actor communication.
  77. Blocktree integrates a session typing system that allows protocol contracts to be defined that
  78. specify the communication patterns of a set of actors.
  79. This model allows the state space of the set of actors participating in a computation to be defined,
  80. and the state transitions which occur to be specified based on the types of received messages.
  81. These contracts are used to verify protocol adherence statically and dynamically.
  82. This system is implemented using compile time code generation,
  83. making it a zero-cost abstraction.
  84. By freeing the developer from dealing with the numerous failure modes that occur in a communication protocol,
  85. they are able to focus on the functionality of their system.
  86. Blocktree is implemented in the Rust programming language.
  87. Its source code is licensed under the Affero GNU Public License Version 3.
  88. It can be downloaded at the project homepage at \url{https://blocktree.systems}.
  89. Anyone interested in contributing to development is welcome to submit a pull request
  90. to \url{https://gogs.delease.com/Delease/Blocktree}.
  91. If you have larger changes or architectural suggestions,
  92. please submit an issue for discussion prior to spending time implementing your idea.
  93. % Describe the remainder of the paper.
  94. The remainder of this paper is structured as follows:
  95. \begin{itemize}
  96. \item Section 2 describes the actor runtime, service and task orchestration, and service
  97. discovery.
  98. \item Section 3 discusses the filesystem, its concurrency semantics and implementation.
  99. \item Section 4 details the cryptographic mechanisms used to secure communication between
  100. actor runtimes and to protect sector data.
  101. \item Section 5 is a set of examples describing ways that Blocktree can be used to build systems.
  102. \item Section 6 provides some concluding remarks.
  103. \end{itemize}
  104. \section{Actor Runtime}
  105. % Motivation for using the actor model.
  106. Building scalable fault tolerant systems requires us to distribute computation over
  107. multiple computers.
  108. Rather than switching to a different programming model when an application scales beyond the
  109. capacity of a single computer,
  110. it is beneficial in terms of programmer time and program simplicity to begin with a model that
  111. enables multi-computer scalability.
  112. Fundamentally, all communication over an IP network involves the exchange of messages,
  113. namely IP packets.
  114. So if we wish to build scalable fault-tolerant systems,
  115. it makes sense to choose a programming model built on message passing,
  116. as this will ensure low impedance with the underlying networking technology.
  117. % Overview of message passing interface.
  118. That is why Blocktree is built on the actor model
  119. and why its actor runtime is at the core of its architecture.
  120. The runtime can be used to spawn new actors, register services, and dispatch messages.
  121. Messages can be dispatched in two different ways: with \texttt{send} and \texttt{call}.
  122. A message is dispatched with the \texttt{send} method when no reply is required,
  123. and with \texttt{call} when exactly one is.
  124. The \texttt{Future} returned by \texttt{call} can be awaited to obtain the reply.
  125. If a timeout occurs while waiting for the reply,
  126. then the \texttt{Future} completes with an error.
  127. The name \texttt{call} was chosen to bring to mind a remote procedure call,
  128. which is the primary use case this method was intended for.
  129. Awaiting replies to messages serves as a simple way to synchronize a distributed computation.
  130. % Delivering messages over the network.
  131. Messages can be forwarded between actor runtimes using a secure transport layer called
  132. \texttt{bttp}.
  133. Messages are addressed using \emph{actor names}.
  134. An actor name is a pair consisting of the filesystem path of the runtime
  135. and a UUID specifying an actor in that runtime.
  136. Every message has a header containing the name of the sender and receiver.
  137. The transport is implemented using the QUIC protocol, which integrates TLS for security.
  138. The TLS handshake between runtimes is performed using mutual TLS authentication.
  139. This handshake cryptographically verifies the credentials of each runtime.
  140. These credentials contain the filesystem path where each runtime is located,
  141. which ensures that messages addressed to a specific path will only be delivered to the runtime
  142. at that path.
  143. % Delivering messages locally.
  144. When a message is sent between actors in the same runtime it is delivered into the queue of the recipient without any copying,
  145. while ensuring immutability (move semantics).
  146. This is possible thanks to the Rust ownership system,
  147. because the message sender gives ownership to the runtime when it dispatches the message,
  148. and the runtime gives ownership to the recipient when it delivers the message.
  149. % Security model based on filesystem permissions.
  150. A runtime is represented in the filesystem as a file.
  151. This file contains the authorization attributes which are associated with the runtime's security
  152. principal.
  153. The credentials used by the runtime specify the file, so other runtimes are able to locate it.
  154. The metadata of the file contains authorization attributes just like any other file
  155. (e.g. UID, GID, and mode bits).
  156. In order for a principal to be able to send a message to an actor in the runtime,
  157. it must have execute permissions for this file.
  158. Thus communication between runtimes can be controlled using simple filesystem permissions.
  159. Permissions checking is done during the \texttt{bttp} handshake.
  160. Note that it is possible for messages to be sent in one direction in a \texttt{bttp} connection
  161. but not in the other.
  162. In this situation replies are permitted but unsolicited messages are not.
  163. An important trade-off which was made when designing this model was that messages which are
  164. sent between actors in the same runtime are not subject to any authorization checks.
  165. This was done for two reasons: performance and security.
  166. By eliminating authorization checks messages can be more efficiently delivered between actors in the
  167. same process,
  168. which helps to reduce the performance penalty of the actor runtime over directly using threads.
  169. Security is enhanced by this decision because it forces the user to separate actors with different
  170. security requirements into different operating system processes,
  171. which ensures all of the process isolation machinery in the operating system will be used to
  172. isolate the different security domains.
  173. % Representing resources as actors.
  174. As in other actor systems, it is convenient to represent resources in Blocktree using actors.
  175. This allows the same security model used to control communication between actors to be used for
  176. controlling access to resources,
  177. and for resources to be shared by many actors.
  178. For instance, a Point-to-Point Protocol connection could be owned by an actor.
  179. This actor could forward traffic delivered to it in messages over this connection.
  180. The set of actors which are able to access the connection is controlled by setting the filesystem
  181. permissions on the file for the runtime executing the actor with the connection.
  182. % Service discovery.
  183. In addition to spawning actors, the runtime can also be used to register actors as service
  184. providers.
  185. A service is identified by a filesystem path.
  186. One or more actors may be register as providing a service.
  187. Services are resolved to actor names by the runtime.
  188. The service resolution method takes the path of a service and a scope path.
  189. The scope path defines the filesystem path where service resolution will begin.
  190. Resolution produces the name of an actor which is registered in a runtime which is closest to the
  191. scope, or \texttt{None} if no service provider can be found.
  192. To be more precise, consider the following cases:
  193. \begin{enumerate}
  194. \item If the scope is the path of a runtime, and there are service providers registered in the
  195. runtime, then one of their names if returned. Otherwise, service resolution is retried using a
  196. new scope which is obtained by removing the last path component of the current scope.
  197. \item If a directory is specified, then all of the runtimes in the directory are checked for
  198. registered service providers, and if one is found its name is returned. Otherwise, service
  199. resolution is retried using a new scope which is obtained by removing the last path component of
  200. the current scope.
  201. \item If the scope is the empty string, then \texttt{None} is returned.
  202. \end{enumerate}
  203. In order to contact other runtimes and query their service registrations,
  204. their IP addresses need to be known.
  205. To enable this a file with the runtime's IP address is maintained in the same directory as the
  206. runtime.
  207. The runtime is granted write permissions on the file,
  208. and it is updated by the transport layer when it begin listening on a new endpoint.
  209. % The sector and filesystem service.
  210. The filesystem is itself implemented as a service.
  211. A filesystem service provider can be passed messages to delete files, list directory contents,
  212. open files, or perform several other standard filesystem operations.
  213. When a file is opened,
  214. a new actor is spawned which owns the newly created file handle and its name is returned to the
  215. caller in a reply.
  216. Subsequent read and write messages are sent to this actor.
  217. The filesystem service does not persist any data itself,
  218. its job is to function as an integration layer,
  219. conglomerating sector data from many different sources into a single unified interface.
  220. The sector service is what is ultimately responsible for storing data,
  221. and thus maintaining the persistent state of the system.
  222. It stores sector data in the local filesystem of each computer on which it is registered.
  223. The details of how this is accomplished are deferred to the next section.
  224. % protocol contracts, and runtime checking of protocol adherence. Emphasize the benefits to
  225. % system composability that this enables, where errors can be traced back to the actor which
  226. % violated the contract.
  227. To facilitate the creation of composable systems,
  228. a protocol contract checking system based on session types has been designed.
  229. This system operates on a state transition model of a communications protocol.
  230. \section{Filesystem}
  231. % Benefits of using a distributed filesystem as the sole source of persistent state for the system,
  232. % including secure software delivery.
  233. % Accessing data at two different levels of abstraction: sectors and files.
  234. % Concurrency semantics at the sector layer, and their implementation using Raft.
  235. \section{Cryptography}
  236. \section{Examples}
  237. This section contains examples of systems built using Blocktree. The hope is to illustrate how this
  238. platform can be used to implement existing applications more easily and to make it possible to
  239. implement systems which are currently out of reach.
  240. \subsection{A personal cloud for a home user.}
  241. % Describe my idealized home Blocktree setup.
  242. \subsection{An ecommerce website.}
  243. % Describe a blocktree which runs a cluster of webservers, a manufacturing process, a warehouse
  244. % inventory management system, and an order fulfillment system.
  245. \subsection{A realtime geo-spacial environment.}
  246. % Explain my vision of the metaverse.
  247. \section{Conclusion}
  248. \end{document}