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

Enable by default the compression support #4387

Closed
wants to merge 1 commit into from

Conversation

a-noni-mousse
Copy link
Contributor

@a-noni-mousse a-noni-mousse commented Jan 15, 2023

High Level Overview of Change

Enable link compression by default.

Context of Change

The server can save bandwidth by compressing its p2p communications at the cost of greater CPU usage. Servers that have link compression enabled will automatically compress communications with peers that also have link compression enabled.

In rippled.cfg, you can enable compression with:

[compression]
true

Use false to disable compression. Prior to this PR, false is the default.

Restart the server software. After the restart, your server automatically uses link compression with other peers that also have link compression enabled.

Link compression is not currently mentioned in rippled-example.cfg, but it should be.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Refactor (non-breaking change that only restructures code)
  • Tests (You added tests for code that already exists, or your new feature included in this PR)
  • Documentation Updates
  • Release

@intelliot
Copy link
Collaborator

intelliot commented Jan 18, 2023

Note: Protocol message compression support was added in #3287

Ping: @gregtatcam @nbougalis @seelabs @HowardHinnant

@gregtatcam
Copy link
Collaborator

I'm curious if there is a stats available on the compression adaption rate?

Copy link
Collaborator

@gregtatcam gregtatcam left a comment

Choose a reason for hiding this comment

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

LGTM

@a-noni-mousse
Copy link
Contributor Author

I do not know about stats of compression sorry! Perhaps Ripple can check from their r.ripple clusters?

@intelliot
Copy link
Collaborator

is a stats available on the compression adaption rate?

@xzhaous could you check into this?

@intelliot intelliot added this to the 1.11.0 milestone Mar 1, 2023
@alloynetworks
Copy link
Contributor

I would prefer more testing before making it as default. There could be memory and cpu increases that may affect some nodes. I will enable it on a portion of the zaphod hubs and monitor (currently only a couple have it enabled). Recommend that Ripple also enable compression similarly, if not already done.

@intelliot intelliot removed this from the 1.11.0 milestone Apr 6, 2023
@a-noni-mousse
Copy link
Contributor Author

Have you seen any memory change from this @alloynetworks and @intelliot ?? Making the compressor obligatory will help to reduce the memory usage because now server must make two copies of every message if one other peer server has the compression.

@a-noni-mousse
Copy link
Contributor Author

Are there any updates @alloynetworks and @intelliot???

@alloynetworks
Copy link
Contributor

Are there any updates @alloynetworks and @intelliot???

I don’t see any performance issues on my nodes. But for reference these are all high end servers with a minimum of 128GB RAM. I don’t know if others also performed tests on different hardware specs.

@a-noni-mousse
Copy link
Contributor Author

This should merge or i should make patch to remove compression code from code.

@gregtatcam
Copy link
Collaborator

I ran some analysis on how many nodes support the compression. First, I crawled the network and got 702 nodes. Out of 702, I can connect to 75 nodes via the protocol. The majority of other nodes either time out to connect or respond with the service is unavailable. 50 nodes out of the 75 connected have the compression enabled. The vast majority of the 75 nodes are hubs; i.e. have a large number of connected peers. We can then assume that the compression adaption by the hubs is 66%. I think, given the adaption rate, it makes sense to turn the compression on by default. It is of course natural for hubs to have the compression enabled as they could save the most on the bandwidth. But to have a significant effect on the network, majority of the nodes have to have the compression enabled.

@intelliot intelliot requested a review from ckeshava August 9, 2023 00:27
@ckeshava
Copy link
Collaborator

ckeshava commented Aug 9, 2023

@gregtatcam How did you query the servers if they are using the compression support? Does rippled expose any APIs for such queries or are you using an indirect method to detect compression support?

@ckeshava
Copy link
Collaborator

ckeshava commented Aug 9, 2023

@a-noni-mousse this looks good to me. I'm not able to build this branch locally, but that is due to a problem in my build system. The CI appears to be happy on github 👍

Question:
Despite this change, even if one of the validators on my UNL has compression disabled, then I will need to keep two copies (compressed and uncompressed version) for every message right?

For this change to reap benefits, all of the validators on my UNL need to have compression enabled. (My understanding is that a validator only communicates with the other peers on the UNL, hence those peers which are not on its UNL do not affect the communication complexity of a validator.)

@gregtatcam
Copy link
Collaborator

@gregtatcam How did you query the servers if they are using the compression support? Does rippled expose any APIs for such queries or are you using an indirect method to detect compression support?

I sent the protocol handshake, which requested the compression enabled. The response indicates if the compression is supported by the connected peer.

@ckeshava
Copy link
Collaborator

ckeshava commented Aug 9, 2023 via email

@intelliot
Copy link
Collaborator

note: link compression is documented here - https://xrpl.org/enable-link-compression.html

