Deletion of (large) projects takes too long #636
Labels
component/api-server
defect
Something isn't working
p3
Nice-to-have features
performance
size/M
Medium effort
When deleting a project via REST API, the API server will all related objects, and finally the project itself.
https://github.com/DependencyTrack/hyades-apiserver/blob/afe74d8f89a57a0c1c1f373ede45abf2f25eb64e/src/main/java/org/dependencytrack/persistence/ProjectQueryManager.java#L685-L714
Behind the scenes, the deletion happens via DataNucleus'
deletePersistent
ordeletePersistentAll
methods.In order for DN to maintain its in-memory representation of the database, execute any query hooks etc., these methods will first fetch the objects before issuing a
DELETE
query to the database. Not only is this wasteful in terms of resources, it also causes the deletion of large projects to take very long. We've been seeing duration in the minute range.We should investigate on using DataNucleus' Bulk Delete queries instead, which immediately issue a
DELETE
query to the database.Similar to #635, it would be even better if the entire deletion would be transactional, so we're not leaving behind broken data in case of a failure mid-way.
The text was updated successfully, but these errors were encountered: