Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions cmd/stellar-rpc/internal/config/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ type Config struct {
CaptiveCoreHTTPQueryThreadPoolSize uint16
CaptiveCoreHTTPQuerySnapshotLedgers uint16

IngestionLoadTestFixturesPath string
IngestionLoadTestLedgersPath string
IngestionLoadTestCloseDuration time.Duration

Endpoint string
AdminEndpoint string
CheckpointFrequency uint32
Expand Down
16 changes: 16 additions & 0 deletions cmd/stellar-rpc/internal/config/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,22 @@ func (cfg *Config) options() Options {
}
},
},
{
Name: "ingestion-load-test-fixtures-path",
Usage: "path to ledger entries file which will be used as fixtures for the ingestion load test.",
ConfigKey: &cfg.IngestionLoadTestFixturesPath,
},
{
Name: "ingestion-load-test-ledgers-path",
Usage: "path to ledgers file which will be replayed in the ingestion load test.",
ConfigKey: &cfg.IngestionLoadTestLedgersPath,
},
{
Name: "ingestion-load-test-close-duration",
DefaultValue: 2 * time.Second,
Usage: "the time (in seconds) it takes to close ledgers in the ingestion load test.",
ConfigKey: &cfg.IngestionLoadTestCloseDuration,
},
{
Name: "history-archive-urls",
Usage: "comma-separated list of stellar history archives to connect with",
Expand Down
17 changes: 14 additions & 3 deletions cmd/stellar-rpc/internal/daemon/daemon.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"github.com/stellar/go/clients/stellarcore"
"github.com/stellar/go/historyarchive"
"github.com/stellar/go/ingest/ledgerbackend"
"github.com/stellar/go/ingest/loadtest"
"github.com/stellar/go/support/datastore"
supporthttp "github.com/stellar/go/support/http"
supportlog "github.com/stellar/go/support/log"
Expand Down Expand Up @@ -291,8 +292,7 @@ func createIngestService(cfg *config.Config, logger *supportlog.Entry, daemon *D
onIngestionRetry := func(err error, _ time.Duration) {
logger.WithError(err).Error("could not run ingestion. Retrying")
}

return ingest.NewService(ingest.Config{
ingestConfig := ingest.Config{
Logger: logger,
DB: db.NewReadWriter(
logger,
Expand All @@ -309,7 +309,18 @@ func createIngestService(cfg *config.Config, logger *supportlog.Entry, daemon *D
OnIngestionRetry: onIngestionRetry,
Daemon: daemon,
FeeWindows: feewindows,
})
}

if cfg.IngestionLoadTestLedgersPath != "" {
ingestConfig.LedgerBackend = loadtest.NewLedgerBackend(loadtest.LedgerBackendConfig{
NetworkPassphrase: cfg.NetworkPassphrase,
LedgerBackend: daemon.core,
LedgersFilePath: cfg.IngestionLoadTestLedgersPath,
LedgerEntriesFilePath: cfg.IngestionLoadTestFixturesPath,
LedgerCloseDuration: cfg.IngestionLoadTestCloseDuration,
})
}
return ingest.NewService(ingestConfig)
}

func createPreflightWorkerPool(cfg *config.Config, logger *supportlog.Entry, daemon *Daemon) *preflight.WorkerPool {
Expand Down
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ require (
github.com/gorilla/handlers v1.5.2 // indirect
github.com/gorilla/mux v1.8.1 // indirect
github.com/pkg/xattr v0.4.9 // indirect
github.com/xdrpp/goxdr v0.1.1 // indirect
)

require (
Expand Down
Loading