3 ms·
I recently just made what I think is a pretty neat pattern for reporting on a project that we need time series data calculations for. Essentially I already hav
by programminggeek 12y ago
I recently just made what I think is a pretty neat pattern for reporting on a project that we need time series data calculations for.
Essentially I already have a giant precalculation service for all the needed calculations on all the data underneath a parent entity. So, I serialize that using ruby marshall and then use lz4 to compress it before storing to db.
Its actually faster and smaller than using json strings in ruby. The whole tree structure for each entity was 200-400k as raw json strings. It took something like 300ms to serialize to json. I was able to do the ruby marshal and the LZ4 HC compression in something like 20-40ms and it drops the size down to more like 15-30k.
JSON is a pretty cool format, but it's a lot slower in ruby than you might realize and it takes up a lot of space.
- yeukhon 12y agoInteresting. I just deleted two tables from my project instead of spreading the data into two tables I thought storing a "data" json column (I am a PSQL user) would be better (fewer queries to make and more space efficent). I didn't think about the size before compression. Meanwhile, this serves well for Python: https://groups.google.com/forum/#!topic/google-appengine/WPfAvHDGNjQ https://groups.google.com/forum/#!topic/google-appengine/WPf... I shall go ahead and write some tests to see how much space will be taken up :)