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 94592 917
New
cblavier
Hey there, It’s been more than a year since we started using LiveView as our main UI library and building a whole library of UI componen...
New
mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
heathen
Quite interesting article Google brought me. Didn’t find any mentions about it here. What do you think in general? Would you use togethe...
New
maennchen
:warning: Security advisory: Decimal DoS vulnerability A vulnerability has been published for decimal where very large exponents can cau...
New
marciol
It would be helpful to have a list of companies worldwide that hire engineers without prior experience in Elixir. Often, it can be quite ...
New
Null-logic-0
What IDE or editor are you using for Elixir development? Personally, I use Zed, and I really like it, but sometimes I wish there were a ...
New

Other Trending Topics Top

marciok
Hi there! We created Gust: A task orchestrator inspired by Airflow. For those who have never heard about Aiflow, it’s a Python-based wor...
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
Dmk
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
New
netoum
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
webofbits
With AI doing more of the implementation work, I’ve been wondering how much coding I should deliberately keep doing myself. My main conc...
#ai
New
webofbits
Aludel - LLM Evaluation Workbench Aludel is an embeddable Phoenix LiveView dashboard for evaluating and comparing LLM prompts across mult...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews