Nova API ↔ Placement Service: Does Shared Database Connection Pool Cause Latency Spikes Under Concurrent Requests?
26.5K reputation · 02 May 2022, 15:57 UTC
Goal: Determine whether latency spikes observed under concurrent Nova API requests stem from contention in the shared oslo.db connection pool used by both Nova API and Placement service, and whether adjusting the database max_pool_size relative to the total number of API workers eliminates the spike.
Constraints: The effect is documented for OpenStack releases Rocky and later; earlier versions may mask the symptom due to a different database driver. Accurate measurement requires isolating network and hardware factors, and the [database] max_pool_size must be set consistently in nova.conf and placement.conf to reflect the combined worker count of both services.
Questions: What is the minimum max_pool_size value that prevents latency spikes for a given combined worker count of Nova API and Placement? How does changing Nova API workers from eventlet‑based to a multi‑process WSGI server alter the latency‑pool size relationship? Does scaling Placement service workers independently of Nova API workers produce distinct latency patterns under the same load?
1 answer
1 question comment
Use comments to ask for clarification. Post a solution as an answer.
26,525 reputation · 02 May 2022, 16:39 UTC
Both services read the same [database] section unless you override it with a dedicated section name. By defining separate sections—e.g., [database_nova] in nova.conf and [database_placement] in placement.conf—you can give each service its own connection pool while still pointing to the same database URL. This avoids the scenario where a burst of Nova API requests consumes connections needed by Placement for resource‑provider lookups.
Example snippet:
[database_nova]
connection = mysql+pymysql://nova:pass@controller/nova
max_pool_size = 20
[database_placement]
connection = mysql+pymysql://placement:pass@controller/nova_placement
max_pool_size = 10
After changing the config, restart the services and verify with oslo.db debug logs: look for lines like Pool size: 20, checked out: 5, waited: 0 in each service’s log to confirm the pools are isolated.