[Ethereum] How to configure max txpool memory size

txpool

What is the default txpool memory size in geth? How can I change the txpool memory size?

According to What is the max size of transactions can clients like geth keep in txpool?, "The number of transactions in the pending transaction pool is effectively limited by memory." I wonder what the default setting is and how to change it.

Best Answer

Geth

The default config values associated with the transaction pool can now be changed from Geth's CLI:

TRANSACTION POOL OPTIONS:
  --txpool.pricelimit value    Minimum gas price limit to enforce for acceptance into the pool (
default: 1)
  --txpool.pricebump value     Price bump percentage to replace an already existing transaction (default: 10)
  --txpool.accountslots value  Minimum number of executable transaction slots guaranteed per account (default: 16)
  --txpool.globalslots value   Maximum number of executable transaction slots for all accounts (default: 4096)
  --txpool.accountqueue value  Maximum number of non-executable transaction slots permitted per account (default: 64)
  --txpool.globalqueue value   Maximum number of non-executable transaction slots for all accounts (default: 1024)
  --txpool.lifetime value      Maximum amount of time non-executable transaction are queued (default: 3h0m0s)

While this doesn't allow you to limit exactly how much memory is used, increasing, for example, accountslots or globalslots will lead to an increase in used memory, and vice versa.


Parity

Similarly, Parity has the following CLI option:

 --tx-queue-size LIMIT          Maximum amount of transactions in the queue (waiting
                                 to be included in next block) (default: 1024).