| Message |
If the database server is on the same PC as the game server, it will probably be quite fast. Otherwise, network latency might get you eventually.
It isn't that dissimilar a problem to standard SMAUG, where the player's data is stored in player files, which are periodically saved, but cached in memory for normal gameplay.
I don't know how easy it is to change, but one approach would be to "write through" but cache reads.
So unless you have complex queries it could go like this:
- I need the player's max mana - check cache
- If not in cache, get from SQL read (and put in cache)
- From then on, it is in cache
- If I need to change the max mana, update the cache and also do a SQL update to update the database as well.
That way, the database is always up-to-date. Of course, this assumes you have a single server process, if you have multiple ones all looking at the database this won't work.
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | top |
|