Skip to content

Commit a634319

Browse files
snaphsh tile
1 parent fd5559d commit a634319

26 files changed

+561
-119
lines changed

book/api/metrics-generated.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -893,3 +893,15 @@
893893
| <span class="metrics-name">snapin_&#8203;accounts_&#8203;inserted</span> | gauge | Number of accounts inserted during snpashot loading. Might decrease if snapshot load is aborted and restarted |
894894

895895
</div>
896+
897+
## Snaphs Tile
898+
899+
<div class="metrics">
900+
901+
| Metric | Type | Description |
902+
|--------|------|-------------|
903+
| <span class="metrics-name">snaphs_&#8203;state</span> | gauge | State of the tile. 0=hashing, 1=done, 2=shutdown |
904+
| <span class="metrics-name">snaphs_&#8203;full_&#8203;accounts_&#8203;hashed</span> | gauge | Number of accounts hashed so far from the full snapshot. Might decrease if snapshot load is aborted and restarted |
905+
| <span class="metrics-name">snaphs_&#8203;incremental_&#8203;accounts_&#8203;hashed</span> | gauge | Number of accounts hashed so far from the incremental snapshot. Might decrease if snapshot load is aborted and restarted |
906+
907+
</div>

src/app/firedancer-dev/commands/backtest.c

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ static void
3636
backtest_topo( config_t * config ) {
3737
ulong exec_tile_cnt = config->firedancer.layout.exec_tile_count;
3838
ulong writer_tile_cnt = config->firedancer.layout.writer_tile_count;
39+
ulong hash_tile_cnt = config->firedancer.layout.hash_tile_count;
3940

4041
fd_topo_t * topo = { fd_topob_new( &config->topo, config->name ) };
4142
topo->max_page_size = fd_cstr_to_shmem_page_sz( config->hugetlbfs.max_page_size );
@@ -92,13 +93,19 @@ backtest_topo( config_t * config ) {
9293
fd_topob_wksp( topo, "snaprd" );
9394
fd_topob_wksp( topo, "snapdc" );
9495
fd_topob_wksp( topo, "snapin" );
96+
fd_topob_wksp( topo, "snaphs" );
9597
fd_topo_tile_t * snaprd_tile = fd_topob_tile( topo, "snaprd", "snaprd", "metric_in", cpu_idx++, 0, 0 );
9698
fd_topo_tile_t * snapdc_tile = fd_topob_tile( topo, "snapdc", "snapdc", "metric_in", cpu_idx++, 0, 0 );
9799
fd_topo_tile_t * snapin_tile = fd_topob_tile( topo, "snapin", "snapin", "metric_in", cpu_idx++, 0, 0 );
98100
snaprd_tile->allow_shutdown = 1;
99101
snapdc_tile->allow_shutdown = 1;
100102
snapin_tile->allow_shutdown = 1;
101103

104+
for( ulong i=0UL; i<hash_tile_cnt; i++ ) {
105+
fd_topo_tile_t * snaphsh_tile = fd_topob_tile( topo, "snaphs", "snaphs", "metric_in", cpu_idx++, 0, 0 );
106+
snaphsh_tile->allow_shutdown = 1;
107+
}
108+
102109
/**********************************************************************/
103110
/* Setup backtest->replay link (repair_repla) in topo */
104111
/**********************************************************************/
@@ -121,6 +128,8 @@ backtest_topo( config_t * config ) {
121128
fd_topob_wksp( topo, "snapdc_rd" );
122129
fd_topob_wksp( topo, "snapin_rd" );
123130
fd_topob_wksp( topo, "snap_out" );
131+
fd_topob_wksp( topo, "snapin_hsh" );
132+
fd_topob_wksp( topo, "snaphsh_out" );
124133
fd_topob_wksp( topo, "replay_manif" );
125134
/* TODO: Should be depth of 1 or 2, not 4, but it causes backpressure
126135
from the replay tile parsing the manifest, remove when this is
@@ -129,8 +138,10 @@ backtest_topo( config_t * config ) {
129138

130139
fd_topob_link( topo, "snap_zstd", "snap_zstd", 8192UL, 16384UL, 1UL );
131140
fd_topob_link( topo, "snap_stream", "snap_stream", 2048UL, USHORT_MAX, 1UL );
132-
fd_topob_link( topo, "snapdc_rd", "snapdc_rd", 128UL, 0UL, 1UL );
133-
fd_topob_link( topo, "snapin_rd", "snapin_rd", 128UL, 0UL, 1UL );
141+
fd_topob_link( topo, "snapdc_rd", "snapdc_rd", 128UL, 0UL, 1UL );
142+
fd_topob_link( topo, "snapin_rd", "snapin_rd", 128UL, 0UL, 1UL );
143+
fd_topob_link( topo, "snapin_hsh", "snapin_hsh", 1024UL, USHORT_MAX, 1UL );
144+
FOR(hash_tile_cnt) fd_topob_link( topo, "snaphsh_out", "snaphsh_out", 512UL, 2048UL, 1UL );
134145

135146
fd_topob_tile_out( topo, "snaprd", 0UL, "snap_zstd", 0UL );
136147
fd_topob_tile_in ( topo, "snapdc", 0UL, "metric_in", "snap_zstd", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
@@ -144,6 +155,12 @@ backtest_topo( config_t * config ) {
144155
fd_topob_tile_in( topo, "snaprd", 0UL, "metric_in", "snapin_rd", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
145156
fd_topob_tile_out( topo, "snapin", 0UL, "snapin_rd", 0UL );
146157

158+
fd_topob_tile_out( topo, "snapin", 0UL, "snapin_hsh", 0UL );
159+
fd_topob_tile_in( topo, "snapin", 0UL, "metric_in", "snaphsh_out", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
160+
161+
FOR(hash_tile_cnt) fd_topob_tile_in( topo, "snaphs", 0UL, "metric_in", "snapin_hsh", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
162+
FOR(hash_tile_cnt) fd_topob_tile_out( topo, "snaphs", 0UL, "snaphsh_out", 0UL );
163+
147164
/**********************************************************************/
148165
/* More backtest->replay links in topo */
149166
/**********************************************************************/

src/app/firedancer-dev/main.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ extern fd_topo_run_tile_t fd_tile_shredcap;
105105
extern fd_topo_run_tile_t fd_tile_snaprd;
106106
extern fd_topo_run_tile_t fd_tile_snapdc;
107107
extern fd_topo_run_tile_t fd_tile_snapin;
108+
extern fd_topo_run_tile_t fd_tile_snaphs;
108109

109110
fd_topo_run_tile_t * TILES[] = {
110111
&fd_tile_net,
@@ -149,6 +150,7 @@ fd_topo_run_tile_t * TILES[] = {
149150
&fd_tile_snaprd,
150151
&fd_tile_snapdc,
151152
&fd_tile_snapin,
153+
&fd_tile_snaphs,
152154
NULL,
153155
};
154156

src/app/firedancer/config/default.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -688,6 +688,9 @@ user = ""
688688
# very high TPS rates because the cluster size will be very small.
689689
shred_tile_count = 1
690690

691+
# How many snapshot hash tiles to run.
692+
hash_tile_count = 1
693+
691694
# All memory that will be used in Firedancer is pre-allocated in two
692695
# kinds of pages: huge and gigantic. Huge pages are 2 MiB and gigantic
693696
# pages are 1 GiB. This is done to prevent TLB misses which can have a

src/app/firedancer/topology.c

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,7 @@ fd_topo_initialize( config_t * config ) {
200200
ulong bank_tile_cnt = config->layout.bank_tile_count;
201201
ulong exec_tile_cnt = config->firedancer.layout.exec_tile_count;
202202
ulong writer_tile_cnt = config->firedancer.layout.writer_tile_count;
203+
ulong hash_tile_cnt = config->firedancer.layout.hash_tile_count;
203204
ulong resolv_tile_cnt = config->layout.resolv_tile_count;
204205

205206
int enable_rpc = ( config->rpc.port != 0 );
@@ -286,8 +287,11 @@ fd_topo_initialize( config_t * config ) {
286287
fd_topob_wksp( topo, "snapdc" );
287288
fd_topob_wksp( topo, "snaprd" );
288289
fd_topob_wksp( topo, "snapin" );
290+
fd_topob_wksp( topo, "snaphs" );
289291
fd_topob_wksp( topo, "snapdc_rd" );
290292
fd_topob_wksp( topo, "snapin_rd" );
293+
fd_topob_wksp( topo, "snapin_hsh" );
294+
fd_topob_wksp( topo, "snaphsh_out" );
291295
fd_topob_wksp( topo, "snap_stream" );
292296
fd_topob_wksp( topo, "snap_zstd" );
293297
fd_topob_wksp( topo, "snap_out" );
@@ -369,6 +373,9 @@ fd_topo_initialize( config_t * config ) {
369373
/**/ fd_topob_link( topo, "snap_out", "snap_out", 2UL, 5UL*(1UL<<30UL), 1UL );
370374
/**/ fd_topob_link( topo, "snapdc_rd", "snapdc_rd", 128UL, 0UL, 1UL );
371375
/**/ fd_topob_link( topo, "snapin_rd", "snapin_rd", 128UL, 0UL, 1UL );
376+
/**/ fd_topob_link( topo, "snapin_hsh", "snapin_hsh", 1024UL, USHORT_MAX, 1UL );
377+
378+
FOR(hash_tile_cnt) fd_topob_link( topo, "snaphsh_out", "snaphsh_out", 512UL, 2048UL, 1UL );
372379
373380
/* Replay decoded manifest dcache topo obj */
374381
fd_topo_obj_t * replay_manifest_dcache = fd_topob_obj( topo, "dcache", "replay_manif" );
@@ -439,6 +446,11 @@ fd_topo_initialize( config_t * config ) {
439446
fd_topo_tile_t * snapin_tile = fd_topob_tile( topo, "snapin", "snapin", "metric_in", tile_to_cpu[ topo->tile_cnt ], 0, 0 );
440447
snapin_tile->allow_shutdown = 1;
441448

449+
for( ulong i=0UL; i<hash_tile_cnt; i++ ) {
450+
fd_topo_tile_t * snaphsh_tile = fd_topob_tile( topo, "snaphs", "snaphs", "metric_in", tile_to_cpu[ topo->tile_cnt ], 0, 0 );
451+
snaphsh_tile->allow_shutdown = 1;
452+
}
453+
442454
/* Database cache */
443455

444456
fd_topo_obj_t * funk_obj = setup_topo_funk( topo, "funk",
@@ -723,6 +735,12 @@ fd_topo_initialize( config_t * config ) {
723735
fd_topob_tile_in( topo, "snaprd", 0UL, "metric_in", "snapin_rd", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
724736
fd_topob_tile_out( topo, "snapin", 0UL, "snapin_rd", 0UL );
725737

738+
fd_topob_tile_out( topo, "snapin", 0UL, "snapin_hsh", 0UL );
739+
fd_topob_tile_in( topo, "snapin", 0UL, "metric_in", "snaphsh_out", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
740+
741+
FOR(hash_tile_cnt) fd_topob_tile_in( topo, "snaphs", 0UL, "metric_in", "snapin_hsh", 0UL, FD_TOPOB_RELIABLE, FD_TOPOB_POLLED );
742+
FOR(hash_tile_cnt) fd_topob_tile_out( topo, "snaphs", 0UL, "snaphsh_out", 0UL );
743+
726744
if( config->tiles.archiver.enabled ) {
727745
fd_topob_wksp( topo, "arch_f" );
728746
fd_topob_wksp( topo, "arch_w" );
@@ -1043,6 +1061,8 @@ fd_topo_configure_tile( fd_topo_tile_t * tile,
10431061

10441062
} else if( FD_UNLIKELY( !strcmp( tile->name, "snapin" ) ) ) {
10451063
tile->snapin.funk_obj_id = fd_pod_query_ulong( config->topo.props, "funk", ULONG_MAX );
1064+
} else if( FD_UNLIKELY( !strcmp( tile->name, "snaphs" ) ) ) {
1065+
10461066
} else if( FD_UNLIKELY( !strcmp( tile->name, "arch_f" ) ||
10471067
!strcmp( tile->name, "arch_w" ) ) ) {
10481068
strncpy( tile->archiver.rocksdb_path, config->tiles.archiver.rocksdb_path, sizeof(tile->archiver.rocksdb_path) );

src/app/shared/fd_config.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ struct fd_configf {
112112
struct {
113113
uint exec_tile_count; /* TODO: redundant ish with bank tile cnt */
114114
uint writer_tile_count;
115+
uint hash_tile_count;
115116
} layout;
116117

117118
struct {

src/app/shared/fd_config_parse.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ fd_config_extract_podf( uchar * pod,
7878
fd_configf_t * config ) {
7979
CFG_POP ( uint, layout.exec_tile_count );
8080
CFG_POP ( uint, layout.writer_tile_count );
81+
CFG_POP ( uint, layout.hash_tile_count );
8182

8283
CFG_POP ( ulong, blockstore.shred_max );
8384
CFG_POP ( ulong, blockstore.block_max );

src/disco/metrics/generate/types.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ class Tile(Enum):
3030
SNAPRD = 24
3131
SNAPDC = 25
3232
SNAPIN = 26
33+
SNAPHS = 27
3334

3435

3536
class MetricType(Enum):

src/disco/metrics/generated/fd_metrics_all.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ const char * FD_METRICS_TILE_KIND_NAMES[FD_METRICS_TILE_KIND_CNT] = {
5959
"snaprd",
6060
"snapdc",
6161
"snapin",
62+
"snaphs",
6263
};
6364

6465
const ulong FD_METRICS_TILE_KIND_SIZES[FD_METRICS_TILE_KIND_CNT] = {
@@ -85,6 +86,7 @@ const ulong FD_METRICS_TILE_KIND_SIZES[FD_METRICS_TILE_KIND_CNT] = {
8586
FD_METRICS_SNAPRD_TOTAL,
8687
FD_METRICS_SNAPDC_TOTAL,
8788
FD_METRICS_SNAPIN_TOTAL,
89+
FD_METRICS_SNAPHS_TOTAL,
8890
};
8991
const fd_metrics_meta_t * FD_METRICS_TILE_KIND_METRICS[FD_METRICS_TILE_KIND_CNT] = {
9092
FD_METRICS_NET,
@@ -110,4 +112,5 @@ const fd_metrics_meta_t * FD_METRICS_TILE_KIND_METRICS[FD_METRICS_TILE_KIND_CNT]
110112
FD_METRICS_SNAPRD,
111113
FD_METRICS_SNAPDC,
112114
FD_METRICS_SNAPIN,
115+
FD_METRICS_SNAPHS,
113116
};

src/disco/metrics/generated/fd_metrics_all.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#include "fd_metrics_snaprd.h"
2525
#include "fd_metrics_snapdc.h"
2626
#include "fd_metrics_snapin.h"
27+
#include "fd_metrics_snaphs.h"
2728
#include "fd_metrics_metric.h"
2829
/* Start of LINK OUT metrics */
2930

@@ -161,7 +162,7 @@ extern const fd_metrics_meta_t FD_METRICS_ALL_LINK_OUT[FD_METRICS_ALL_LINK_OUT_T
161162

162163
#define FD_METRICS_TOTAL_SZ (8UL*253UL)
163164

164-
#define FD_METRICS_TILE_KIND_CNT 23
165+
#define FD_METRICS_TILE_KIND_CNT 24
165166
extern const char * FD_METRICS_TILE_KIND_NAMES[FD_METRICS_TILE_KIND_CNT];
166167
extern const ulong FD_METRICS_TILE_KIND_SIZES[FD_METRICS_TILE_KIND_CNT];
167168
extern const fd_metrics_meta_t * FD_METRICS_TILE_KIND_METRICS[FD_METRICS_TILE_KIND_CNT];

0 commit comments

Comments
 (0)