Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Suggestion] Use webhooks to bypass rate limits #12

Closed
NoNameLmao opened this issue May 31, 2022 · 12 comments
Closed

[Suggestion] Use webhooks to bypass rate limits #12

NoNameLmao opened this issue May 31, 2022 · 12 comments
Labels
enhancement New feature or request

Comments

@NoNameLmao
Copy link

Instead of one bot sending messages, it could create webhooks which then would upload the files at speeds faster than one bot.

@ledlamp
Copy link

ledlamp commented Jun 17, 2022

that would only double the rate in one channel as all webhooks in a channel are under the same rate limit.
separate channels need to be used to circumvent the rate limit completely.
a guild (max 500 channels) could be used as a data store instead of just one channel.

@forscht
Copy link
Owner

forscht commented Jul 26, 2022

@NoNameLmao, @asdfisdffdg I already tried with using multiple channels but I couldn't see any major performance improvements. Still in upcoming release I will try to add multiple channels as option.

@forscht forscht closed this as completed Jul 26, 2022
@forscht forscht reopened this Jul 26, 2022
@forscht forscht added the enhancement New feature or request label Jul 26, 2022
@lunyaUwU
Copy link

lunyaUwU commented Aug 5, 2022

would migration be possible?

@UnlimitedBytes
Copy link

UnlimitedBytes commented Sep 2, 2022

@NoNameLmao, @asdfisdffdg I already tried with using multiple channels but I couldn't see any major performance improvements. Still in upcoming release I will try to add multiple channels as option.

You need to use webhooks in order to get more speed.
I tested it on my setup with one channel and can upload ~25 Mbit/s (a chunk in 2s on average sometimes delayed bc ratelimit)
I tested it with 10 channels with the bot and still can upload ~25 Mbit/s
I tested it with 20 channels over webhooks and can put up ~600 Mbit/s (the max. amount of webhooks you can create in a short span of time, without getting blocked for a very long time from creating webhooks)

Edit: Also if you use mutliple servers you can via the bot create 20 channels and webhooks per server without getting blocked I used this to fill up 5 server for a total of 100 channels. Now I can put up 2 Gbit/s ( which is my network limit :) )

@forscht
Copy link
Owner

forscht commented Sep 3, 2022

@UnlimitedBytes , Can you create PR with your code?

@UnlimitedBytes
Copy link

@UnlimitedBytes , Can you create PR with your code?
@forscht

Sadly I wrote a completely different implementation for myself which uses lots of libraries and multipart/form-data instead of direct binary data. So it's not possible to PR these changes as they're running on a completely different architecture and git repository.

I could however port it to DDrive will take some time tho I will prob. release the PR on the weekend as that's when I have time :)

@metenn
Copy link

metenn commented Sep 22, 2022

@NoNameLmao, @asdfisdffdg I already tried with using multiple channels but I couldn't see any major performance improvements. Still in upcoming release I will try to add multiple channels as option.

You need to use webhooks in order to get more speed. I tested it on my setup with one channel and can upload ~25 Mbit/s (a chunk in 2s on average sometimes delayed bc ratelimit) I tested it with 10 channels with the bot and still can upload ~25 Mbit/s I tested it with 20 channels over webhooks and can put up ~600 Mbit/s (the max. amount of webhooks you can create in a short span of time, without getting blocked for a very long time from creating webhooks)

Edit: Also if you use mutliple servers you can via the bot create 20 channels and webhooks per server without getting blocked I used this to fill up 5 server for a total of 100 channels. Now I can put up 2 Gbit/s ( which is my network limit :) )

How exactly does this work?
Do you send multiple files in one webhook request (using multipart/form-data), multiple requests in parallel at the same time or multiple requests parallel to different channels/servers? I'm curious because while I got a speedup it was never as big as you mention in your post.

@UnlimitedBytes
Copy link

@NoNameLmao, @asdfisdffdg I already tried with using multiple channels but I couldn't see any major performance improvements. Still in upcoming release I will try to add multiple channels as option.

You need to use webhooks in order to get more speed. I tested it on my setup with one channel and can upload ~25 Mbit/s (a chunk in 2s on average sometimes delayed bc ratelimit) I tested it with 10 channels with the bot and still can upload ~25 Mbit/s I tested it with 20 channels over webhooks and can put up ~600 Mbit/s (the max. amount of webhooks you can create in a short span of time, without getting blocked for a very long time from creating webhooks)
Edit: Also if you use mutliple servers you can via the bot create 20 channels and webhooks per server without getting blocked I used this to fill up 5 server for a total of 100 channels. Now I can put up 2 Gbit/s ( which is my network limit :) )

How exactly does this work? Do you send multiple files in one webhook request (using multipart/form-data), multiple requests in parallel at the same time or multiple requests parallel to different channels/servers? I'm curious because while I got a speedup it was never as big as you mention in your post.
@mattmeten

