In a serverless, decentralized cloud computing network like Taubyte, maintaining state can be a challenge, especially when you cannot predict which node will execute a function next. This is where Taubyte Globals come in.
Taubyte Globals are stateful variables designed to scale horizontally across the network. They provide a way to maintain and manipulate state across numerous function invocations and across different nodes in the network. They can be thought of as “shared memory” in the network that various functions can read from or write to.
Use Cases for Globals
Globals are particularly useful for storing session information or any data that needs to be persisted and shared across different function invocations or nodes. This statefulness capability enables you to build more complex and dynamic applications that maintain continuity across interactions, a feature not typically associated with serverless models.
Taubyte Globals are implemented as opaque bytes. That means they don’t have a predetermined type and can hold any kind of binary data. This design choice provides developers with great flexibility. While the global itself doesn’t understand data types, Taubyte’s SDKs provide the functionality to build types around these globals, offering an intuitive and type-safe way to interact with them.
Taubyte Globals are designed to survive horizontal scaling and partitioning. The current mechanism that ensures this consistency across the network is Conflict-free Replicated Data Types (CRDTs), a type of data structure that can resolve conflicts without requiring coordination. While CRDTs are the current mechanism, we plan to introduce additional consensus algorithms such as Practical Byzantine Fault Tolerance (PBFT) in the future.
Operations on Globals
Remember that operations on globals are based on value assignment rather than specific operations like addition or multiplication. That’s because globals are opaque and don’t inherently understand these operations. This approach keeps the system simpler and more universally applicable to a variety of use cases.
With Taubyte Globals, your serverless applications gain an ability to share and maintain state across the network, enabling you to build more complex, interactive, and dynamic applications on this edge-native platform.