Alex Gleason's avatar
Alex Gleason
alex@gleasonator.com
npub1q3sl...d26p
I create software that empowers people online. I'm vegan btw.
Alex Gleason's avatar
Alex Gleason 1 year ago
I bet Zelda Chuanshou Shiguang Zhi Di blew their fucking minds when they were finally allowed to play it. image
Alex Gleason's avatar
Alex Gleason 1 year ago
So tired of hearing about the price of eggs. I'm VEGAN.
Alex Gleason's avatar
Alex Gleason 1 year ago
Thousands of hours have been wasted on bloated JSON logging frameworks in JavaScript. Yet this is all that's needed. You just define the type of your logs, and then wrap `console.log` with the type. image
Alex Gleason's avatar
Alex Gleason 1 year ago
I am excited to start developing features again, to make the community aspects of Ditto shine. This issue has been holding me back. Some big changes are coming soon! View quoted note →
Alex Gleason's avatar
Alex Gleason 1 year ago
I want to tell you why #Ditto was slow and how we fixed it. There were 2 issues: Postgres performance and nip05 lookups. Postgres performance was caused by profile lookups, eg: { kinds: [0], authors: [a, b, c, d, ...] } The issue was ORDER BY clauses on those queries. This caused Postgres to do a "sequence scan" instead of using the correct index: "nostr_events_replaceable_idx" UNIQUE, btree (kind, pubkey) WHERE kind >= 10000 AND kind < 20000 OR (kind = ANY (ARRAY[0, 3])) I actually fixed this already last year, and then reverted it in the last few months due to a bad decision. 🤦 See: and https://habla.news/u/alex@gleasonator.dev/nostr-filters-limit Logging query errors exposed this. This is why logging matters, people! Now I am switching Ditto to use JSON logging and incorporating Loki + Promtail so can easily track these problems in the future. As for nip05 lookups - Ditto actually does nip05 verification in realtime as feeds are being rendered. This is obviously very bad. It does have an in-memory LRU cache, but restarting Ditto resets it. As a result, feeds can take up to 3 seconds to load (that's the timeout I set for fetching nip05). And if fetching fails, usernames are not displayed correctly. To solve this (with a bandaid solution), I configured squid (HTTP proxy) to aggressively cache nip05 responses with this: refresh_pattern /\.well-known/nostr\.json 3600 0% 259200 I also had to configure Ditto and squid with self-signed SSL certs so it can mitm and actually cache: http_proxy="http://squid.lan:3128" https_proxy="http://squid.lan:3128" DENO_CERT="/etc/ssl/certs/squid.crt" My TODO is to cache nip05 verifications in Postgres, to solve the root problem for self-hosters and increase performance even more. tl;dr Ditto is fast now.
Alex Gleason's avatar
Alex Gleason 1 year ago
Oh my god I finally got squid caching to work and it's so fast
Alex Gleason's avatar
Alex Gleason 1 year ago
I have a squid kid, and a squid parent. Sometimes the kid kills the parent and sometimes the parent kills the kid. And I have a demon opening my logs. This sounds nonsensical but it's actually computers.
Alex Gleason's avatar
Alex Gleason 1 year ago
Btw the Mostr Bridge has been updated to block porn content on the relay, to the extent that it's possible.
Alex Gleason's avatar
Alex Gleason 1 year ago
If you receive nutzaps, how can you get it into a regular Bitcoin wallet? Interested in both theoretical and practical, but mostly practical.
Alex Gleason's avatar
Alex Gleason 1 year ago
On Nostr everything is backwards, so as a client you can actually get DoSed by a server. Therefore before you can implement Outbox you need to implement rate-limiting of relays. image
Alex Gleason's avatar
Alex Gleason 1 year ago
Spent 8 hours debugging performance issue, it was because I blocked the port on my own firewall.
Alex Gleason's avatar
Alex Gleason 1 year ago
Whenever I am looking at my server logs, the performance is fine, perfect, impeccable. Whenever I turn my back it starts breaking in ways I can't observe later.
Alex Gleason's avatar
Alex Gleason 1 year ago
The American election is dialectics enshrined in law. image
Alex Gleason's avatar
Alex Gleason 1 year ago
When I was a kid I listened to Metallica, and I thought I was very cultured because I listened to music from 20 years ago. But to my surprise, kids today aren't listening to 50 Cent, they're still listening to Metallica, now 40 years old.