My Poor CPU Performance #117

Closed
opened 2021-02-19 04:11:27 +00:00 by AlexVdberg · 4 comments
AlexVdberg commented 2021-02-19 04:11:27 +00:00 (Migrated from github.com)

Leaving the program running for a while starts to bog down my computer to the point of affecting other programs.
Each stage of the pipeline and the 10 packet processors all are their own threads that sit idle most of the time. Each is polling for its respective input queue.

Valgrind should help narrow the biggest sinks down.

To reproduce give the test.js a while loop condition that will never be met and then just wait for things to slow down.

Leaving the program running for a while starts to bog down my computer to the point of affecting other programs. Each stage of the pipeline and the 10 packet processors all are their own threads that sit idle most of the time. Each is polling for its respective input queue. Valgrind should help narrow the biggest sinks down. To reproduce give the test.js a while loop condition that will never be met and then just wait for things to slow down.
AlexVdberg commented 2021-02-19 04:19:02 +00:00 (Migrated from github.com)

Reviewing the code, I had packet processors commented out while testing, so that only leaves the pipeline threads and the tight polling loop from js. Not sure how to add a delay into the js to make it less tight polling.

Reviewing the code, I had packet processors commented out while testing, so that only leaves the pipeline threads and the tight polling loop from js. Not sure how to add a delay into the js to make it less tight polling.
AlexVdberg commented 2021-02-19 15:22:57 +00:00 (Migrated from github.com)

CPU utilization is very high. There are 10 threads, one is consuming ~115% CPU utilization. The rest are all below 10%.

Memory usage steadily climbs, so we got massive memory leaks somewhere.

CPU utilization is very high. There are 10 threads, one is consuming ~115% CPU utilization. The rest are all below 10%. Memory usage steadily climbs, so we got massive memory leaks somewhere.
AlexVdberg commented 2021-02-19 15:35:46 +00:00 (Migrated from github.com)

Memory leakage is coming from repeated calls to GetData() by js. Likely because each call to GetData() calls malloc to create a packet to give js. Packets are only 6 bytes, but add up over time.

We need to find a way to have js explicitly release the packet. assigning a new value to the variable holding the array buffer doesn't seem to run the callback to free the memory, so it needs to be done more explicitly.

Memory leakage is coming from repeated calls to GetData() by js. Likely because each call to GetData() calls malloc to create a packet to give js. Packets are only 6 bytes, but add up over time. We need to find a way to have js explicitly release the packet. assigning a new value to the variable holding the array buffer doesn't seem to run the callback to free the memory, so it needs to be done more explicitly.
AlexVdberg commented 2021-03-11 01:45:14 +00:00 (Migrated from github.com)

Ditching N-Api fixed this

Ditching N-Api fixed this
Sign in to join this conversation.
No description provided.