Appendix A. Space Beaver Case Study: Actors, Kubernetes, and More
The Space Beaver project (from Pigs Can Fly Labs) uses satellite service from Swarm and Simple Mail Transfer Protocol (SMTP) to provide what is politely called value-conscious (aka cheap) off-grid messaging.1 The initial draft of Space Beaver’s core architecture was built using Scala and Akka, but then we switched to using Ray. By using Ray with Python instead of Akka with Scala, we were able to reuse the object relational mapping (ORM) from the website and simplify the deployment.
While it is possible to deploy Akka applications on Kubernetes, it is (in Holden’s opinion) substantially more complicated than accomplishing the same task with Ray.2 In this appendix, we will walk through the general design of the Space Beaver backend, the code for the various actors, and show how to deploy it (and similar applications).
Note
The code for this case study can be found in the Pigs Can Fly Labs GitHub repo.
High-Level Design
Space Beaver’s core requirement is to serve as a bridge between email (through SMTP), SMS (through Twilio), and the Swarm satellite APIs. Most of these involve some amount of state, such as running an SMTP server, but the outbound mail messages can be implemented without any state. Figure A-1 shows a rough outline of the design.
Implementation
Now that you’ve seen a rough ...
Get Scaling Python with Ray now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.