favll/pogom

PoC: use of Redis as backend, drop relational database

Opened this issue · 4 comments

maxux commented

Description

I forked the repo (https://github.com/maxux/pogom) and replaced (easier) the sql backend with a proof-of-concept with Redis backend.

I actually run this code and I test it, if someone else is interrested by this, it's a way to show it.

Why Redis ?

Redis is a in-memory data structure store. Using Redis dramatically reduce ressource usage and make the pogom query/response lot faster than the SQL version. To make it works, just install redis-server locally and run the version in my fork with your configuration.

I use the expiration key feature of redis to keep only current pokemon visible and save the stats in another hash.

My actual tests runs on 2x 1km radius and I hit about ~2% cpu usage with 30 users simultaneously connected to the website.

Everything is not yet fully ported, but if some guys can test it, it would be nice.

What is the memory footprint like? I know a lot of people like to use Raspberry Pis, so memory is a concern.

maxux commented

Currently, with 6500 pokemons found (in stats) during the night, the database use 1.46 MB of memory. After couple of days, the memory size can explode on small devices, definitely.

Some rethought need to be done about how to save the stats to avoid to explode the database size. But for a PoC right now, it's pretty acceptable I think.

How to store those when the server goes down? I have had to shut mine down to let the soft bans clear.

maxux commented

You can dump the database with SAVE command