amethyst icon indicating copy to clipboard operation
amethyst copied to clipboard

Heavily requests

Open mattn opened this issue 1 year ago • 4 comments

I'm not make sure that this is really issue of Amethyst or my relay server but Amethyst often send the heavily requests to the relay server.

2023/10/01 02:34:02 nostr-relay: REQ filter {"kinds":[1,7,6,16,1984,9735,6969,4550,1311],"#a":["30315:2c7cc62a697ea3a7826521f3fd34f0cb273693cbe5e9310f35449f43622a5cdc:general"],"limit":1000}
2023/10/01 02:34:02 nostr-relay: REQ filter {"kinds":[1,7,6,16,1984,9735,6969,4550,1311],"#a":["30315:26bb2ebed6c552d670c804b0d655267b3c662b21e026d6e48ac93a6070530958:general"],"limit":1000}
2023/10/01 02:34:03 nostr-relay: REQ filter {"kinds":[1,7,6,16,1984,9735,6969,4550,1311],"#a":["30315:2c7cc62a697ea3a7826521f3fd34f0cb273693cbe5e9310f35449f43622a5cdc:general"],"limit":1000}
2023/10/01 02:34:05 nostr-relay: REQ filter {"kinds":[1,7,6,16,1984,9735,6969,4550,1311],"#a":["30315:2c7cc62a697ea3a7826521f3fd34f0cb273693cbe5e9310f35449f43622a5cdc:general"],"limit":1000}
2023/10/01 02:34:13 nostr-relay: REQ filter {"kinds":[1,7,6,16,1984,9735,6969,4550,1311],"#a":["30315:2c7cc62a697ea3a7826521f3fd34f0cb273693cbe5e9310f35449f43622a5cdc:general"],"limit":1000}
2023/10/01 02:34:14 nostr-relay: REQ filter {"kinds":[1,7,6,16,1984,9735,6969,4550,1311],"#a":["30315:2c7cc62a697ea3a7826521f3fd34f0cb273693cbe5e9310f35449f43622a5cdc:general"],"limit":1000}

This REQ is created at: https://github.com/vitorpamplona/amethyst/blob/e454ccc3264f5c8d52240f2f801e4343d2237e38/app/src/main/java/com/vitorpamplona/amethyst/service/NostrSingleEventDataSource.kt#L24-L41

Is this your expected? This request make the relay busy.

image

This is recent log on my relay server.

https://gist.github.com/mattn/8b9c9d7ad4c110594f0a7fe492efe433

mattn avatar Oct 01 '23 03:10 mattn

FYI, my relay server (relayer) drop limits over 100.

image

mattn avatar Oct 01 '23 03:10 mattn

This was the issue with Amethyst. Every scroll movement is a REQ requests. The reason why Vitor did this was to solve 10 req-limit at certain relays.

However that ended up to consume more data bandwidth usage.

Yonle avatar Jan 29 '24 16:01 Yonle

There is some confusion here. The answer to @mattn's issue is true: "The reason why Vitor did this was to solve 10 req-limit at certain relays". We group many app features into as few nostr filters/subscriptions as possible. So many of our filters are large and quite complex.

The "Every scroll movement is a REQ request issue" is a consequence of another decision to dynamically update the post (like count, report count, author's picture, any references inside the post, etc) with new information from the relay as the user scrolls. Clients have basically two choices: pre-loading everything including the things the user might not care or see at this point and downloading things as the user navigates the UI. We are required to download as the user navigates because the app is way too large to pre-load everything the app needs at once.

For instance, each feed (There are 15 feeds in the app) shows 1000 events each and there is no need to pre-load likes, reports, boosts, replies, user metadata, quotes, etc; for all 15000 events because, on a regular session, the user will not see most of it. So, dynamically downloading them actually saves bandwidth.

vitorpamplona avatar Jan 29 '24 16:01 vitorpamplona

Recently, REQ of Amethyst seems to be improved to separate requests like below. Amethyst send following REQ for displaying current timeline.

https://gist.github.com/mattn/720fbb0fed5979036ce08de502a2c405

mattn avatar Jan 30 '24 02:01 mattn