Skip to content

Commit

Permalink
Merge pull request #260 from oasisprotocol/yawning/feature/252
Browse files Browse the repository at this point in the history
feat(indexer): Improve cache memory efficiency
  • Loading branch information
Yawning committed Apr 13, 2022
2 parents e1ee3c9 + 342ea05 commit 7468b46
Show file tree
Hide file tree
Showing 9 changed files with 250 additions and 195 deletions.
4 changes: 0 additions & 4 deletions conf/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,6 @@ func (cfg *LogConfig) Validate() error {
type CacheConfig struct {
// BlockSize is the size of the block cache in BLOCKS.
BlockSize uint64 `koanf:"block_size"`
// TxSize is the size of the transaction cache in bytes.
TxSize uint64 `koanf:"tx_size"`
// TxReceiptSize is the size of the transaction receipt cache in bytes.
TxReceiptSize uint64 `koanf:"tx_receipt_size"`
// Metrics enables the cache metrics collection.
Metrics bool `koanf:"metrics"`
}
Expand Down
2 changes: 0 additions & 2 deletions conf/server.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ log:

cache:
block_size: 1024
tx_size: 1073741824
tx_receipt_size: 1073741824
metrics: false

database:
Expand Down
2 changes: 0 additions & 2 deletions conf/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ log:

cache:
block_size: 10
tx_size: 10485760
tx_receipt_size: 10485760
metrics: true

database:
Expand Down
3 changes: 0 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ module github.com/oasisprotocol/emerald-web3-gateway
go 1.17

require (
github.com/dgraph-io/ristretto v0.1.0
github.com/ethereum/go-ethereum v1.10.10-0.20211005163353-57ff2dee06a1
github.com/fxamacker/cbor/v2 v2.4.0
github.com/gorilla/mux v1.8.0
Expand Down Expand Up @@ -32,7 +31,6 @@ require (
github.com/cespare/xxhash/v2 v2.1.2 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/deckarep/golang-set v0.0.0-20180603214616-504e848d77ea // indirect
github.com/dustin/go-humanize v1.0.0 // indirect
github.com/eapache/channels v1.1.0 // indirect
github.com/eapache/queue v1.1.0 // indirect
github.com/fatih/color v1.13.0 // indirect
Expand All @@ -41,7 +39,6 @@ require (
github.com/go-logfmt/logfmt v0.5.1 // indirect
github.com/go-ole/go-ole v1.2.1 // indirect
github.com/go-stack/stack v1.8.0 // indirect
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/golang/snappy v0.0.4 // indirect
github.com/hashicorp/go-hclog v1.1.0 // indirect
Expand Down
1 change: 0 additions & 1 deletion go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,6 @@ github.com/dgraph-io/ristretto v0.1.0 h1:Jv3CGQHp9OjuMBSne1485aDpUkTKEcUqF+jm/Lu
github.com/dgraph-io/ristretto v0.1.0/go.mod h1:fux0lOrBhrVCJd3lcTHsIJhq1T2rokOu6v9Vcb3Q9ug=
github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ=
github.com/dgryski/go-bitstream v0.0.0-20180413035011-3522498ce2c8/go.mod h1:VMaSuZ+SZcx/wljOQKvp5srsbCiKDEb6K2wC4+PiBmQ=
github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2 h1:tdlZCpZ/P9DhczCTSixgIKmwPv6+wP5DGjqLYw5SUiA=
github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw=
github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no=
github.com/dlclark/regexp2 v1.2.0/go.mod h1:2pZnwuY/m+8K6iRw6wQdMtk+rH5tNGR1i55kozfMjCc=
Expand Down
5 changes: 3 additions & 2 deletions indexer/backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,9 @@ type Backend interface {

// BlockData contains all per block indexed data.
type BlockData struct {
Block *model.Block
Receipts []*model.Receipt
Block *model.Block
Receipts []*model.Receipt
UniqueTxes []*model.Transaction
// LastTransactionPrice is the price of the last transaction in the runtime block in base units.
// This can be different than the price of the last transaction in the `BlockData.Block`
// as `BlockData.Block` contains only EVM transactions.
Expand Down

0 comments on commit 7468b46

Please sign in to comment.