-
InfluxDB
Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.
I needed a memory efficient, performant and go-routine-safe queue ie FIFO data structure. To try not to reinvent the wheel I went on google in search of one. After a minute or two I found a slice based one and it served me well until I ran into one issue. When the queue was filled with millions of items and then emptied, I noticed that the memory allocation didn't decrease. So I tried to force GC but that didn't work. After more research and testing I could not reduce existing slice memory allocation without allocating new slice and copy any data remaining in the old one. That was not acceptable for a heavy trafficked queue. It cannot pause all reads and writes to wait for memory shuffling. So I went back on google and found this peace of code. Then I was like "Oh yea I know this from my CS class - a simple Singly Linked List. Haven't had a need to implement one since then."
If you can use Go tip, there’s https://github.com/carlmjohnson/deque
I meant something like https://github.com/nikandfor/fifo/blob/master/fifo.go