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

Multiprocess support #7

Open
HopeBaron opened this issue Jun 16, 2020 · 1 comment
Open

Multiprocess support #7

HopeBaron opened this issue Jun 16, 2020 · 1 comment
Labels

Comments

@HopeBaron
Copy link
Member

Summary

Create Remote implementations of Gateway, RequestHandler and DataCache that can comminucate rate limits between multiple Kord processes.

Goals

Make it viable for one bot token to be used over multiple Kord processes by:

  • syncing gateway send ratelimits
  • syncing gateway indentify ratelimits
  • syncing rest ratelimits
  • syncing cache data

Non-Goals

This issue does not intend to alter existing code (unless necessary), the implementation of this feature should be its own module.

Motivation

Kord technically supports multiprocess applications, but there is no support for the above goals. While this is a setup that won't be applicable for most users, it is something we should support if we wish to call Kord feature complete.

Description

Kord allows a single process to only run a subset of the suggested/required shards, but there is no support for the syncing of resources between these separate processes. This feature request intends to implement the needed parts to make this scenario relatively hassle-free.

The approach suggested is to create a RemoteGatewayClient, RemoteRequestHandlerClient, RemoteDataCacheClient and RemoteRateLimiterClient and their respective RemoteXServer variants, where clients will, based on a stream protocol, communicate the needed information with each other to remain in sync.

For everything but the DataCache, this would simply involve requesting and updating ratelimits with the server, requesting when the next action can be executed, notifying the consumption of tokens and information related like bucket rate limits. The DataCache however would require the ability to store and fetch complex data structures.

Conceptually, we're looking for something like rsocket to implement the protocol layer, although the requirement on netty, rxjava and other jvm-only libraries would mean that we'd have to find another implementation for our eventual move to multiplatform. We could simple write our own protocols on top of ktor, but the work needed for this might be out of scope. This issue will be expanded upon once we have found a suitable protocol layer.

Issue originally made by @BartArys

@misterquestions
Copy link

I like this challenge, is there any plan over this?

I have a few questions related to this:

  • Which communication protocols are you expecting to implement for this feature as mvp?
  • Are you planning on using a custom protocol for this purpose? If so is it worth rather than implementing another protocol?
  • Is there any discussion/plan on the required components to achieve this? that way maybe it can be split up into smaller pieces.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants