Replying to Avatar lnproxy

@nostr:nprofile1qqsrhuxx8l9ex335q7he0f09aej04zpazpl0ne2cgukyawd24mayt8gpp4mhxue69uhkummn9ekx7mqpr4mhxue69uhkummnw3ez6ur4vgh8wetvd3hhyer9wghxuet5qyt8wumn8ghj7un9d3shjtnwdaehgu3wvfskueqpz9mhxue69uhkummnw3ezumr49e4k2grpawm 's [relayer](https://github.com/fiatjaf/relayer) is a go library for making custom relays. I've been investigating its capabilities in the past few weeks and I like how customizable it is. I'm not a nostr expert, but I think that the ability to make relays tuned to specific purposes is important for nostr to succeed (e.g. I want a relay to allow people to run competitive lnproxy relays without needing to expose their clearnet IP addresses).

In testing, I've found the performance of the different storage backends available for relayer lacking, but I've been working on a speedier solution based on boltdb! With that in mind, last week I asked nostr:

nostr:nevent1qqswrzwhgr23k4v8fd3wtu9dtjyq873nmkwlyjzf0vhxqt6gy6kssncprpmhxue69uhkummnw3ezuendwsh8w6t69e3xj730qy2hwumn8ghj7un9d3shjtnyv9kh2uewd9hj7qg5waehxw309askummw9e3k7mtsw46x2u30qy2hwumn8ghj7un9d3shjtnwdaehgu3wvfnj77dykj8

Unfortunately none of the suggestions were exactly what I needed but I was able to set up some benchmarks in go and the results are looking great:

```

BenchmarkSQLite3QueryEvents/IDs-8 30 42339015 ns/op

BenchmarkSQLite3QueryEvents/Authors-8 36 37080938 ns/op

BenchmarkSQLite3QueryEvents/Tags-8 31 41998150 ns/op

BenchmarkSQLite3QueryEvents/Kinds-8 18 69550451 ns/op

BenchmarkSQLite3QueryEvents/Authors,Kinds-8 48 41373654 ns/op

BenchmarkSQLite3QueryEvents/Since-8 9 129129112 ns/op

BenchmarkSQLite3QueryEvents/Authors,Since-8 40 47585709 ns/op

BenchmarkSQLite3QueryEvents/Authors,Kinds,Since-8 18 64724085 ns/op

BenchmarkSQLite3QueryEvents/Tags,Kinds-8 36 49993809 ns/op

BenchmarkSQLite3QueryEvents/Tags,Authors-8 34 31319155 ns/op

BenchmarkBoltQueryEvents/IDs-8 1591 756493 ns/op

BenchmarkBoltQueryEvents/Authors-8 255 4652186 ns/op

BenchmarkBoltQueryEvents/Tags-8 264 4566247 ns/op

BenchmarkBoltQueryEvents/Kinds-8 250 4772767 ns/op

BenchmarkBoltQueryEvents/Authors,Kinds-8 170 6893723 ns/op

BenchmarkBoltQueryEvents/Since-8 277 4473123 ns/op

BenchmarkBoltQueryEvents/Authors,Since-8 243 4738151 ns/op

BenchmarkBoltQueryEvents/Authors,Kinds,Since-8 163 7289618 ns/op

BenchmarkBoltQueryEvents/Tags,Kinds-8 190 6502720 ns/op

BenchmarkBoltQueryEvents/Tags,Authors-8 705 1755724 ns/op

```

I'll try to release the code sometime this weekend, but I wanted to share that my boltdb solution is much faster than sqlite for simple queries and even beats sql on fairly complex queries.

Where is the code? I got dissatisfied with relayer and forked it to https://github.com/fiatjaf/khatru, then I wrote an LMDB and a Badger backend, but I have no idea if I did a good job.

Reply to this note

Please Login to reply.

Discussion

Very cool, going to have too look into this today.

The code is a mess right now, decided to improve the tag indexing last night and haven't gotten it back to a working state yet, but here are the benchmarks: https://gist.github.com/lnproxy/7ac00c17c9b414962d47483461f11f5d

This is awesome

do you intend to maintain relayer?