arachnys / athenapdf

Drop-in replacement for wkhtmltopdf built on Go, Electron and Docker
MIT License
2.26k stars 186 forks source link

[Weaver] Can I restart weaver container without affecting ongoing conversion? #196

Closed piotrekkr closed 5 years ago

piotrekkr commented 5 years ago

I have question regarding weaver.

I wrote some python script to check if sample conversion (hello world html, one page) works on weaver containers and after few days of running it every few minutes weaver containers take about 2-2.5GiB of memory:

$ docker stats
CONTAINER ID        NAME                 CPU %               MEM USAGE / LIMIT     MEM %               NET I/O             BLOCK I/O           PIDS
de97db55d3df        gzl_athenapdf_07_1   0.00%               2.19GiB / 31.41GiB    6.97%               313MB / 287MB       1.36MB / 197kB      35
2724eabc9232        gzl_athenapdf_05_1   0.00%               2.65GiB / 31.41GiB    8.44%               313MB / 288MB       1.27MB / 197kB      34

Most of the time containers are idle (no cpu usage). I could set memory limits but sometimes there is a need to use so much ram for big file conversions. However most of the time containers should take like 100-200 MiB of RAM. So I plan to restart containers from time to time if they are idle and take too much memory. And my question is:

Is it possible to schedule container restart so it will not kill ongoing conversions inside container but restart after last conversion in queue? Or some other way to release memory taken by weaver container? Some custom signal to send to container or command to run inside container?

piotrekkr commented 5 years ago

Nevermind. Weaver releases some memory when host memory is getting low. Like from 30GB free to 4GB and in next bigger workload release some memory and it's back to like 30GB free. It seems that there is no need to restart containers when they are getting big.