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

Mita Server Support Large-Scale Users #125

Closed
Platon929 opened this issue Mar 14, 2024 · 7 comments
Closed

Mita Server Support Large-Scale Users #125

Platon929 opened this issue Mar 14, 2024 · 7 comments
Labels
feature request New feature or request planned Planned feature

Comments

@Platon929
Copy link

I encountered a problem with our Mita server client while attempting to add a large number of users (10,000) at once. The client, Mieru, isn't working properly in this scenario, resulting in a timeout error. However, it operates correctly when adding a smaller number of users under normal circumstances.

@enfein enfein added the wontfix This will not be worked on label Mar 14, 2024
@enfein enfein changed the title Mitra Server Client Fails with Large-Scale User Addition Mitra Server Fails with Large-Scale User Addition Mar 14, 2024
@enfein
Copy link
Owner

enfein commented Mar 14, 2024

This is expected. When a new connection is established, the server will iterate all the users and try to decrypt the message, which can take a long time if the number of users is huge.

The limit depends on the performance of server machine.

It is better to load balance users to different machines.

@Platon929
Copy link
Author

Platon929 commented Mar 15, 2024

There's no problem with the VPS; it has 32GB of RAM, and only one user is connected, yet I'm experiencing a timeout issue. I created 3 servers with fake json config files for XTLS Xray(2GB RAM), Singbox(2GB RAM), and Mieru(32GB RAM), but the problem only occurs with Mieru. Could you please check it? Thank you.

@Platon929
Copy link
Author

I believe there are issues with the code that make iterating over all users unnecessary. Instead, we can utilize the array index to verify if a user exists. While I'm not well-versed in Go language, this approach is applicable in other programming languages.

@Platon929 Platon929 changed the title Mitra Server Fails with Large-Scale User Addition Mita Server Fails with Large-Scale User Addition Mar 15, 2024
@enfein
Copy link
Owner

enfein commented Mar 15, 2024

I got your point. This is achieved with TLS. Client encrypt the user info with server's public key. Server uses the private key to decrypt, and get the user info. Server uses the same private key to decrypt all incoming requests.

No TLS was the initial design goal of this project (https://github.com/enfein/mieru/blob/main/docs/announcement.zh_CN.md). I don't want to complicate everything by bringing in it.

@enfein
Copy link
Owner

enfein commented Mar 15, 2024

There are some ways to mitigate, for example: run decryption in parallel, start from the most recent user, etc.

@enfein enfein added feature request New feature or request and removed wontfix This will not be worked on labels Mar 16, 2024
@enfein
Copy link
Owner

enfein commented Mar 16, 2024

I think this is possible to do with cipher caching.

@enfein enfein changed the title Mita Server Fails with Large-Scale User Addition Mita Server Support Large-Scale Users Mar 16, 2024
@enfein
Copy link
Owner

enfein commented Apr 22, 2024

Given there are some other protocol changes we can make, let's do everything together and target this at mieru v3.0.0 release.

@enfein enfein added the planned Planned feature label Apr 22, 2024
enfein added a commit that referenced this issue Apr 26, 2024
1. Make changes to the mieru protocol to improve performance and security (issue #125).
@enfein enfein closed this as completed Apr 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request New feature or request planned Planned feature
Projects
None yet
Development

No branches or pull requests

2 participants