Re:Rearchitecting: Redis to SQLite
by michaelbuckbee on Wednesday September 25, 2024 @08:58AM
(#41646952)
In Redis, the data is a sorted-set that we forced into being lexicographically ordered by setting all the scores to 0. We went through a lot of iterations of it and to be clear it's not _slow_ it's just not as fast as essentially `fopen`
1 - Redis sorted sets - https://redis.io/docs/latest/develop/data-types/sorted-sets/
I do agree it is somewhat fishy of the large performance difference not being explained by comparatively fundamentally poor data access patterns.
However, Redis runs as an out of process server with marshaling and unmarshaling of data across sockets. SQLite is in process and with a prepared query is basically one library call to a purpose built data access VM. So Iām not sure why it would be hard to believe this cache and TLB friendly setup can beat Redis.
Thank you. First explanation what might be the root cause :)
Re:Rearchitecting: Redis to SQLite
by cynicalsecurity on Wednesday September 25, 2024 @07:20PM
(#41652905)
Just look at their use case. The have to store a large amount of logs of web-sites visitors or bots. Of course Redis is a very bad choice, because most servers don't have that much amount of memory. It's really useless to store logs in the RAM.
But always happy to see a discovery of a better solution. I agree removing the network is a win.