MongoDB as RPC
- Needed for timed game events.
- Needed because Facebook’s API is slow.
- Background task execution.
- Immediate or scheduled.
- Captures responses and exceptions.
- Acts as a state machine with atomic locking.
- Uses the “update if current” mechanism.
- Stores job data in a MongoDB collection.
- Easy to scale. (Sharding / replication.)
- Push notifications via capped collection.
- The same method MongoDB uses internally for replication.
- Uses Futures for parallel execution of tasks.
- Custom thread-pool, though.
- Uses APScheduler for timed execution of tasks.
- Limited size, optionally limited document count using capped collections.
- Ring buffer design. Insert order. Updates allowed if resulting data is same or smaller size.
- Used by MongoDB internally for multi-server replication.
- Tailable cursors. Long-poll push, like IMAP IDLE.
- Workers are immediately handed the newly inserted record.
Have an actually working implementation: https://gist.github.com/amcgregor/52a684854fb77b6e7395