ScratchDB: Project Update 1


So for a decent part of today I looked into designing the leaderboard system. I researched various different ways to rank the data, going anywhere from a combination of HashMaps and BSTs to simply keeping my current solution of an oddly ranked array/Object combination in JS. At the end, the easiest and likely best solution would be the Redis Sorted Set, since it provides, effectively, almost everything I need. This system provides the ability for me to easily get ranks based on user or based on score, and lets me get to the more important things such as indexing and processing, rather than implementing an entire database.

So, at this point it seems that the Rust-backed database will likely not come fully to fruition, but I still believe it may have a valuable purpose. I’m contemplating using still a Rust (🚀) system to run all operations relating to modifying or getting info from Redis, to have a simple API any system I write can use. So, odds are, I’ll continue to write a Rust (🚀) system, but instead of it acting as the data structure and the system that interfaces with it, it will simply interface with Redis and make sure everything is working properly. Some features of this updated system might include the following:

  • only updating Redis on/after a specific interval, to keep leaderboards from shifting constantly
  • actually run the ZINCRBY command since there doesn’t seem to be a way to directly set a number
  • provide a sort of cache so highly repetitive Redis operations aren’t re-done constantly
  • possibly interface with other Redis systems to also process user data (still have to design the rest of the systems, simply an idea)

At the end of the day, it would be more fun to write my own database system, but Redis offers almost exactly what I was looking for, so no hacky solution combining multiple different databases, or writing my own is needed. This simplifies a decent piece of my project, and also still lets me get a grasp on Rust as I wanted.

Sources (Used for search and class purposes, not relevant to the info above):

https://redis.io/docs/data-types/sorted-sets/:

This article, titled “Introduction to Redis sorted sets” is written by the Redis community explaining the features and usage of the sorted set feature in Redis. This source contains statistics on efficiency and usage for the given feature in Redis. The intended audience is meant to be those interested in using the given feature in Redis, so developers. The purpose of this article is to give an explanation of efficiency and usage of a given feature in the Redis feature set, in order so that people can use it properly.

Since this source comes effectively directly from the developers, it is of high quality and integrity. Also, since it provides exact usage details, as well as a list of possible actions, it has very high usefulness without me needing to go anywhere externally to learn how to use it. There’s really no reason not to use this source as it provides all the information needed, and it is also accurate. Anyone looking to use Redis to a capacity of creating a leaderboard or for other purposes outlined in the article may find it useful.

https://www.youtube.com/watch?v=MUKlxdBQZ7g

This video, titled “Redis Sorted Sets Explained” is created by the Redis community giving a real world example of the Sorted Set feature. This source contains various commands and examples of how to use the Sorted Set feature. The intended audience is people seeing if this is the right system for them, as it provides some basic examples and some usage details. The purpose of this video is to show a real-world use case of the Redis Sorted List feature, so people can see if its right for them and also see an example of how it is supposed to be used.

This source comes from the developers, so it also has a high amount of quality and integrity. It also simplifies the documents so that using this feature is easily outlined and defined for those interested. This source doesn’t exactly cover everything, but it covers enough to give a good overview of the given feature and shows a good example of a proper use case.