Closed machacd closed 3 years ago
I'm not sure this is a bug - I see no evidence here that there is a bug in cryptofeed, its more likely your setup cant handle the volume of writes to postgres. you might want to consider caching/batching the writes, or having a 2nd process handle the writes
Im writing to a postgres database too, and I have seen both the collector and the pg process piling up because individual writes have WAAAYY to much overhead.
https://github.com/bmoscon/cryptofeed/pull/339 for caching and writing in batches.
Thank you @qinghuangchan, I am trying your branch now. What order of magnitude of writes are you talking about, when you observe piling? In my case, I write about 50 records per second
I have tried it out @qinghuangchan , with different batch sizes from 5 to 40. It seems to work quite well, but it unfortunately does not resolve my issue, the CPU usage still climbs after a while.
I see that you are subscribed to trades and l2 book, which should be pretty noisy channels.. I have mine set at 1000 for exchanges that I seem to be less noisy, and 10000 for exchanges that are more noisy.
Describe the bug When I start Cryptofeed, it consumes very little resources (say 10-13% CPU on a single core), however, after few hours, it goes up to 30-50% and plateaus there. If I restart it, it is low again.
To Reproduce I am using the following feeds:
with
Operating System: Ubuntu 18.04
Cryptofeed Version 1.61