-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
ListArtifacts API is slow, UI is timing out when accessing repositories with many artifacts #18598
Comments
Looking at the
The UI then dynamically loads additional information (tags, cosign signatures, immutable status, etc..) but AFAICT this is non blocking and is very quick to load I believe I was able to capture the queries for (1) & (2) above, and ran an I also played with this API and identified that it is slow only when
For reference, Query (1):
Execution time is very quick here. Then Query (2):
This is also executing very quickly. |
@dkulchinsky Hi, thanks for your digging, we have found the root cause is |
Thanks @chlins, I went over the other issue you mentioned and looks like the fix will be in v2.9? In the meantime, there was a possible workaround mentioned by cleaning up the task table, can you peovide more information about that? we're in a situation where people browsing through the UI are degradation the registry performance. |
Although cleaning up the task table can improve performance, it requires a large amount of data to be cleaned up. Cleaning up a small amount of data may not have a significant effect, so it is not recommended for users to clean up on their own unless they are certain that these tasks have no impact on Harbor, so there is no better workaround currently available. However, we will consider including the fix to the previous release patch version(e.g 2.7.x/2.8.x). |
@dkulchinsky Would you like to verify the changes in your environment? It achieved a good improvement in our testing environment. I can back port the fix to 2.7 and build a temporary package or image for your testing if you would. |
thanks @chlins, that would be great! |
Note: This is only a temporary way for testing, the image built based on the v2.7.1 with the above PR fix, so please do not adopt following steps if you are not v2.7.1 version which will affect the future normal upgrade. Backup your database if needed. The proper procedure is to wait for the official patch release in subsequent versions and upgrade. There are 2 steps needed:
|
that's awesome @chlins, I'm deploying it now to our sandbox Harbor and should have results shortly. |
@chlins very promising results! on repos with >100 tags, using the stock 2.7.1 core image load time is >2-3s, with the image you provided (and the added index), this is down to 300~500ms |
The issue has been resolved as of #18610. |
Thanks @chlins! could you confirm if the fix will be backported to 2.7? |
Sure, it will be backported to the patch release of 2.7 and 2.8. |
Expected behavior and actual behavior:
I believe this is a follow-up on #16839, which was closed but I'm not entirely sure what is the recommended solution and whether it was implemented in subsequent releases, so guidance would be greatly appreciated.
When accessing a repository in the Harbor UI, a response should be provided within a reasonable time and not timeout.
We noticed that when users are browsing repositories in the UI that have more than several hundreds tags, the UI will spin for a long time and in some cases will throw a 504 due to a timeout.
Our Harbor deployment is quite large, some figures:
DB counts (per the bits that was requested in the other issue):
When this happens, we are observing high CPU usage on the Database (as high as 8 out of 16 cores) and
ListArtifacts
(GET
) requests latency spikes >3 minutesBased on #16839 I understand there may be some indexes that should be added to improve the performance if the DB queries, my understanding is that these should be (based on this FAQ):
OTOH, I see that the first index already exists, however is
btree
type instead ofhash
, looking at the code it seems it was added in v2.6.0 but indeed has the defaultbtree
method:harbor/make/migrations/postgresql/0090_2.6.0_schema.up.sql
Line 20 in 7ace561
These are the indexes in the
artifact
table in our production deployment:should the index
idx_artifact_repository_name
be adjusted/re-created to behash
type? and should I add the other two indexes?Steps to reproduce the problem:
Populate a Harbor deployment with repositories that have many artifacts (tags) and observe slow UI when listing the repository.
Versions:
Please specify the versions of following systems.
Additional context:
N/A
The text was updated successfully, but these errors were encountered: