Skip to content

Commit 3be8509

Browse files
ripatel-fdriptl
andauthored
accdb: add record allocation metrics (#7604)
Co-authored-by: Richard Patel <[email protected]>
1 parent 4efeb8a commit 3be8509

File tree

12 files changed

+44
-8
lines changed

12 files changed

+44
-8
lines changed

book/api/metrics-generated.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -533,10 +533,12 @@
533533
| <span class="metrics-name">replay_&#8203;transactions_&#8203;total</span> | counter | Count of transactions processed overall on the current fork |
534534
| <span class="metrics-name">replay_&#8203;sched_&#8203;full</span> | counter | Times where sched is full and a FEC set can't be processed |
535535
| <span class="metrics-name">replay_&#8203;reasm_&#8203;empty</span> | counter | Times where reasm is empty and a FEC set can't be processed |
536-
| <span class="metrics-name">replay_&#8203;leader_&#8203;bid_&#8203;wait</span> | counter | Times where replay is blocked by the the PoH tile not sending an end of leader message |
536+
| <span class="metrics-name">replay_&#8203;leader_&#8203;bid_&#8203;wait</span> | counter | Times where replay is blocked by the PoH tile not sending an end of leader message |
537537
| <span class="metrics-name">replay_&#8203;banks_&#8203;full</span> | counter | Times where banks are full and a FEC set can't be processed |
538538
| <span class="metrics-name">replay_&#8203;progcache_&#8203;rooted</span> | counter | Number of program cache entries rooted |
539539
| <span class="metrics-name">replay_&#8203;progcache_&#8203;gc_&#8203;root</span> | counter | Number of program cache entries garbage collected while rooting |
540+
| <span class="metrics-name">replay_&#8203;accdb_&#8203;created</span> | counter | Number of account database records created |
541+
| <span class="metrics-name">replay_&#8203;accdb_&#8203;reverted</span> | counter | Number of account database records reverted |
540542
| <span class="metrics-name">replay_&#8203;accdb_&#8203;rooted</span> | counter | Number of account database entries rooted |
541543
| <span class="metrics-name">replay_&#8203;accdb_&#8203;gc_&#8203;root</span> | counter | Number of account database entries garbage collected |
542544

@@ -1133,6 +1135,7 @@
11331135
| <span class="metrics-name">exec_&#8203;progcache_&#8203;fill_&#8203;fails</span> | counter | Number of program cache load fails (tombstones inserted) |
11341136
| <span class="metrics-name">exec_&#8203;progcache_&#8203;dup_&#8203;inserts</span> | counter | Number of time two tiles raced to insert the same cache entry |
11351137
| <span class="metrics-name">exec_&#8203;progcache_&#8203;invalidations</span> | counter | Number of program cache invalidations |
1138+
| <span class="metrics-name">exec_&#8203;accdb_&#8203;created</span> | counter | Number of account database records created |
11361139

11371140
</div>
11381141

src/disco/metrics/generated/fd_metrics_exec.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,5 @@ const fd_metrics_meta_t FD_METRICS_EXEC[FD_METRICS_EXEC_TOTAL] = {
99
DECLARE_METRIC( EXEC_PROGCACHE_FILL_FAILS, COUNTER ),
1010
DECLARE_METRIC( EXEC_PROGCACHE_DUP_INSERTS, COUNTER ),
1111
DECLARE_METRIC( EXEC_PROGCACHE_INVALIDATIONS, COUNTER ),
12+
DECLARE_METRIC( EXEC_ACCDB_CREATED, COUNTER ),
1213
};

src/disco/metrics/generated/fd_metrics_exec.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,13 @@
4848
#define FD_METRICS_COUNTER_EXEC_PROGCACHE_INVALIDATIONS_DESC "Number of program cache invalidations"
4949
#define FD_METRICS_COUNTER_EXEC_PROGCACHE_INVALIDATIONS_CVT (FD_METRICS_CONVERTER_NONE)
5050

51-
#define FD_METRICS_EXEC_TOTAL (7UL)
51+
#define FD_METRICS_COUNTER_EXEC_ACCDB_CREATED_OFF (23UL)
52+
#define FD_METRICS_COUNTER_EXEC_ACCDB_CREATED_NAME "exec_accdb_created"
53+
#define FD_METRICS_COUNTER_EXEC_ACCDB_CREATED_TYPE (FD_METRICS_TYPE_COUNTER)
54+
#define FD_METRICS_COUNTER_EXEC_ACCDB_CREATED_DESC "Number of account database records created"
55+
#define FD_METRICS_COUNTER_EXEC_ACCDB_CREATED_CVT (FD_METRICS_CONVERTER_NONE)
56+
57+
#define FD_METRICS_EXEC_TOTAL (8UL)
5258
extern const fd_metrics_meta_t FD_METRICS_EXEC[FD_METRICS_EXEC_TOTAL];
5359

5460
#endif /* HEADER_fd_src_disco_metrics_generated_fd_metrics_exec_h */

src/disco/metrics/generated/fd_metrics_replay.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ const fd_metrics_meta_t FD_METRICS_REPLAY[FD_METRICS_REPLAY_TOTAL] = {
2626
DECLARE_METRIC( REPLAY_BANKS_FULL, COUNTER ),
2727
DECLARE_METRIC( REPLAY_PROGCACHE_ROOTED, COUNTER ),
2828
DECLARE_METRIC( REPLAY_PROGCACHE_GC_ROOT, COUNTER ),
29+
DECLARE_METRIC( REPLAY_ACCDB_CREATED, COUNTER ),
30+
DECLARE_METRIC( REPLAY_ACCDB_REVERTED, COUNTER ),
2931
DECLARE_METRIC( REPLAY_ACCDB_ROOTED, COUNTER ),
3032
DECLARE_METRIC( REPLAY_ACCDB_GC_ROOT, COUNTER ),
3133
};

src/disco/metrics/generated/fd_metrics_replay.h

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@
141141
#define FD_METRICS_COUNTER_REPLAY_LEADER_BID_WAIT_OFF (132UL)
142142
#define FD_METRICS_COUNTER_REPLAY_LEADER_BID_WAIT_NAME "replay_leader_bid_wait"
143143
#define FD_METRICS_COUNTER_REPLAY_LEADER_BID_WAIT_TYPE (FD_METRICS_TYPE_COUNTER)
144-
#define FD_METRICS_COUNTER_REPLAY_LEADER_BID_WAIT_DESC "Times where replay is blocked by the the PoH tile not sending an end of leader message"
144+
#define FD_METRICS_COUNTER_REPLAY_LEADER_BID_WAIT_DESC "Times where replay is blocked by the PoH tile not sending an end of leader message"
145145
#define FD_METRICS_COUNTER_REPLAY_LEADER_BID_WAIT_CVT (FD_METRICS_CONVERTER_NONE)
146146

147147
#define FD_METRICS_COUNTER_REPLAY_BANKS_FULL_OFF (133UL)
@@ -162,19 +162,31 @@
162162
#define FD_METRICS_COUNTER_REPLAY_PROGCACHE_GC_ROOT_DESC "Number of program cache entries garbage collected while rooting"
163163
#define FD_METRICS_COUNTER_REPLAY_PROGCACHE_GC_ROOT_CVT (FD_METRICS_CONVERTER_NONE)
164164

165-
#define FD_METRICS_COUNTER_REPLAY_ACCDB_ROOTED_OFF (136UL)
165+
#define FD_METRICS_COUNTER_REPLAY_ACCDB_CREATED_OFF (136UL)
166+
#define FD_METRICS_COUNTER_REPLAY_ACCDB_CREATED_NAME "replay_accdb_created"
167+
#define FD_METRICS_COUNTER_REPLAY_ACCDB_CREATED_TYPE (FD_METRICS_TYPE_COUNTER)
168+
#define FD_METRICS_COUNTER_REPLAY_ACCDB_CREATED_DESC "Number of account database records created"
169+
#define FD_METRICS_COUNTER_REPLAY_ACCDB_CREATED_CVT (FD_METRICS_CONVERTER_NONE)
170+
171+
#define FD_METRICS_COUNTER_REPLAY_ACCDB_REVERTED_OFF (137UL)
172+
#define FD_METRICS_COUNTER_REPLAY_ACCDB_REVERTED_NAME "replay_accdb_reverted"
173+
#define FD_METRICS_COUNTER_REPLAY_ACCDB_REVERTED_TYPE (FD_METRICS_TYPE_COUNTER)
174+
#define FD_METRICS_COUNTER_REPLAY_ACCDB_REVERTED_DESC "Number of account database records reverted"
175+
#define FD_METRICS_COUNTER_REPLAY_ACCDB_REVERTED_CVT (FD_METRICS_CONVERTER_NONE)
176+
177+
#define FD_METRICS_COUNTER_REPLAY_ACCDB_ROOTED_OFF (138UL)
166178
#define FD_METRICS_COUNTER_REPLAY_ACCDB_ROOTED_NAME "replay_accdb_rooted"
167179
#define FD_METRICS_COUNTER_REPLAY_ACCDB_ROOTED_TYPE (FD_METRICS_TYPE_COUNTER)
168180
#define FD_METRICS_COUNTER_REPLAY_ACCDB_ROOTED_DESC "Number of account database entries rooted"
169181
#define FD_METRICS_COUNTER_REPLAY_ACCDB_ROOTED_CVT (FD_METRICS_CONVERTER_NONE)
170182

171-
#define FD_METRICS_COUNTER_REPLAY_ACCDB_GC_ROOT_OFF (137UL)
183+
#define FD_METRICS_COUNTER_REPLAY_ACCDB_GC_ROOT_OFF (139UL)
172184
#define FD_METRICS_COUNTER_REPLAY_ACCDB_GC_ROOT_NAME "replay_accdb_gc_root"
173185
#define FD_METRICS_COUNTER_REPLAY_ACCDB_GC_ROOT_TYPE (FD_METRICS_TYPE_COUNTER)
174186
#define FD_METRICS_COUNTER_REPLAY_ACCDB_GC_ROOT_DESC "Number of account database entries garbage collected"
175187
#define FD_METRICS_COUNTER_REPLAY_ACCDB_GC_ROOT_CVT (FD_METRICS_CONVERTER_NONE)
176188

177-
#define FD_METRICS_REPLAY_TOTAL (26UL)
189+
#define FD_METRICS_REPLAY_TOTAL (28UL)
178190
extern const fd_metrics_meta_t FD_METRICS_REPLAY[FD_METRICS_REPLAY_TOTAL];
179191

180192
#endif /* HEADER_fd_src_disco_metrics_generated_fd_metrics_replay_h */

src/disco/metrics/metrics.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -809,6 +809,8 @@ metric introduced.
809809
<counter name="ProgcacheRooted" summary="Number of program cache entries rooted" />
810810
<counter name="ProgcacheGcRoot" summary="Number of program cache entries garbage collected while rooting" />
811811

812+
<counter name="AccdbCreated" summary="Number of account database records created" />
813+
<counter name="AccdbReverted" summary="Number of account database records reverted" />
812814
<counter name="AccdbRooted" summary="Number of account database entries rooted" />
813815
<counter name="AccdbGcRoot" summary="Number of account database entries garbage collected" />
814816
</tile>
@@ -1125,6 +1127,7 @@ metric introduced.
11251127
<counter name="ProgcacheFillFails" summary="Number of program cache load fails (tombstones inserted)" />
11261128
<counter name="ProgcacheDupInserts" summary="Number of time two tiles raced to insert the same cache entry" />
11271129
<counter name="ProgcacheInvalidations" summary="Number of program cache invalidations" />
1130+
<counter name="AccdbCreated" summary="Number of account database records created" />
11281131
</tile>
11291132

11301133
<tile name="benchs">

src/discof/exec/fd_exec_tile.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,9 @@ metrics_write( fd_exec_tile_ctx_t * ctx ) {
9898
FD_MCNT_SET( EXEC, PROGCACHE_FILL_TOT_SZ, progcache->metrics->fill_tot_sz );
9999
FD_MCNT_SET( EXEC, PROGCACHE_INVALIDATIONS, progcache->metrics->invalidate_cnt );
100100
FD_MCNT_SET( EXEC, PROGCACHE_DUP_INSERTS, progcache->metrics->dup_insert_cnt );
101+
102+
fd_accdb_user_t * accdb = ctx->accdb;
103+
FD_MCNT_SET( EXEC, ACCDB_CREATED, accdb->base.created_cnt );
101104
}
102105

103106
/* Publish the txn finalized message to the replay tile */

src/discof/replay/fd_replay_tile.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -495,8 +495,10 @@ metrics_write( fd_replay_tile_t * ctx ) {
495495
FD_MCNT_SET( REPLAY, PROGCACHE_ROOTED, ctx->progcache_admin->metrics.root_cnt );
496496
FD_MCNT_SET( REPLAY, PROGCACHE_GC_ROOT, ctx->progcache_admin->metrics.gc_root_cnt );
497497

498-
FD_MCNT_SET( REPLAY, ACCDB_ROOTED, ctx->accdb_admin->metrics.root_cnt );
499-
FD_MCNT_SET( REPLAY, ACCDB_GC_ROOT, ctx->accdb_admin->metrics.gc_root_cnt );
498+
FD_MCNT_SET( REPLAY, ACCDB_CREATED, ctx->accdb->base.created_cnt );
499+
FD_MCNT_SET( REPLAY, ACCDB_REVERTED, ctx->accdb_admin->metrics.revert_cnt );
500+
FD_MCNT_SET( REPLAY, ACCDB_ROOTED, ctx->accdb_admin->metrics.root_cnt );
501+
FD_MCNT_SET( REPLAY, ACCDB_GC_ROOT, ctx->accdb_admin->metrics.gc_root_cnt );
500502
}
501503

502504
static inline ulong

src/flamenco/accdb/fd_accdb_admin.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ fd_accdb_txn_cancel_one( fd_accdb_admin_t * admin,
110110
rec_idx = next_idx;
111111
rec_cnt++;
112112
}
113+
admin->metrics.revert_cnt += rec_cnt;
113114
FD_LOG_INFO(( "accdb freed %lu records while cancelling txn %lu:%lu",
114115
rec_cnt, txn->xid.ul[0], txn->xid.ul[1] ));
115116

src/flamenco/accdb/fd_accdb_admin.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ struct fd_accdb_admin {
99
struct {
1010
ulong root_cnt;
1111
ulong gc_root_cnt;
12+
ulong revert_cnt;
1213
} metrics;
1314
};
1415

0 commit comments

Comments
 (0)