With the release of the MemoryStoreHashMap data structure, Roblox removed all existing limits for individual data structures and replaced them with a single, global "per-partition" throttling limit. The exact limit fluctuates based on internal values and how the automatic partitioning process distributes your data, but generally allows for much higher usage before throttling, particularly for hash maps. This new limit enables flexible usage of memory stores across all data structures.
Partitions
The MemoryStores API stores data on partitions, which are just subdivisions of storage. Whenever you write an item to a memory store, that item is stored on exactly one partition. Partitions are fully managed by the MemoryStores API; you do not need to manage them yourself.
Partition Assignment
Partition storage is different according to the data structure an item is being stored on. For sorted maps and queues, each data structure is assigned a single partition.
For example, consider a carnival game with a sorted map called PlayerScores and a queue called PlayerLine of players waiting to play the game:
Unlike sorted maps and queues, hash maps are allotted multiple partitions, and data is automatically distributed across these partitions. If you were to add a hash map called Prizes, the partitions might look like this:
Note how the hash map exists on all partitions, and each partition has some subset of items.
Limits
Having a per-partition limit allows for higher throughput to all data structures. It also favors hash maps, because they're distributed across all partitions.
For example, consider a per-partition limit of 150,000 requests per minute (RPM):
- In the very best case, a sorted map and a queue are limited to 150,000 RPM, because each one resides on a single partition.
- Requests to hash maps are spread across the item keys, which are themselves spread across partitions, so hash maps can have a much higher effective limit before throttling, many times that of the other data structures.
For this reason, if you don't need sorting or "first in, first out" functionality, hash maps are usually the best choice for a memory store data structure. For more information, see Best Practices.