code-of-kai

code-of-kai

Game Programming & Databases: Lessons from SpaceTimeDB

Hey Elixeers!

I recently came across SpaceTimeDB, a fascinating distributed database being developed by Clockwork Labs for their upcoming MMORPG, BitCraft. What caught my eye is how it tackles familiar data, scale, and concurrency challenges in a way that could offer valuable lessons for the broader software world, even outside of gaming.

SpaceTimeDB blurs the lines between database and server. It allows developers to upload application logic directly into the database via “modules,” effectively eliminating the need for separate web or game servers. Clients connect directly to the database, executing logic within it. This approach promises to streamline development and potentially simplify deployment, as the entire application could be packaged as a single binary.

Intriguingly, SpaceTimeDB prioritizes speed and low latency over batch processing or OLAP workloads, making it well-suited for real-time applications like games, chat, and collaboration tools. This emphasis on real-time performance is achieved by holding all application state in memory and using a write-ahead-log (WAL) for persistence and recovery.

Here’s where it gets interesting for the Elixir community: The creator of SpaceTimeDB draws parallels between his project and Erlang in terms of its approach to concurrency and distributed systems.

This skips directly to the Erlang comparison:

Now, I’m curious to hear your thoughts:

  • Could SpaceTimeDB’s approach to integrating application logic into the database influence how we think about database interactions in Elixir?
  • What are the potential benefits and drawbacks of this tight coupling between application and database?
  • How might Elixir’s strengths in concurrency and fault tolerance complement or contrast with the design principles of SpaceTimeDB?
  • Do you see any opportunities to apply SpaceTimeDB’s focus on real-time performance in Elixir-based applications, within and outside of the gaming domain?

Showing Posts 1 to 5

oliveiragahenrique

oliveiragahenrique

What are the potential benefits and drawbacks of this tight coupling between application and database?

That’s a topic I’m really interested in! Since discovering Mnesia, I’ve been contemplating building a fully-fledged, modern database on the BEAM that could run directly alongside an application. It’s definitely a project I plan to tackle one day.

In my view, the biggest hurdle lies in adoption and operational complexity. The current infrastructure ecosystem is heavily geared toward stateless applications for good reason—stateful systems are significantly more challenging to manage and operate. So, as soon as you mention a stateful app, it often raises eyebrows.

That said, I think BEAM’s concurrency model has shown itself capable of handling live updates while safely managing state (Mnesia is a great example of this).

The potential benefits are compelling, especially in terms of performance—keeping data within the same memory space enables faster I/O operations. Plus, simplifying development by eliminating translation layers between database and application formats could improve both speed and ease of development.

I’ll dig into this SpaceTimeDB more in-depth when I have the time. Thanks for sharing! (:

code-of-kai

code-of-kai OP

No worries. I haven’t had time to look into Mnesia, could you please give me your assessment of it, and its current role in the Elixir ecosystem. Is the technology dated in anyway or does it hold up well and is being underused currently? Your thoughts would be most welcome.

JEG2

JEG2

Author of Designing Elixir Systems with OTP

I’ve seriously considered building a SQLite clone in Elixir. You can see me playing around with the idea on my blog:

oliveiragahenrique

oliveiragahenrique

I’m definitely not an Mnesia expert, as I haven’t had the chance to use it in production yet, but I can certainly share a bit about it.

Mnesia is a distributed database that you can run alongside your BEAM application. Built in the early days of Erlang, it’s a remarkable piece of technology that can handle distributed storage at scale and is definitely in use in some serious production cases. A quick YouTube search highlights some real-world applications:

To start learning more, a great resource is the Erlang documentation: Erlang -- Mnesia Database Questions

Mnesia does have a few pain points that show its age. A major one for me is the persistent disk size limitation. If you can’t fit all your data into memory, it becomes quite challenging to use Mnesia effectively.

bottlenecked

bottlenecked

I’m only saying this half in jest and I haven’t seen the video but… AS/400 with COBOL and DB/2 running on the same machine sounds a lot like this programming model (minus the distributed aspects) :sweat_smile:

— All posts loaded —

Where Next? Top

Trending in Discussions Top

AstonJ
As the title says, please share what you’ve been up to with Elixir. Whether that’s been learning it, looking into it, making stuff with i...
2977 92995 915
New
AstonJ
The obligatory hello world thread! Who are you and where are you from? :stuck_out_tongue:
4616 55835 594
New
caslu
I want to open this thread for you all to discuss and help those who really like Ash but are still hesitant to use it in a real project. ...
New
arcanemachine
I was working on an Ecto migration and I needed a timestamp. So, for the nth time, I looked up the different data types for timestamps, a...
New
alexslade
Fly’s CEO posted this recently - Turn And Face The Strange · The Fly Blog It says that Fly is going all-in on sprites, which is a worry ...
New
Herve37
We’re evaluating API mocking tools for OpenAPI-based projects and would love to hear what other teams are using. We’re particularly inte...
New
matt-savvy
Is there a word for the ~> symbol used in Version strings? Do you also just call it a Squiggle Arrow™ ?!
New

Other Trending Topics Top

garrison
Hobbes is a low-level distributed database for the Elixir programming language. Hobbes provides a simple, safe, and scalable storage lay...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
mcass19
ExRatatui lets you cook up rich terminal UIs in Elixir, powered by Rust’s ratatui via Rustler NIFs. Build interactive terminal applicatio...
New
Damirados
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve. They are GUI (Emerge) and State management (S...
New
netoum
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
wintermeyer
There are three potential reasons for members of this forum to have a look at https://vutuv.de You are tired or annoyed of LinkedIn. Yo...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews