etcd uses in-memory secondary index (using google btree). actual data is stored in bbolt db with revision as key and user provided key, value pairs as data.
since entire index is in memory, your etcd's memory consumption is directly co-related to number of keys.
If db engines line RocksDB and Badger for persistence (these are LSM based, not btree), and save user key as db key, then you can control memory used by DB with number of memtables configured.
However, read performance would be little less, as per Badger bench read perf difference was not significant when SSD is used for storage.