Root / Assembly / ARCCore / AREnumType / DocumentationOnlyEnum / ARConcepts / _Member / MemoryConsumption



DescriptionA naïve implementation of key-value storages like AgoRapide may lead to excessive memory (RAM) consumption.

AgoRapide has been designed in order to be easy to start with, but still with inbuilt flexibility to reduce memory consumption as your database grows and your application matures.

CoreDB will mostly store data on disk and have little need for RAM. Sidenote: Although the PropertyStream-format is somewhat verbose it is well suited for on-disk compression.

ArmDB / Client using PRich is more sensitive to RAM but you have a great flexibility in how much data they actually have to subscribe to.

This is because the default implementations of IP in ARCCore- are chosen dynamically according to need.
See for instance use of the PValue<T> class, which will be dynamically replaced with a PRich instance if a need for storing meta-data like Cid, Created or similar arises.

Therefore, if a Subscription does include any of this meta-data, then only a PValue<T> instance will be created at the subscriber side, meaning single nodes in the system can have reduced memory consumption just by judiciously chosing what data is needed.

Use the PExact<EnumType> class as basis for your 'entity' classes when you know exact what you want to store in them and when you do not need to store any meta-data like Cid and Created.

See also BoilerplateCodePropertiesAndStorage which offers automatically generated boilerplate code for turning your class into a memory-efficient traditional C# class. This can be done independently by different nodes in the system, that is, you only have to implement properties that you actually need in the given context (remember that even null values for a property still occupies 8 byte of memory, so it is best to leave it out completely).
Note that by default the property storage mechanism normally used in AgoRapide (like in PRich) will not waste memory on non-existing properties at all because of the dictionary mechanism used (albeit with a significant overhead).

3 items

Generated 2020-10-13 11:11:01.147 UTC