Uploaded image for project: 'Lustre'
  1. Lustre
  2. LU-20207

llapi_project_get() should cache /etc/projid contents for repeated lookups

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • Medium
    • None
    • None
    • 3
    • 9223372036854775807

    Description

      llapi_project_get()  iterates through the /etc/projid file every time a project id is resolved to a project name to project id or vice versa.

      llapi_projid_get() should read the /etc/projid file once build an in-memory cache for the name<->projid mappings, so that repeated llapi_project_getnam() and llapi_project_getprjid() calls can avoid re-scanning the list multiple times. It would also make sense to cache the last PROJID-to-PROJNAME mapping in ll_project_handle to avoid any lookup in the common case of repeated lookup of the same NAME/ID.

      If implementation time is a concern, a linear array search would be an acceptable starting point, and still far better than opening and re-reading the file multiple times. Ideally, this would implement a hash table to efficiently look up PROJID and PROJNAME entries, as a large system may have tens of thousands or potentially even millions of projids (eg. if a new project is being automatically created for each Kubernetes container/user or similar).

      Attachments

        Issue Links

          Activity

            People

              wc-triage WC Triage
              abooback Vadakkumuri Valappil Abooback
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated: