<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Sam Hazzard</title>
    <description>The latest articles on DEV Community by Sam Hazzard (@samhaz).</description>
    <link>https://dev.to/samhaz</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1687365%2F338364a5-b898-44f5-bd25-80824b53e1b9.jpg</url>
      <title>DEV Community: Sam Hazzard</title>
      <link>https://dev.to/samhaz</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/samhaz"/>
    <language>en</language>
    <item>
      <title>How a midnight phone call turned into a game storage API</title>
      <dc:creator>Sam Hazzard</dc:creator>
      <pubDate>Fri, 04 Dec 2026 15:47:43 +0000</pubDate>
      <link>https://dev.to/samhaz/where-do-ephemeral-game-servers-keep-their-memories-90</link>
      <guid>https://dev.to/samhaz/where-do-ephemeral-game-servers-keep-their-memories-90</guid>
      <description>&lt;p&gt;It started with a phone call in the middle of the night from my friend Ricky. He'd launched his game on Edgegap, but wondered if there might be a business opportunity for me in helping him sort out his persistent storage.&lt;/p&gt;

&lt;p&gt;I thought about it and decided, actually, there might be a market here, especially for solo developers like Ricky with little capital and no revenue yet. If he was looking for it, he wouldn't be the only one in the world!&lt;/p&gt;

&lt;h2&gt;
  
  
  What he needed
&lt;/h2&gt;

&lt;p&gt;His game is a Unity server running in Docker on Edgegap. When a match ends, Edgegap destroys the container, so anything saved locally is gone. In his words: just one file per save with a unique name. The server loads the current save and then periodically updates it. He also wanted to keep the previous few files, say the last three, in case you need to revert. A mini Git.&lt;/p&gt;

&lt;h2&gt;
  
  
  Building it
&lt;/h2&gt;

&lt;p&gt;At 14:39 he told me what he needed. At 16:15 I sent him a URL and a key. I'd set up a new VPS and built a cloud service on it: SSH secured, firewalled, and backing up to a separate VPS on another box elsewhere. At 16:42 I snuck in his mini Git too.&lt;/p&gt;

&lt;p&gt;His reply: "Bloody hell that was quick!"&lt;/p&gt;

&lt;p&gt;That was the first version.&lt;br&gt;
Since then it's evolved, with a proper sign-up, an admin portal, version history and nightly off-site backups to a second data centre.&lt;/p&gt;

&lt;h2&gt;
  
  
  The 256 MB surprise
&lt;/h2&gt;

&lt;p&gt;Then he mentioned his save file was about 256 MB!!&lt;br&gt;
A thousand times bigger than my 256 KB limit. Even Unity's cloud save caps a player's data at 5 MB, so this is not normal. It's a big game, a whole universe of data and all the player data too, and it was saving every two minutes.&lt;/p&gt;

&lt;p&gt;So here was my plan:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;On opening the game, GET the full save file and any diff file that might be in Dorage. If there is a diff, the game applies it to the full save and carries on.&lt;/li&gt;
&lt;li&gt;During gameplay (every couple of minutes, or when the player saves), the server works out a cumulative diff against the last full save from its local copy, compresses it, and PUTs it to a single diff slot on Dorage, overwriting it.&lt;/li&gt;
&lt;li&gt;On a clean close, PUT a new compressed full save, then delete any diffs.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;That means a crash does nothing special, because the next open is just step 1. You lose at most one diff interval, the files stay small except at the start and end of a game, and it's quick.&lt;/p&gt;

&lt;p&gt;A week later Ricky had reduced his save games to a couple of megabytes or much less. Starting a new session on Edgegap successfully loaded the previous save.&lt;/p&gt;

&lt;h2&gt;
  
  
  Was it hard?
&lt;/h2&gt;

&lt;p&gt;To be honest, the whole thing was fairly straightforward. The only real hiccup was a 401, and that turned out to be the wrong key.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why Hetzner and not AWS?
&lt;/h2&gt;

&lt;p&gt;I do know AWS, and my very first app was hosted there, but I realised it was unfeasibly overblown for what I wanted. That was the first time I took an interest in self-hosting.&lt;/p&gt;

&lt;p&gt;I already had a couple of Hetzner servers for other things, so their infrastructure is familiar. I don't expect to be storing petabytes of data initially, so starting on the lower tiers is the right call. The beauty of Hetzner is that it's very easily scalable when the orders DO start ramping up. And if Dorage takes off and needs that kind of management, I can always migrate.&lt;/p&gt;

&lt;h2&gt;
  
  
  One piece of advice
&lt;/h2&gt;

&lt;p&gt;Honestly, it's so easy to implement there wasn't that much to it. BUT, one piece of advice: make sure you've finished saving before your Docker instance gets closed. It will save all the WHY ISN'T IT SAVING headaches.&lt;/p&gt;




&lt;p&gt;*I've since turned this into Dorage, a storage API for game servers on hosts like Edgegap. If you're weighing it up against S3 or PlayFab, I wrote an honest comparison here: &lt;a href="https://dorage.co.uk/blog/dorage-vs-s3-vs-playfab" rel="noopener noreferrer"&gt;https://dorage.co.uk/blog/dorage-vs-s3-vs-playfab&lt;/a&gt;&lt;/p&gt;

</description>
      <category>gamedev</category>
      <category>showdev</category>
      <category>backend</category>
      <category>unity3d</category>
    </item>
  </channel>
</rss>
