Entity damages cache cleanup principle(deDE)

One special thing of SplitXP is the entity damages cache cleanup principle. When the number of entities and their damage values in the cache grows over time, it is good to do cleanups so that all not needed entities get removed from cache to e.g. save memory. When more than 20 (changable via config) entities and their damages dealt by each player are in the cache, the cleanup thread gets started with low priority to save cpu time. When the cleanup threashold is set to 0 via config file, this cleanup feature gets disabled.

The entity damages cleanup thread takes a "snapshot" of the current entity uuid's and summarizes all entities that are in the snapshot but not valid/needed anymore in a table (e.g. when they have despawned or the world got unloaded). When this remove-entity-table contains one or more elements, it gets sent back to the plugins core and this finally removes the not needed entities from the main cache. This principle allows to be completely thread-safe because while the separate cleanup thread is running with low priority to lower cpu usage (which can take a little bit if many entities are there over all the worlds), the main cache can safely add and remove entries from the main cache without getting in conflict with the snapshot mappings of the cleanup thread.


Comments

Posts Quoted:
Reply
Clear All Quotes