but it is not mentioned in rippled-example.cfg - https:/XRPLF/rippled/blob/develop/cfg/rippled-example.cfg

@intelliot
Copy link
Collaborator

@ckeshava - can you look at the code (and if possible, write a unit test) to confirm that even after the change in this PR, compression can still be fully disabled by adding the following to rippled.cfg?

[compression]
false

@intelliot intelliot added this to the 2.0 milestone Sep 19, 2023
@ckeshava
Copy link
Collaborator

hello @intelliot ,
I discussed the possibility of unit tests with @gregtatcam . He has already written compatibility unit tests here:

auto handshake = [&](int outboundEnable, int inboundEnable) {
. These handshake tests ensure that if two peers want to communicate with each other, they need to have identical compression settings.

Secondly, @gregtatcam has collected statistics about the bandwidth, CPU and memory consumption with the different compression settings. I can repeat the same experiment and verify the values.

I have a question for @manojsdoshi and his team. Do you have integration tests where the validators have different compression settings? I believe such tests are more reliable in ensuring that the code doesn't break. The ad-hoc experiments above serve as sanity checks, I'd prefer to include these tests in a regular pipeline.

intelliot pushed a commit that referenced this pull request Oct 6, 2023
P2P link compression is a feature added in 1.6.0 by #3287.

https://xrpl.org/enable-link-compression.html

If the default changes in the future - for example, as currently
proposed by #4387 - the comment will be updated at that time.

Fix #4656
@intelliot intelliot modified the milestones: 2.0, 2024 release Oct 18, 2023
@HowardHinnant HowardHinnant removed their request for review January 25, 2024 18:18
@intelliot intelliot added the Perf Attn Needed Attention needed from RippleX Performance Team label Feb 1, 2024
@intelliot
Copy link
Collaborator

Internal tracker: RPFC-108

@intelliot intelliot removed this from the 2.2.0 (June 2024) milestone May 31, 2024
@intelliot
Copy link
Collaborator

Note: currently blocked by perf sign off. Low priority.

@sophiax851
Copy link
Collaborator

sophiax851 commented May 31, 2024 via email

sophiax851 pushed a commit to sophiax851/rippled that referenced this pull request Jun 12, 2024
P2P link compression is a feature added in 1.6.0 by XRPLF#3287.

https://xrpl.org/enable-link-compression.html

If the default changes in the future - for example, as currently
proposed by XRPLF#4387 - the comment will be updated at that time.

Fix XRPLF#4656
@q73zhao
Copy link

q73zhao commented Jun 25, 2024

The comparison testing is done against 2.2.0-rc3 between compression enabled by default and without compression.

Without the compression, the transaction tps is around 282.6. With the compression, the transaction tps is around 264.46, which is around 6% deduction. I did not observe any cpu usage increase but some memory increase when the compression is enabled by default. Since there is a small dip, I would recommend not to enable the compression by default feature.

@gregtatcam
Copy link
Collaborator

The comparison testing is done against 2.2.0-rc3 between compression enabled by default and without compression.

Without the compression, the transaction tps is around 282.6. With the compression, the transaction tps is around 264.46, which is around 6% deduction. I did not observe any cpu usage increase but some memory increase when the compression is enabled by default. Since there is a small dip, I would recommend not to enable the compression by default feature.

Was the measurement done over one run or over multiple runs?

@q73zhao
Copy link

q73zhao commented Jun 25, 2024

The comparison testing is done against 2.2.0-rc3 between compression enabled by default and without compression.
Without the compression, the transaction tps is around 282.6. With the compression, the transaction tps is around 264.46, which is around 6% deduction. I did not observe any cpu usage increase but some memory increase when the compression is enabled by default. Since there is a small dip, I would recommend not to enable the compression by default feature.

Was the measurement done over one run or over multiple runs?

Hi @gregtatcam It is done over multiple runs of 1 hour test. I did not observe significant cpu increase but around 10% of memory increase

@sophiax851
Copy link
Collaborator

sophiax851 commented Jun 26, 2024

Looks like we can't merge this PR due to the impact to the network/validators. We only tested on an internal network with limited nodes, the impact could be more when the # of peers increases.

@intelliot
Copy link
Collaborator

Closing due to:

The comparison testing is done against 2.2.0-rc3 between compression enabled by default and without compression.

Without the compression, the transaction tps is around 282.6. With the compression, the transaction tps is around 264.46, which is around 6% deduction. I did not observe any cpu usage increase but some memory increase when the compression is enabled by default. Since there is a small dip, I would recommend not to enable the compression by default feature.

Feel free to re-open (or open a new PR) in the future if anything changes.

@intelliot intelliot closed this Jun 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Discussion Perf Attn Needed Attention needed from RippleX Performance Team Tech Debt Non-urgent improvements Testable Will Need Documentation
Projects
Status: 📋 Backlog
Development

Successfully merging this pull request may close these issues.

8 participants