salesforce / p4-fusion

A fast Perforce to Git conversion tool written in C++ using Perforce Helix Core C++ API and Libgit2
BSD 3-Clause "New" or "Revised" License
78 stars 15 forks source link

Improve thread affinity at high thread count #42

Open twarit-waikar opened 2 years ago

twarit-waikar commented 2 years ago

At high thread counts (over 500 or so), the CPU starts to get swamped with p4 calls, and it tends to starve the commit thread and causes it to not get any CPU time at all.

This means p4-fusion downloads all the files at first but it is really slow to digest those files and write them out into the repository while creating a commit. This essentially hangs the process.

High threads counts may even start losing connections because they were left idle for too long and so the Perforce server closed those connections.

p4-fusion should be smarter by giving more affinity to the commit thread and also, manage connections in a way that they are not closed off due to idle time. This means a new threadpool dispatch algorithm might be required.