helium / router

router combines a LoRaWAN Network Server with an API for console, and provides a proxy to the Helium blockchain
Apache License 2.0
69 stars 32 forks source link

ets table per devaddr #1009

Closed michaeldjeffrey closed 1 year ago

michaeldjeffrey commented 1 year ago

inserting devices into a ets bad where the whole object needs to be unique slows down severely as the table grows but the keys do not grow with the table. Inserting 250k devices spread across 32 devaddrs was approaching 5 minutes.

making a table per devaddr introduces a bit of indirection, but ets sets are fast, and device ids are unique.

michaeldjeffrey commented 1 year ago

250k devices across 8 devaddrs takes ~8s to rehydrate locally.

macpie commented 1 year ago

Should we only insert device_id in there? I would save memory and maybe avoid out of sync?