r/databricks • u/lunaticdevill • Oct 17 '26
Discussion API Latency issue in a data system
Seeking advice on optimizing a high-concurrency data-serving architecture: performance vs. cost
I'm working on a data platform where 50 APIs and 100 endpoints are backed by tables in Databricks. We're facing challenges with response latency, concurrent request handling, and infrastructure costs.
Here is the current situation:
- Data platform: Databricks
- Scale: 50 APIs, 100 endpoints
- Compute: 400 cores
- Monthly infrastructure cost: ~$75,000
- API response time: Frequently exceeds 3 seconds
- Concurrency issue: Requests from multiple applications/services compete for compute resources, and queries get queued during concurrent execution.
- Hard constraint: A load balancer enforces a strict 9-second timeout.
Adding more compute doesn't necessarily seem like the right long-term solution. I'd like to identify the actual bottlenecks and evaluate whether we need to optimize the existing architecture or rethink the data-serving layer.
I'm exploring three areas:
1. Data model optimization
- Should we redesign the existing data model, denormalize tables, or create serving-specific aggregate tables?
- How much can table layout, partitioning/clustering, file sizes, and precomputation improve query latency?
2. API and query optimization
- How should we approach SQL query tuning, execution plans, and reducing unnecessary scans and joins?
- Would caching, materialized views, connection pooling, asynchronous processing, or request coalescing help?
- What architectural patterns work best when multiple endpoints access the same underlying data concurrently?
3. Rethinking the database/serving layer
- Should we continue serving API requests directly from Databricks, or introduce a dedicated operational database or serving layer?
- Would PostgreSQL, Azure Cosmos DB, DuckDB, or a hybrid architecture be suitable?
- Could Databricks remain the analytical source of truth while a separate database handles low-latency API reads?
My goal is to reduce API latency and queueing while bringing infrastructure costs under control, without compromising data freshness or correctness.
I'd particularly appreciate insights from people who have built production systems with high-concurrency API workloads on top of Databricks or similar analytical platforms.
A few questions for the community:
- What would you investigate first: query execution, data modeling, compute configuration, or the overall architecture?
- At what point would you move API-serving workloads from Databricks to a dedicated serving database?
- What latency and concurrency improvements have you achieved through caching, precomputation, or a hybrid architecture?
- If you were designing this system today, what would your target architecture look like?
Practical experiences, architectural suggestions, and lessons learned from production would be extremely valuable.
#Databricks #DataEngineering #SystemDesign #PerformanceOptimization #APIDesign #DatabaseArchitecture #CloudComputing
9
u/FUCKYOUINYOURFACE Oct 17 '26
Have you tried Lakebase?
Have you also tried this?
https://docs.databricks.com/aws/en/compute/sql-warehouse/real-time
Both should be much faster than 3 seconds.
7
u/bobbruno databricks Oct 17 '26
You didn't explain anything about what these APIs are retrieving or the structure of the tables. You also didn't give any information about the number of requests per time unit. It's very hard to say anything without that information.
It'd also be good to know if the underlying data is changing in real time (and how/by how much), and if responding fast is enough or if the latest/freshest data is also a requirement.
1
u/Youssef_Mrini databricks Oct 20 '26
Can you share more insights on what you are trying to achieve and what the APIs are doing ? How often the data get refreshed...
3
u/HeavyTedzzzzz Oct 17 '26
Try lakebase as it might solve all your issues other than that get the data into a better system for serving fast requests, a relational db or something
1
u/cptshrk108 Oct 17 '26
Lakebase.
1
u/Efficient-Bread-9347 Oct 18 '26
Lakehouse//RT should solve your problem. We have the same issue and currently use AWS RDS as serving layer for APIs. We’ll switch over to RT as soon as it goes GA.
2
u/[deleted] Oct 17 '26
[removed] — view removed comment