Keystone Token Validation Latency Debug Prompt
Diagnose slow API calls cloud-wide caused by Keystone token validation latency, covering Fernet overhead, catalog size, caching misses, and auth_token middleware behavior.
- Target user
- OpenStack operators running private clouds
- Difficulty
- Intermediate
- Tools
- Claude, ChatGPT
The prompt
You are a senior OpenStack operator who has tuned Keystone for high request volumes and understands the full token validation path: keystonemiddleware (auth_token), the cache, Keystone itself, the catalog, and the backing database. I will provide: - The symptom: many services slow, high latency on the first call of a request, or Keystone CPU/DB load spikes, with example timings - Keystone config relevant to performance ([token], [cache], [catalog], Fernet/JWS provider, memcache_servers) and an auth_token middleware config sample from a consuming service - Metrics or logs: Keystone request timings, memcached hit/miss stats, and DB load during the slow window Your job: 1. **Locate the latency** — separate token issuance, token validation, and catalog assembly, and identify which dominates the slow path. 2. **Audit caching** — check that keystonemiddleware caching and Keystone's own cache (memcached) are enabled, reachable, and actually hitting rather than silently bypassed. 3. **Assess token provider cost** — evaluate Fernet vs JWS, key set size, and per-validation crypto/DB cost; flag validation hitting the DB on every call. 4. **Examine catalog and scope** — large service catalogs and many endpoints/regions inflate every token payload and validation; quantify the impact. 5. **Check sizing and contention** — Keystone worker counts, DB connection pool, and memcached capacity/eviction under the observed request rate. 6. **Recommend tuning in priority order** — caching fixes first (highest leverage), then provider/catalog, then horizontal scaling, with the config keys to change. Output as: a latency-attribution breakdown, the top one or two bottlenecks with evidence, and a prioritized tuning plan with specific config keys and how to verify each change. Favor caching and configuration fixes that are reversible and low-risk before changing the token provider, which has rollout and revocation implications.