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

Complex Routing Rules Cause Overload and Connection Delays #3990

Open
Phoenix-999 opened this issue Nov 19, 2024 · 3 comments
Open

Complex Routing Rules Cause Overload and Connection Delays #3990

Phoenix-999 opened this issue Nov 19, 2024 · 3 comments

Comments

@Phoenix-999
Copy link

Hi @2dust

After some testing, I’ve noticed slight connection delays when using complex routing and custom geo asset files.
As shown in the video below, when the complex routing is enabled, there’s a lag of about 5 to 10 seconds after pressing the Play button. This issue is inconsistent.
sometimes the button doesn’t respond correctly and requires multiple presses to establish a connection.
However, when all routing rules are turned off or deleted, the connection is extremely fast, taking only about 0.14 milliseconds!

I understand this delay might be caused by the size of the complex rules or custom asset files, which could be affecting performance. However, I’m wondering if this could also be a minor bug?

Is there anything that can be done to optimize the app’s memory usage when complex routing is used to ensure a more efficient and faster connection?

Complex.Routing.Rules.Cause.Overload.and.Connection.Delays.mp4

Thank you in advance for looking into this!

@2dust
Copy link
Owner

2dust commented Nov 20, 2024

This behavior is not generated by this app, but by xray-core, so there is no way to optimize it.

@Phoenix-999
Copy link
Author

This behavior is not generated by this app, but by xray-core, so there is no way to optimize it.

Thank you for your input and clarification. Much appreciated! ✌🏾

@Phoenix-999
Copy link
Author

Phoenix-999 commented Nov 20, 2024

@2dust

Through testing, I found that in the IP field, using multiple rules together doesn’t cause any issues with connection delays. However, in the Domain field, applying more than one rule and using multiple rules collectively leads to unexpected connection delays.

Below, I’ve shared some examples of this issue that you can test yourself to verify the results.

For instance, in the Domain Category, we configured the rules to cover most Iranian websites by utilizing the app’s built-in GeoSite feature. According to the official documentation, geosite:category-ir alone is sufficient to cover almost everything. Therefore, adding additional rules isn’t necessary unless you want extra coverage as a precaution.

To simplify things and reduce connection delays, I condensed this list of rules:

geosite:category-gov-ir
geosite:category-news-ir
geosite:category-media-ir
geosite:category-social-media-ir
geosite:category-bank-ir
geosite:category-payment-ir
geosite:category-insurance-ir
geosite:category-education-ir
geosite:category-tech-ir
geosite:category-travel-ir
geosite:category-shopping-ir
geosite:category-scholar-ir
geosite:category-bourse-ir
geosite:category-forums-ir

Changed into this single rule:

geosite:category-ir

Similarly, for the ad-blocking section, the same problem occurs when multiple rules are used in the same field. By simplifying it to a single rule, the connection delay issue is either resolved or significantly reduced.

geosite:google-ads
geosite:yahoo-ads
geosite:adobe-ads
geosite:spotify-ads
geosite:apple-ads
geosite:amazon-ads

Changed into this single rule:

geosite:category-ads-all

Similarly, for the custom-made Geo asset file iran.dat in the Geo Assets section, simplifying multiple rules into a single rule resolved the connection delay issue.

ext:iran.dat:ir
ext:iran.dat:tld-ir
ext:iran.dat:other

Changed into this single rule:

ext:iran.dat:all

This approach worked for other sections too, with positive results—it significantly reduced connection delays.

In Summary:

Using a Single Rule in the Domain Field resolves the connection delay issue. However, using Multiple Rules in the same Domain Field is what causes the delays.

Even with these changes, I still notice some minor delays, the connection isn’t as fast as the app’s default behavior. Feel free to test it yourself to see how much improvement it brings to the connection delay.

As you mentioned, this might be an X-rayCore issue, but I thought I’d share my findings with you—it might help in identifying the root cause of the problem.

Many thanks!

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

No branches or pull requests

2 participants