Skip to content

Preloading & Caching #1

Description

@jomo

Right now all data is imported from MySQL at start and kept in memory. This works for small - medium size servers but you'll run into trouble on big servers since this approach doesn't scale.

Doing blocking SQL queries on every player move is obviously not a great idea either, so we need to predict the plot data we need and cache it.

plot caching

My approach is defining a radius of plots (e.g. 3) around players that are loaded from DB if not already present and a larger plot radius (say 6) that are kept in memory once loaded. Anything beyond that is removed from the cache. Even if people constantly move around in an area of 7x7 plots, we only need to query the data at the first time.

All method calls requiring plot data would be blocking until the data is available, which would be instant in most cases using this approach because the data has been preloaded into cache. We should also keep a list of currently running queries, so if data is not available but is already being queried, you can wait for the query to complete instead of starting a new one.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions