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

feat: AEP 6: Sharding and refactoring of MongoDB deployment inside ArmoniK #48

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

tschneider-aneo
Copy link

No description provided.

@CLAassistant
Copy link

CLAassistant commented Jun 26, 2024

CLA assistant check
All committers have signed the CLA.

AEP/aep-00004.md Outdated Show resolved Hide resolved
AEP/aep-00004.md Outdated Show resolved Hide resolved
AEP/aep-00004.md Outdated Show resolved Hide resolved
AEP/aep-00004.md Outdated Show resolved Hide resolved
AEP/aep-00004.md Outdated Show resolved Hide resolved
AEP/aep-00004.md Outdated Show resolved Hide resolved
AEP/aep-00004.md Outdated Show resolved Hide resolved
AEP/aep-00004.md Outdated Show resolved Hide resolved
AEP/aep-00004.md Outdated Show resolved Hide resolved
AEP/aep-00004.md Outdated Show resolved Hide resolved
AEP/aep-00004.md Outdated Show resolved Hide resolved
AEP/aep-00004.md Outdated Show resolved Hide resolved
AEP/aep-00004.md Outdated Show resolved Hide resolved
AEP/aep-00004.md Outdated Show resolved Hide resolved
AEP/aep-00004.md Outdated Show resolved Hide resolved
AEP/aep-00004.md Outdated Show resolved Hide resolved
AEP/aep-00004.md Outdated Show resolved Hide resolved
AEP/aep-00004.md Outdated Show resolved Hide resolved
AEP/aep-00004.md Outdated Show resolved Hide resolved
AEP/aep-00004.md Outdated Show resolved Hide resolved
AEP/aep-00004.md Outdated Show resolved Hide resolved
AEP/aep-00004.md Outdated Show resolved Hide resolved
AEP/aep-00004.md Outdated Show resolved Hide resolved
AEP/aep-00004.md Outdated Show resolved Hide resolved
AEP/aep-00004.md Outdated Show resolved Hide resolved
AEP/aep-00004.md Outdated Show resolved Hide resolved
AEP/aep-00004.md Outdated Show resolved Hide resolved
AEP/aep-00004.md Outdated Show resolved Hide resolved
AEP/aep-00004.md Outdated Show resolved Hide resolved
AEP/aep-00004.md Outdated Show resolved Hide resolved
AEP/aep-00004.md Outdated Show resolved Hide resolved
AEP/aep-00004.md Outdated Show resolved Hide resolved
AEP/aep-00004.md Outdated Show resolved Hide resolved
AEP/aep-00004.md Outdated Show resolved Hide resolved
AEP/aep-00004.md Outdated Show resolved Hide resolved
AEP/aep-00004.md Outdated Show resolved Hide resolved
AEP/aep-00004.md Outdated Show resolved Hide resolved
AEP/aep-00004.md Outdated Show resolved Hide resolved
AEP/aep-00004.md Outdated Show resolved Hide resolved
AEP/aep-00004.md Outdated Show resolved Hide resolved
AEP/aep-00004.md Outdated Show resolved Hide resolved
AEP/aep-00004.md Outdated Show resolved Hide resolved
AEP/aep-00004.md Outdated Show resolved Hide resolved
AEP/aep-00004.md Outdated
- Since the server is now preferably accessed with SRV strings, the port output is still present for retrocompatibility concerns but hardcoded with a value of 27017 (MongoDB default port).

**What would be specific to the sharded MongoDB Helm chart ?**
- It would be possible to deploy an out-of-the-box sharded MongoDB instance, with a configurable, but rather static, number of shards. We are currently working on a way to implement autoscaling. The number of config servers replicas and mongos "replicas" would also be configurable.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

je ne sais pas si cela devrait etre dans cette AEP. Cela me semble out of scope (un nouveau sujet)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Je pense que l'autoscaling (horizontal) est une conséquence plus que logique au sharding de base de données, donc le mentionner me parait pertinent

AEP/aep-00004.md Outdated Show resolved Hide resolved
aneojgurhem added a commit to aneoconsulting/ArmoniK.Core that referenced this pull request Oct 1, 2024
# Motivation

Following aneoconsulting/ArmoniK.Infra#168, this
PR aims to enable the deployment of a sharded MongoDB as ArmoniK's
database.

