Yum hosted repository time to update repository

Hello,

Since we migrate from Nexus 2 to Nexus 3, the time between an rpm upload and a client download has increased. For example, between the upload of an RPM in a yum hosted repo and the moment it becomes available (yum install on a client) is around 5s to 10s… How can we improve this duration ?

Thanks

Hello,
For your specific example, by default NXRM3 rebuilds the yum metadata 60 seconds after the last successful upload to the hosted repository.
We do have a system property that causes this to occur at a defined interval but I am curious to your use case. If you are expecting 5-10 second turnaround, it is unlikely this property will help you because it actually takes time for the metadata to rebuild, especially if you are pushing a large number of components at once.
Similarly curious what pains this is causing you. You have a CI that’s pushing and 5 seconds later requesting what was just pushed?
Thanks,
Joe

Hello,
Yes we have a CI that upload and then deploy immediately the software to our customers around the world. Is it possible to change this property ?

It is. Configure nexus.yum.createrepo.interval in the nexus.properties file (in $data-dir) setting it equal to a time in milliseconds.
Again I caution you from setting it too low, this could cause performance issues. If you notice any dips in performance this is probably the first thing you should revert and see if it improves.

You can monitor your nexus.log (or could even look now to determine if this’ll help) by looking for regenerate statements like:
INFO [event- 11 -thread- 10 ] admin org.sonatype.nexus.repository.yum.internal.createrepo.CreateRepoFacetImpl - Rebuilding yum metadata for repository yum-hosted

You’ll need to wait for them to complete before things are available for your CI. You’ll also (obviously?) need to wait for them to kickoff=)

Hope that helps,
Joe

Hi, aside from monitoring the nexus.log, is there any other way to determine when the yum metadata is rebuilt? Is there an API call that can be used to check? Otherwise, is the best way to simply compare the metadata every 60 seconds to see if it has changed? Thanks!

1 Like

@david.lin I would have to check (probably won’t have time today) but if the metadata asset can be viewed in the UI (which would tell last updated and I believe it can) you should be able to make a REST call for it. Subsequently I cannot rememeber if it returns last updated in the results. But if you want to try, you should be able to see.
-Joe

I did finally check this and indeed you can use the /v1/assets/{id} API to check your metadata including lastModified date. You’ll need to figure out the id of the file by using the /v1/assets API.

Will show as below:
{
“downloadUrl”: “http://localhost:8081/repository/yum-initial/repodata/repomd.xml”,
“path”: “repodata/repomd.xml”,
“id”: “eXVtLWluaXRpYWw6MmI3ZTgwMGNhNGYzZGJhYzBmYjZiODFlZGZmODIwMWM”,
“repository”: “yum-initial”,
“format”: “yum”,
“checksum”: {
“sha1”: “21f27980dd6fb1915a47940eaed47ec9b5243b23”,
“sha512”: “1fde6e2ab56bc88a6aa2f5e33e02e7cabf5b750f5cd9de167bb4b742805ff44c4c17be512b3bc607134a6b063c5279b752e642273889747b3290056d183b7c78”,
“sha256”: “8f291fafa63ef605e418adc4a57d95b6c4b7c1c69e4b71b0505c8f43a157ec36”,
“md5”: “9d4f7ed7bbe995e04b63302119d75ec0”
},
“contentType”: “application/xml”,
“lastModified”: “2021-09-25T19:06:00.378+00:00”,
“blobCreated”: “2021-09-25T19:00:08.885+00:00”,
“lastDownloaded”: null
}

This check was done in OrientDB. If you’re using the new database options (H2 or PostgreSQL) it may be slightly different but I still believe possible.