# Roshi: a CRDT system for timestamped events

DevFeed: [Roshi: a CRDT system for timestamped events](<https://devfeed.tech/articles/roshi-a-crdt-system-for-timestamped-events-2130.md>)

Original publisher: [Read original article](<https://developers.soundcloud.com/blog//roshi-a-crdt-system-for-timestamped-events>)

Published: 2014-05-09T00:00:00Z

Content type: article

Language: en

Sources: [SoundCloud Backstage](<https://devfeed.tech/sources/soundcloud-backstage-blog.md>)

Topics: [crdt](<https://devfeed.tech/topics/crdt.md>), [Temporal data](<https://devfeed.tech/topics/temporal-data.md>), [data-engineering](<https://devfeed.tech/topics/data-engineering.md>), [event-sourcing](<https://devfeed.tech/topics/event-sourcing.md>)

Tags: [acid](<https://devfeed.tech/tags/acid.md>), [announcements](<https://devfeed.tech/tags/announcements.md>), [cassandra](<https://devfeed.tech/tags/cassandra.md>), [complexity](<https://devfeed.tech/tags/complexity.md>), [consistency](<https://devfeed.tech/tags/consistency.md>), [crdt](<https://devfeed.tech/tags/crdt.md>), [data](<https://devfeed.tech/tags/data.md>), [data-structures](<https://devfeed.tech/tags/data-structures.md>), [data-systems](<https://devfeed.tech/tags/data-systems.md>), [data-types](<https://devfeed.tech/tags/data-types.md>), [distributed](<https://devfeed.tech/tags/distributed.md>), [distributed-systems](<https://devfeed.tech/tags/distributed-systems.md>), [event](<https://devfeed.tech/tags/event.md>), [events](<https://devfeed.tech/tags/events.md>), [failure](<https://devfeed.tech/tags/failure.md>), [garbage-collection](<https://devfeed.tech/tags/garbage-collection.md>), [go](<https://devfeed.tech/tags/go.md>), [graph](<https://devfeed.tech/tags/graph.md>), [open-source](<https://devfeed.tech/tags/open-source.md>), [social](<https://devfeed.tech/tags/social.md>), [stream](<https://devfeed.tech/tags/stream.md>), [system](<https://devfeed.tech/tags/system.md>), [time](<https://devfeed.tech/tags/time.md>)

## AI overview

Roshi is SoundCloud's distributed storage system for timestamped events, designed to build user streams with fan-in-on-read. Instead of copying each event to every follower's inbox, it appends the event once to its author's outbox and merges recent events from followed users when a stream is read. This reduces storage and makes streams reflect the current social graph, but makes reads harder: the system must fetch, sort, and merge events from potentially thousands of sources within request deadlines. Roshi uses a CRDT set resembling a last-write-wins element set with inline garbage collection, Redis ZSET for sorted state, and a stateless layer that coordinates self-repairing reads and writes. The article presents eventual consistency as a way to handle distributed failures while keeping the consistency model manageable, and notes that Roshi was being rolled out at publication time.

## Source excerpt

Let's talk about the stream. The SoundCloud stream represents stuff that's relevant to you primarily via your social graph, arranged in time...