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

High CPU% after around 10k objects detected (Jetson Nano) #263

Closed
effort10 opened this issue Aug 19, 2020 · 6 comments
Closed

High CPU% after around 10k objects detected (Jetson Nano) #263

effort10 opened this issue Aug 19, 2020 · 6 comments
Assignees
Milestone

Comments

@effort10
Copy link

Hi All,
Screenshot 2020-08-19 at 09 25 05
Screenshot 2020-08-19 at 13 21 51

Im experiencing a strange problem using Opendatacam without docker on a jetson nano. ( I am using yolov3-tiny-prn as the weight and i am passing a video feed via a usb camera)

When I start the recording my cpu % is around 25%
After 10k objects have been counted the cpu hits around 95% and the nano starts becoming slightly unresponsive.

The recording carries on but the opendatacam log starts showing the following error (Error with message send by YOLO, not valid JSON)
I am not sure what is happening but it looks like its got something to do with Mongo.

Please have a look at the screenshots that i have provided. Any help will be greatly appreciated.

@effort10
Copy link
Author

Or maybe i just need stronger hardware, maybe a Jetson TX2

@tdurand
Copy link
Member

tdurand commented Sep 8, 2020

Thanks for reporting this.. very possible we are doing something not optimized with mongodb that makes things not performant...

One of the many issue that would need to be investigated to turn OpenDataCam from a prototype to a real reliable product ;-)

@tdurand tdurand closed this as completed May 22, 2021
@tdurand tdurand reopened this May 22, 2021
@tdurand
Copy link
Member

tdurand commented May 22, 2021

Adding this to the OpenDataCam v4 release backlog to remind to at least do a long run try and see if CPU usage is not exploding

@tdurand tdurand added this to the OpenDataCam v4 milestone May 22, 2021
@tdurand tdurand added this to To do in v4.0.0 May 22, 2021
@vsaw vsaw moved this from To do to In progress in v4.0.0 Feb 14, 2022
@vsaw vsaw self-assigned this Feb 14, 2022
@vsaw
Copy link
Collaborator

vsaw commented Feb 14, 2022

I've been running some benchmarks on my development machine.

Counter Tracker NodeJS CPU [%] NodeJS Memory [mb] MongoDB CPU [%] MongoDB Memory [mb]
1799 5365 9.0 105.1 9.7 94
2078 6180 8.8 105.2 10.5 98.3
2447 7285 8.9 105.9 12.4 103.4
2848 8459 9.4 106.3 11.4 104.2
3178 9436 11.9 106.4 11.1 106.1
3709 11014 10.5 89.3 ▵ 12.6 113.7
4027 11967 12.1 104.5 12.8 113.5

Looking at the data it does seem that there is a memory leak in NodeJS and MongoDB, which may also explain the increase in CPU usage. Please note that I do not have a NVIDIA GPU available and therefore was not able to profile Darknet, but only Node and MongoDB.

I suspect it it has the following sources:

  1. The entire counter history is kept in RAM.
  2. The entire counter history is stored in a single MongoDB document which gets updated on every frame.

Fixing both could potentially decrease the memory leaks and CPU usage.

Footnotes:
▵ Expected Garbage collection happened or something like that.

@vsaw vsaw mentioned this issue Feb 14, 2022
@vsaw
Copy link
Collaborator

vsaw commented Feb 28, 2022

While working on #528

I noticed that there is another memory leak coming from the node moving things tacker. A short analysis shows that the itemHistory and map of tracked is growing a lot (up to 200 kb/s)! Will need further investigation, though

@vsaw
Copy link
Collaborator

vsaw commented Mar 1, 2022

Closed via #528

@vsaw vsaw closed this as completed Mar 1, 2022
v4.0.0 automation moved this from In progress to Done Mar 1, 2022
@vsaw vsaw removed this from Done in v4.0.0 Jun 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

No branches or pull requests

3 participants