jb55 on Nostr: Traditionally when using databases you have to serialize data in and out. With ...
Traditionally when using databases you have to serialize data in and out. With nostrdb your in-memory data structures are the same as the disk representation.
It uses virtual memory to map the entire database (up to 32gb). When accessing data the operating system only reads parts of this file into memory when accessing data.
The end result is you get the speed of an in-memory data structure but without having to allocate 32gb of memory to read it all (bad and impossible)
Since nostrdb uses lmdb, it arranges the data into an efficient search tree so that the most common accessed data is always hot in the cache. The end result is that the code is much simpler and faster.
The next step is to replace the in memory note cache with nostrdb as well.
This will put damus apps in a league of their own, thanks for your patience as I hook all this up 🙏
It uses virtual memory to map the entire database (up to 32gb). When accessing data the operating system only reads parts of this file into memory when accessing data.
The end result is you get the speed of an in-memory data structure but without having to allocate 32gb of memory to read it all (bad and impossible)
Since nostrdb uses lmdb, it arranges the data into an efficient search tree so that the most common accessed data is always hot in the cache. The end result is that the code is much simpler and faster.
The next step is to replace the in memory note cache with nostrdb as well.
This will put damus apps in a league of their own, thanks for your patience as I hook all this up 🙏
quoting note1jns…ufqvProfiles in nostrdb (#1520)
This adds profiles to nostrdb and replaces our in-memory and ProfileDatabase cache with it
- Remove in-memory Profiles caches, nostrdb is as fast as an in-memory cache
- Remove ProfileDatabase and just use nostrdb directly
## TODO
- [ ] cache lnurl properly
- [ ] add database versions for migrations
nostrdb-profiles, 5 commits
https://github.com/damus-io/damus/pull/1520