You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@unomi.apache.org by "Serge Huber (Jira)" <ji...@apache.org> on 2026/10/21 17:25:00 UTC

[jira] [Created] (UNOMI-1016) Speed up looking up a tenant by its API key

Serge Huber created UNOMI-1016:
----------------------------------

             Summary: Speed up looking up a tenant by its API key
                 Key: UNOMI-1016
                 URL: https://issues.apache.org/jira/browse/UNOMI-1016
             Project: Apache Unomi
          Issue Type: Improvement
            Reporter: Serge Huber
             Fix For: unomi-4.1.0


h3. Summary

On each public request that carries an API key, Unomi finds the matching tenant by loading every tenant from storage and checking their keys one by one. On a server with many tenants, that work repeats on every such request and can become a large share of the cost of serving public traffic.

The goal of this ticket is to make tenant lookup by API key cheaper, so public requests do not pay for a full scan of all tenants each time.

This is separate from the per-tenant website origin work (UNOMI-1013). It is about the shared cost of resolving which tenant owns a key.

h3. Ways to explore
* Keep an in-memory map from key to tenant, refreshed when tenants are created, updated, or removed.
* Store a durable index that can resolve a key without loading every tenant document.
* Measure the cost with a realistic number of tenants so the change can be checked under load.

h3. How to test
* Unit and integration tests that resolve a tenant by public and private key still pass.
* With many tenants, looking up a key no longer loads every tenant from storage on each call.
* Creating, updating, or deleting a tenant still makes the new keys work and the old keys stop working.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)