Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option for on-demand scan instead of daemon #41

Open
johanehnberg opened this issue Apr 26, 2021 · 2 comments
Open

Add option for on-demand scan instead of daemon #41

johanehnberg opened this issue Apr 26, 2021 · 2 comments

Comments

@johanehnberg
Copy link

Feature request:

Since the validation is an on-demand function, there is little value in using the daemon.

Calling clamav on instead on-demand follows a more coherent architecture.

This would reduce the idle memory footprint by ~250MB per instance for monolithic apps.

@sunspikes
Copy link
Owner

Very nice idea to improve the memory footprint, but not sure how it will be performance wise using the clamscan directly vs the clamd daemon, but nice to have this option, it would be nice if you can create a PR or i will look into it soon. Thank you!

@johanehnberg
Copy link
Author

I benchmarked the difference with a very small file. The time and cpu overhead per file is about 300x (30000%). With 17 seconds of waiting, anything done synchronously on the UI would not make for an acceptable UX with the on-demand scan. This approach would make sense for independent and processes on the backend with lower volumes.

$ time clamdscan model.txt 
/home/ubuntu/model.txt: OK

----------- SCAN SUMMARY -----------
Infected files: 0
Time: 0.037 sec (0 m 0 s)
Start Date: 2021:06:03 12:35:37
End Date:   2021:06:03 12:35:37

real	0m0.056s
user	0m0.006s
sys	0m0.005s

$ time clamscan model.txt 
/home/ubuntu/model.txt: OK

----------- SCAN SUMMARY -----------
Known viruses: 8535428
Engine version: 0.103.2
Scanned directories: 0
Scanned files: 1
Infected files: 0
Data scanned: 0.06 MB
Data read: 0.03 MB (ratio 2.00:1)
Time: 17.552 sec (0 m 17 s)
Start Date: 2021:06:03 12:35:17
End Date:   2021:06:03 12:35:34

real	0m17.563s
user	0m16.749s
sys	0m0.813s

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants