What is the pab webserver doing with the blockchain?
locallycompact opened this issue · comments
Describe the feature you'd like
I'm using a PAB as of here https://gitlab.homotopic.tech/plutus/apps/multi-pab
I have systemd services for the node, wbe and plutus-chain-index running on 9081,9082 and 9083.
I have a pab config that looks like this:
dbConfig:
dbConfigFile: pab-core.db
dbConfigPoolSize: 20
chainIndexConfig:
ciBaseUrl: http://localhost:9083
pabWebserverConfig:
permissiveCorsPolicy: false
endpointTimeout: null
staticDir: null
baseUrl: http://localhost:9080
walletServerConfig:
walletSettings:
baseUrl: http://localhost:9081
tag: LocalWalletConfig
developmentOptions:
pabResumeFrom:
tag: PointAtGenesis
pabRollbackHistory: null
requestProcessingConfig:
requestProcessingInterval: 1
nodeServerConfig:
pscFeeConfig:
fcScriptsFeeFactor: 1
fcConstantFee:
getLovelace: 10
pscKeptBlocks: 2160
pscInitialTxWallets:
- getWallet: 1
- getWallet: 2
- getWallet: 3
pscPassphrase: null
pscNetworkId: ''
pscNodeMode: AlonzoNode
pscBaseUrl: http://localhost:9082
pscSocketPath: /var/cardano-system/node/node.sock
pscSlotConfig:
scSlotLength: 1000
scSlotZeroTime: 1506203091000
pscProtocolParametersJsonPath: null
which I just took from what the pab-cli generates, but I am not using the pab-cli.
When I run my pab with nix run (migrate followed by webserver), I get the following output:
[pab:Info:1] [2022-03-24 20:27:39.00 UTC] Connecting to Alonzo node with config:
Socket: /var/cardano-system/node/node.sock
Network Id: Mainnet
Port: 9082
Security Param: 2160
The tip of the local node: SlotNo 849952
[pab:Info:1] [2022-03-24 20:27:39.02 UTC] Restoring PAB state ...
[pab:Info:1] [2022-03-24 20:27:39.02 UTC] No contract instance were restored in the PAB state.
[pab:Info:1] [2022-03-24 20:27:39.02 UTC] Starting PAB backend server on port 9080
Current block: 14. Current slot: 13475
Current block: 14. Current slot: 13569
Current block: 20. Current slot: 17394
Current block: 32. Current slot: 21423
Current block: 58. Current slot: 22335
Current block: 4356. Current slot: 33119
Current block: 5254. Current slot: 34730
What is it doing with the blockchain here? It uses all the RAM and then collapses at some point. I'm already running the node and chain index separately. I'm just running the webserver.
Describe alternatives you've considered
No response
The PAB is currently not scalable to the size of the testnet (and mainnet). The reason is that we store the state of all transactions and transaction outputs in memory. Not good.
This data should be indexed by the chain-index instead, and not kept in memory in the PAB. Future enhancement.
@koslambrou could you link the relevant issue please?
@locallycompact consider using one of
https://github.com/CardanoSolutions/kupo
https://github.com/txpipe/oura
instead