-
Notifications
You must be signed in to change notification settings - Fork 922
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
gRPC listchannels & listnodes performance #7984
Comments
While it is true that our custom rust decoder could be more optimized i can't reproduce these horrible stats:
Did you compile the rust binaries in release mode? Check the size of cln-grpc if its around 20MB it's in release mode if it's ~200MB it's in debug mode. What is the hardware? |
For reference: import time
from pathlib import Path
import grpc
from pyln import grpc as clnpb
max_message_size = 100 * 1024 * 1024 # 100 MB
p = Path("/home/bitcoin/.lightning/bitcoin")
cert_path = p / "client.pem"
key_path = p / "client-key.pem"
ca_cert_path = p / "ca.pem"
creds = grpc.ssl_channel_credentials(
root_certificates=ca_cert_path.open("rb").read(),
private_key=key_path.open("rb").read(),
certificate_chain=cert_path.open("rb").read(),
)
channel = grpc.secure_channel(
"127.0.0.1:9736",
creds,
options=(
("grpc.ssl_target_name_override", "cln"),
("grpc.max_receive_message_length", max_message_size),
),
)
stub = clnpb.NodeStub(channel)
start_time = time.time()
response = stub.ListChannels(clnpb.ListchannelsRequest())
print(f"Grpc listchannels took {round(time.time() - start_time, 2)}s")
print(f"channelcount: {len(response.channels)}")
start_time = time.time()
response = stub.ListNodes(clnpb.ListnodesRequest())
print(f"Grpc listnodes took {round(time.time() - start_time, 2)}s")
print(f"nodecount: {len(response.nodes)}") This is what i created inside the cln repo's tests folder. |
lets assume that the encoding of grpc is fast enough because they have some users! What is the performance of the I am worried about this part of the code https://github.com/ElementsProject/lightning/blob/master/cln-rpc/src/lib.rs#L314 that it is doing unnecessary conversion from However, performance of encoding and decoding in rust depends also from CPU so probably this can be another reason that @daywalker90 is getting another type of performance result |
i rewrote that script in rust so i can use call_typed:
For comparison in debug mode (pointless to benchmark in debug mode but i suspect this is what happened to OP, well maybe not looking at the grpc results lol):
I'm using a 10 year old intel cpu: i7-6700k |
Getting all nodes or channels CLN has gossip for via the gRPC interface is really slow. Calling
listchannels
via gRPC takes a minute while the CPU usage of the gRPC plugin spikes to 100% on one coreIt is definitely not a problem with my CLN installation or my machine because the RPC socket socket is quick:
getinfo
outputThe text was updated successfully, but these errors were encountered: