-
Notifications
You must be signed in to change notification settings - Fork 776
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
Add cache for selection proof signatures #3223
Conversation
Thinking on it some more I think it may be useful to keep the pre-computed sync selection proofs, because they also have the advantage of happening in the background off the hot path of trying to sign and publish a selection proof. |
@jmcruz1983 what about the total number of signing requests? We're curious whether there are fewer signing requests with this PR, and whether the increases you were seeing previously were evenly spaced or due to big spikes. |
@michaelsproul Everything is working with some decrease on |
Thanks for the info @jmcruz1983! How many validators are on the machine from which that graph was drawn? You mentioned previously that Lighthouse was doing a lot more signing than Teku, would you be able to send a similar graph for Teku? Or let us know Teku's average number of signatures per validator per epoch so we can compare. Thanks! 🙏 |
@michaelsproul |
Any idea when this PR will be released? |
@jmcruz1983 has the memory usage remained lower even after running this PR for a few days? We haven't been able to reproduce that on our nodes and don't know why that would occur |
@michaelsproul |
Any update here? |
@jmcruz1983 Would you mind trying the VC from v2.3.1 on your test system? I'm wondering if maybe the memory reduction was due to upgrading from v2.2.1 |
Hi @michaelsproul |
@jmcruz1983 Thanks again! I'd like to understand if there are any other differences between the binaries besides the version. My guess is that the memory difference might be due to the optimisation level used to compile our core crypto library ( Are you using the Docker images from DockerHub for v2.3.1? Do you use the When you compile the Docker image yourself for this branch, I guess you're using a recently-released CPU? In which case you'll get the equivalent of As a test, would you mind trying |
Hi @michaelsproul |
It's a real mystery! Do you mind trying the unoptimised (edit: cc @jmcruz1983) |
@michaelsproul |
@jmcruz1983 Thanks! Can you please try building an image manually for the |
@michaelsproul FYI,
|
Hi @jmcruz1983, I've opened a PR to help us debug the issue here: #3279. Once that lands in |
## Issue Addressed Following up from #3223 (comment), it has been observed that the validator client uses vastly more memory in some compilation configurations than others. Compiling with Cross and then putting the binary into an Ubuntu 22.04 image seems to use 3x more memory than compiling with Cargo directly on Debian bullseye. ## Proposed Changes Enable malloc metrics for the validator client. This will hopefully allow us to see the difference between the two compilation configs and compare heap fragmentation. This PR doesn't enable malloc tuning for the VC because it was found to perform significantly worse. The `--disable-malloc-tuning` flag is repurposed to just disable the metrics.
@jmcruz1983 the metrics have landed in |
@michaelsproul |
@jmcruz1983 If my suspicions are correct, I expect a large fraction of your VC's memory usage will be freed memory that hasn't been reclaimed, which should show up under The other main ones to keep an eye on are |
@michaelsproul
You can observer that custom build shows a better memory footprint. |
Thanks @jmcruz1983. We'll do some more investigations on our end to see what could be using so much memory when the VC uses web3signer. |
As requested by @paulhauner I took a snapshot on |
I was able to reproduce the memory issues locally and have written up an issue for it at #3302. |
Going to close this for now, seems like we get little to no benefit from this particular implementation. If these issues come up again, we could try investigating different avenues. |
Issue Addressed
#3216
Proposed Changes
Add a cache to each VC for selection proofs that have recently been computed. This ensures that duplicate selection proofs are processed quickly.
Additional Info
Maximum cache size is 64 signatures, at which point the oldest signature (or rather the signature referencing the oldest message) is removed to make room for the next signature.
WIP: Still need to remove pre-computation selection proofs if these are no longer desired.