You send multiple parts at the same time in parallel. So for example you create 2 channels and add 20 webhooks per channel so you get 40 webhook urls in total. You then take the let's say 1 GB big file and split it into 40 chunks that are 8 MB big. You send all this 40 chunks at the same time, each to a different webhook. You then when a webhook finished it's 8 MB chunk stuff a new 8 MB chunk into this webhook. You constantly keep up the 40 connections in parallel until the file is finished and no more data is there to be uploaded. After that you have a ton of chunks uploaded with 40 chunks per webhook timing instead of 1 chunk per webhook timing. This process can be upscaled to as much as you want and as much as your processor / ram and network can handle.

@ledlamp
Copy link

ledlamp commented Sep 22, 2022

@NoNameLmao, @asdfisdffdg I already tried with using multiple channels but I couldn't see any major performance improvements. Still in upcoming release I will try to add multiple channels as option.

You need to use webhooks in order to get more speed. I tested it on my setup with one channel and can upload ~25 Mbit/s (a chunk in 2s on average sometimes delayed bc ratelimit) I tested it with 10 channels with the bot and still can upload ~25 Mbit/s I tested it with 20 channels over webhooks and can put up ~600 Mbit/s (the max. amount of webhooks you can create in a short span of time, without getting blocked for a very long time from creating webhooks)
Edit: Also if you use mutliple servers you can via the bot create 20 channels and webhooks per server without getting blocked I used this to fill up 5 server for a total of 100 channels. Now I can put up 2 Gbit/s ( which is my network limit :) )

How exactly does this work? Do you send multiple files in one webhook request (using multipart/form-data), multiple requests in parallel at the same time or multiple requests parallel to different channels/servers? I'm curious because while I got a speedup it was never as big as you mention in your post.
@mattmeten

You send multiple parts at the same time in parallel. So for example you create 2 channels and add 20 webhooks per channel so you get 40 webhook urls in total. You then take the let's say 1 GB big file and split it into 40 chunks that are 8 MB big. You send all this 40 chunks at the same time, each to a different webhook. You then when a webhook finished it's 8 MB chunk stuff a new 8 MB chunk into this webhook. You constantly keep up the 40 connections in parallel until the file is finished and no more data is there to be uploaded. After that you have a ton of chunks uploaded with 40 chunks per webhook timing instead of 1 chunk per webhook timing. This process can be upscaled to as much as you want and as much as your processor / ram and network can handle.

but all webhooks in a channel share the same rate limit ??? or does sending at the same time circumvent that somehow?

@UnlimitedBytes
Copy link

@NoNameLmao, @asdfisdffdg I already tried with using multiple channels but I couldn't see any major performance improvements. Still in upcoming release I will try to add multiple channels as option.

You need to use webhooks in order to get more speed. I tested it on my setup with one channel and can upload ~25 Mbit/s (a chunk in 2s on average sometimes delayed bc ratelimit) I tested it with 10 channels with the bot and still can upload ~25 Mbit/s I tested it with 20 channels over webhooks and can put up ~600 Mbit/s (the max. amount of webhooks you can create in a short span of time, without getting blocked for a very long time from creating webhooks)
Edit: Also if you use mutliple servers you can via the bot create 20 channels and webhooks per server without getting blocked I used this to fill up 5 server for a total of 100 channels. Now I can put up 2 Gbit/s ( which is my network limit :) )

How exactly does this work? Do you send multiple files in one webhook request (using multipart/form-data), multiple requests in parallel at the same time or multiple requests parallel to different channels/servers? I'm curious because while I got a speedup it was never as big as you mention in your post.
@mattmeten

You send multiple parts at the same time in parallel. So for example you create 2 channels and add 20 webhooks per channel so you get 40 webhook urls in total. You then take the let's say 1 GB big file and split it into 40 chunks that are 8 MB big. You send all this 40 chunks at the same time, each to a different webhook. You then when a webhook finished it's 8 MB chunk stuff a new 8 MB chunk into this webhook. You constantly keep up the 40 connections in parallel until the file is finished and no more data is there to be uploaded. After that you have a ton of chunks uploaded with 40 chunks per webhook timing instead of 1 chunk per webhook timing. This process can be upscaled to as much as you want and as much as your processor / ram and network can handle.

but all webhooks in a channel share the same rate limit ??? or does sending at the same time circumvent that somehow?

A sorry my brain is miss functional you add 1 webhook per channel but 20 channels :D

@ledlamp
Copy link

ledlamp commented Sep 24, 2022

yes that's what i was saying. but the bot also has separate rate limit per channel, so you could just use the bot itself. or you could use both for double per channel. but it might be simpler to just make more channels.

@forscht
Copy link
Owner

forscht commented Jan 11, 2023

This improvement has been added in version v4.0. I was able to upload 5GB of file under 85 seconds.
Schermafbeelding_2023-01-08_om_10 59 23

@forscht forscht closed this as completed Jan 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

6 participants