TryQuiet / quiet

A private, p2p alternative to Slack and Discord built on Tor & IPFS
https://www.tryquiet.org
GNU General Public License v3.0
1.97k stars 85 forks source link

[DRAFT] Given a direct (non-Tor) connection, Quiet iOS syncs new messages in less than 1 second #2069

Open holmesworcester opened 12 months ago

holmesworcester commented 12 months ago

Our product goal is that important messages are visible in less than 1 second after the user opens the app. Based on user feedback, it is acceptable to add an always-on, non-Tor node to each community to achieve this goal. Our first research question:

Given a libp2p/OrbitDB connection to a fixed IP address without Tor, can Quiet iOS return to the foreground and sync and display messages to the user in less than 1 second?

This means:

  1. Backend is already running or we can start it in less than a few hundred ms
  2. We can sync and display the most recent 10-100 messages in the remaining time

If the answer is that we cannot do this in less than 1 second, what is the best we can do, and what are the bottlenecks?

leblowl commented 11 months ago

Makes sense to me!

holmesworcester commented 11 months ago

@vinkabuki @siepra - I'm especially interested in your feedback here. What do we already know about how long it takes for the backend to come alive when the user brings the app back to the foreground?

siepra commented 11 months ago

afaik backend usually starts in 1-2 seconds

holmesworcester commented 11 months ago

Does the size of the community affect this? Is 1-2 seconds the number for our test community?

holmesworcester commented 11 months ago

Another question: does "backend usually starts in 1-2 seconds" mean all of backend, i.e. libp2p and orbitdb? Can we get message data from orbitdb in 1-2 seconds? @siepra

This question matters for our sprint planing because:

holmesworcester commented 11 months ago

We dropped this when we switched to a relay approach, but today Lucas & Wiktor's comments relayed by Lucas convinced me that this experiment is still worth doing first, even if we are ultimately pursuing a relay approach, because it is an easier way to get an upper-bound on orbitdb syncing times, and will result more quickly in something we can test and play with.

holmesworcester commented 10 months ago

@leblowl can you paste your notes here when you get a chance?

leblowl commented 10 months ago

I've played around with this and it looks like when the app is suspended, the backend syncs messages in around a second, but it looks like the frontend doesn't display the messages for up to around 7 seconds sometimes. Sometimes it displays messages in a second, but sometimes it takes longer. So it looks like perhaps the frontend isn't always connecting to the backend quickly or something. I'm not sure.