Skip to content

Preserve peer data on application restart

Since the tracker server is currently backed by ephemeral Ets tables, all peer data vanishes when the application restarts for any reason. There's a few ways we might avoid this:

  1. Keep peer data in the database
    I don't like this option because it necessarily persists connection data to disk, which might end up in backups, or remain on disk in case of bugs. All connection data should irrevocably disappear when the plug is pulled, which is most easily achieved by keeping it in RAM.

  2. Keep peer data in an in-memory DB like redis
    This would introduce a new and fairly complex component into the system, and would force a full rewrite of the tracker server code, if not heavy refactoring. I see no upsides.

  3. Dump peer data when the application shuts down and reload it on boot
    This would likely rely on some location in the file system being mounted as a tmpfs (though it should really be a purpose-specific ramfs, since they're guaranteed never to be swapped), but seems like the least undesirable option.

Ultimately it would be of great advantage to extract the tracker server into its own process. I expect most changes will occur in the browser-facing part of the application, so the ability to restart it independently of the tracker server may significantly reduce the need for peer data persistence.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information