A more complete motivation is provided in AEP 004
(aneoconsulting/ArmoniK.Community#48). This PR
is meant to treat a previsible bottleneck on ArmoniK's database by
enabling a sharded architecture to it.

For now, when a sharded database is specified, the following collections
will be sharded :
- Result
- TaskData
- SessionData

# Description

This PR adds : 
- A method `ShardCollectionAsync` to the `IMongoDataModelMapping`
interface.
- 2 new `MongoOptions` : a string `AuthSource` and a boolean `Sharding`.
- A new class `ShardingExt` containing an extension method
`shardCollection` for the `IClientSessionHandle` interface.

When the `MongoOption` `Sharding` is true, the `MongoCollectionProvider`
calls `ShardCollectionAsync`. Then the implementation depends on whether
the collection is wanted to be sharded :
- If the collection has to be sharded, the `shardCollection` extension
method will be called.
- If the collection isn't wanted to be sharded, the method directly
returns a complete `Task`.

The new `MongoOption` `AuthSource` is required because the `MongoClient`
has to authenticate as an administrator to be able to shard a
collection.

# Testing

It has been tested manually. Since these developmentsts are very coupled
with ArmoniK's database, it is difficult to write unit tests. Anyhow, it
is still possible to have automatized integration tests that would
verify in a first time if a deployment of ArmoniK using these
deployments succeeds, and in a second time if sharding is indeed enabled
on the right collections. Workflows testing a deployment of ArmoniK with
a sharded MongoDB are currently being studied.

# Impact

In the end, it is expected to enhance ArmoniK's strong scalability.

# Additional Information

To better understand how MongoDB sharding works see [MongoDB's
documentation](https://www.mongodb.com/docs/manual/sharding/).

To understand why this new MongoOption is required, see : MongoDB's
documentation on the [shardCollection database
command](https://www.mongodb.com/docs/manual/reference/command/shardCollection/#mongodb-dbcommand-dbcmd.shardCollection)
and on [connection string's authSource
option](https://www.mongodb.com/docs/manual/reference/connection-string-options/#mongodb-urioption-urioption.authSource)

# Checklist

- [X] My code adheres to the coding and style guidelines of the project.
- [X] I have performed a self-review of my code.
- [X] I have commented my code, particularly in hard-to-understand
areas.
- [ ] I have made corresponding changes to the documentation.
- [X] I have thoroughly tested my modifications and added tests when
necessary.
- [X] Tests pass locally and in the CI.
- [ ] I have assessed the performance impact of my modifications.
@tschneider-aneo tschneider-aneo changed the title feat: AEP00004: Refactoring of MongoDB module feat: AEP00005: Refactoring of MongoDB module Oct 1, 2024
@tschneider-aneo tschneider-aneo changed the title feat: AEP00005: Refactoring of MongoDB module feat: AEP 5: sharding and refactoring of MongoDB deployment Oct 1, 2024
@tschneider-aneo tschneider-aneo changed the title feat: AEP 5: sharding and refactoring of MongoDB deployment feat: AEP 5: sharding and refactoring of MongoDB deployment Oct 1, 2024
@tschneider-aneo tschneider-aneo changed the title feat: AEP 5: sharding and refactoring of MongoDB deployment feat: AEP 5: sharding and refactoring of MongoDB deployment inside ArmoniK Oct 1, 2024
@dbrasseur-aneo
Copy link
Contributor

You need to rename the file to aep5

@tschneider-aneo
Copy link
Author

You need to rename the file to aep5

It is indeed going to be deleted ! I left the file named aep4 to keep the conversations on it !

@tschneider-aneo tschneider-aneo marked this pull request as ready for review October 2, 2024 13:11
@tschneider-aneo tschneider-aneo changed the title feat: AEP 5: sharding and refactoring of MongoDB deployment inside ArmoniK feat: AEP 5: Sharding and refactoring of MongoDB deployment inside ArmoniK Oct 2, 2024
@tschneider-aneo tschneider-aneo changed the title feat: AEP 5: Sharding and refactoring of MongoDB deployment inside ArmoniK feat: AEP 6: Sharding and refactoring of MongoDB deployment inside ArmoniK Oct 2, 2024
ngruelaneo
ngruelaneo previously approved these changes Oct 2, 2024
ngruelaneo
ngruelaneo previously approved these changes Oct 3, 2024
@lemaitre-aneo
Copy link
Contributor

I would use svg images for the illustrations. This would avoid storing binary files within the repo

@aneojgurhem
Copy link
Contributor

I would use svg images for the illustrations. This would avoid storing binary files within the repo

We have a public bucket to store this kind of image.
(Do not forget to rebase to fully remove the fine)

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

Successfully merging this pull request may close these issues.

6 participants