Thinking about this post by @fiatjaf…

Thinking about this post by fiatjaf about the cost of #NOSTR relays.

Relays are web sockets, a server and a client. Web sockets over #NOSTR should be cheap, because notes are broadcast, and when broadcasting notes, sockets are very efficient.

Let's say jack posts a note to a relay, that relay can BROADCAST that identical note to all it's clients who subscribe to Jack as opposed to sending differing data to all it's clients.

To estimate the potential savings, let's consider a scenario where a web socket server sends 1 KB of data to 100 clients.

Same data to all clients:

Memory: 1 KB (a single copy of the data)
CPU: 1-10% CPU usage (depending on the broadcasting implementation)
Network: 1 KB (a single packet sent to all clients)
Different data to each client:

Memory: 100 KB (100 separate copies of the data)
CPU: 10-100% CPU usage (depending on the packetization and sending implementation)
Network: 100 KB (100 separate packets sent to each client)
In this example, sending the same data to all clients can result in:

99% memory savings (1 KB vs. 100 KB)
90-99% CPU savings (1-10% vs. 10-100% CPU usage)
99% network savings (1 KB vs. 100 KB)

Keep in mind that these estimates are rough, but it makes the point that #NOSTR nodes should be very efficient, and thus relatively cheap in a competitive environment.

nostr:note1dqk63v3nrvtkhjye29t7zzwwrrlxqh6tvld4x00jvlm2ye55zmkqmumahc