Loading...

Top
PFQ Banner

This is PokéFarm Q, a free online Pokémon collectables game.

Already a user? New to PFQ?

Single post in Investigating the benefit of server-side caching

Forum Index > Core > Announcements > News Archive > Investigating the benefit of server-side caching >

Niet [Adam]'s AvatarNiet [Adam]
Niet [Adam]'s Avatar
Having let things run for a couple of days, including disabling some server-side software that we didn't need, I do believe that overall things are running more smoothly. While it's far from what I'd call "good", it's definitely "better". It would seem that Memcache was actually causing more problems than it solved. With a single Source of Truth, there are no desync errors (although deadlock errors can occur, though that only tends to happen if you have numerous tabs open, or are playing on two devices simultaneously). The counterpoint is that CPU usage is up, because instead of just fetching stuff from RAM, it has to actually go query the database every time. Not a big deal on its own, but worth keeping in mind. With that all said, I think I will be stripping out Memcache-related code. This will allow me to simply certain processes that are currently being used a lot: Before the test: 1. Code asks for a thing 2. Cache is checked for the thing 3. If not found, database is queried for the thing During the test: 1. Code asks for a thing 2. Cache is called but is explicitly bypassed with rejection 3. Database is queried for the thing After the stripping: 1. Code asks for a thing 2. Database is queried for the thing In some cases I may even be able to simplify this further to just "1. Database is queried for the thing", cutting down on code paths being taken as much as possible. This is not going to fix everything, but it should at least work with the system we have, and be reasonably achievable. I think. I'm really hoping that the `Factory/Cacheable` traits I made a decade ago can actually be refactored to accomplish this... And after that I'll be doing a global search for `Cache::` to find references to Memcached being used, and either rework them or continue using the server cache for limited and specific things (eg. static unchanging data, or results of calculations like the Type Race scoreboard that warrant some level of "don't calculate this every single time someone loads the page"). This is going to be a big project, but hopefully when I get progress made, you'll see no changes to gameplay but some improvement to latency.
Clip from Pokémon anime, re-lined by me
-- OMNOMNOM!
Featured story: Injustice Feedback welcome!
© PokéFarm 2009-2024 (Full details)Contact | Rules | Privacy | Reviews 4.6★Get shortlink for this page