Skip to content

Actors

Actors in Raindrop provide stateful compute units that maintain persistent memory and unique identity across requests. Unlike stateless services, actors remember information between interactions and are accessed by specific identifiers, making them ideal for user sessions, shopping carts, and workflows.

What Actors Provide

Persistent State Management Actors maintain memory that survives between requests, storing session data, workflow progress, and user-specific information without external databases.

Identity-Based Routing Each actor has a unique identifier that routes all related requests to the same instance, ensuring consistency and enabling stateful operations.

Isolation and Concurrency Actors operate independently with isolated state, preventing race conditions and enabling safe concurrent processing of different entities.

Time-Based Operations Built-in alarm system allows actors to schedule future operations like session timeouts, reminders, and workflow advancement.

When to Use Actors

Good Fit

  • Stateful Entities: User sessions, shopping carts, game instances, or any entity that needs persistent identity
  • Workflow Management: Multi-step processes that maintain progress across multiple interactions
  • Rate Limiting: Per-user or per-API-key rate limiting with accurate, isolated counters
  • Real-time Features: Chat rooms, collaborative editing, or live updates that require persistent state

Consider Alternatives

  • Stateless Operations: Simple request-response patterns work better with Services
  • Shared Data: Information accessed by multiple users simultaneously belongs in SQL databases
  • High-Throughput Processing: Identical operations on different data work better with stateless Services

Integration Patterns

Service Gateway Access Services act as public entry points that route authenticated requests to appropriate actors based on user identity or session tokens.

Actor-to-Actor Communication Actors can communicate with each other for complex workflows while maintaining isolation through message passing rather than shared state.

External Storage Integration Actors complement databases by storing active session state while using SQL for persistent business data and historical records.

Event-Driven Workflows Actors can respond to external events and trigger other system components, enabling sophisticated stateful processing chains.

Actors excel at maintaining persistent identity and state for entities that need to remember information across multiple interactions.