lighthouse/beacon_node
Paul Hauner e7e5878953 Avoid BeaconState clone during metrics scrape (#2298)
## Issue Addressed

Which issue # does this PR address?

## Proposed Changes

Avoids cloning the `BeaconState` each time Prometheus scrapes our metrics (generally every 5s 😱).

I think the original motivation behind this was *"don't hold the lock on the head whilst we do computation on it"*, however I think is flawed since our computation here is so small that it'll be quicker than the clone.

The primary motivation here is to maintain a small memory footprint by holding less in memory (i.e., the cloned `BeaconState`) and to avoid the fragmentation-creep that occurs when cloning the big contiguous slabs of memory in the `BeaconState`.

I also collapsed the active/slashed/withdrawn counters into a single loop to increase efficiency.

## Additional Info

NA
2021-04-07 01:02:56 +00:00
..
beacon_chain Avoid BeaconState clone during metrics scrape (#2298) 2021-04-07 01:02:56 +00:00
client Use the database to persist the pubkey cache (#2234) 2021-03-04 01:25:12 +00:00
eth1 VC: accept unknown fields in chain spec (#2277) 2021-03-26 04:53:57 +00:00
eth2_libp2p Fix local testnet scripts (#2229) 2021-03-30 05:17:58 +00:00
genesis Update to tokio 1.1 (#2172) 2021-02-10 23:29:49 +00:00
http_api Allow for a clock disparity on the duties endpoints (#2283) 2021-03-29 23:42:35 +00:00
http_metrics Switch back to warp with cors wildcard support (#2211) 2021-02-18 22:33:12 +00:00
network Optimize validator duties (#2243) 2021-03-17 05:09:57 +00:00
operation_pool Update pool/attestations and committees endpoints (#1899) 2020-11-18 23:31:39 +00:00
src VC: accept unknown fields in chain spec (#2277) 2021-03-26 04:53:57 +00:00
store VC: accept unknown fields in chain spec (#2277) 2021-03-26 04:53:57 +00:00
tests Update to tokio 1.1 (#2172) 2021-02-10 23:29:49 +00:00
timer Update to tokio 1.1 (#2172) 2021-02-10 23:29:49 +00:00
websocket_server Server sent events (#1920) 2020-12-04 00:18:58 +00:00
Cargo.toml v1.2.2 (#2287) 2021-03-30 04:07:03 +00:00