OpenMetadata icon indicating copy to clipboard operation
OpenMetadata copied to clipboard

[BUG][Performance Issue] PATCH /api/v1/tables/{id} extremely slow (49–99s) during Database Service ingestion workflow

Open khoaihps opened this issue 8 months ago • 3 comments

Affected module Backend + Ingestion Framework (Sink.Patch operations)

Describe the bug *I will attached the full log below

open-metadata-5cbd99c795-pk56h.log

When running a Database Service ingestion workflow, PATCH /api/v1/tables/{id} API calls become extremely slow (observed: 49–99 seconds per request), causing the overall workflow to degrade significantly.

The slow request warning from the server shows that nearly all time is spent in "internal" processing — not database or search I/O:

WARN [2026-03-22 10:38:10,057] [dw-35304 - PATCH /api/v1/tables/3785924b-9e87-41a7-ba2f-547aeda02e89] o.o.s.m.RequestLatencyContext - Slow request detected - endpoint: v1/tables/3785924b-9e87-41a7-ba2f-547aeda02e89, total: 94243ms, db: 31ms (0%), search: 846ms (0%), internal: 93366ms (99%), dbOps: 113, searchOps: 1
...
WARN [2026-03-22 10:39:49,231] [dw-35136 - PATCH /api/v1/tables/7e63e8e2-4caf-48f2-ba12-eeb8a0b2a734] o.o.s.m.RequestLatencyContext - Slow request detected - endpoint: v1/tables/7e63e8e2-4caf-48f2-ba12-eeb8a0b2a734, total: 97759ms, db: 29ms (0%), search: 856ms (0%), internal: 96873ms (99%), dbOps: 96, searchOps: 1

Additionally, for the same PATCH request (same thread, same table ID), the following log line appears twice, each time reporting 13,275 documents updated in OpenSearch:

Successfully deleted columns from upstream lineage for index: all, updated: 13275                                                                                                                                                                                                                                
...
Successfully deleted columns from upstream lineage for index: all, updated: 13275                                                                                                                                                                                                                                

This suggests a lineage-related OpenSearch operation is being triggered multiple times within a single PATCH request. And it is also suspicious that a single PATCH request require operation all 13275 docs.

To Reproduce

  1. Have a Database Service, for me, it contains around 1k3+ tables and 700+ lineages
  2. Run the ingestion workflow, or simply a PATCH request on a table having lineage
  3. Observe PATCH /api/v1/tables/{id} response times

Expected behavior PATCH /api/v1/tables/{id} should complete in a reasonable time (< a few seconds). Lineage-related cleanup should not cause 90+ second delays per table.

Version:

  • OpenMetadata version: 1.12.1

Additional context The issue only occurs after several lineages is added to the Database Service. Before that, the pipeline run in few minues:

+------------------------+------------------+--------------+---------------+---------------+------------------+
| Context                |       Total Time |   Call Count |      Avg Time |      Min Time |         Max Time |
| +========================+==================+==============+===============+===============+==================+
| GET                    |         14.947ms |            3 |       4.982ms |       2.178ms |          6.398ms |
| +------------------------+------------------+--------------+---------------+---------------+------------------+
| PUT                    |         25.682ms |            1 |      25.682ms |      25.682ms |         25.682ms |
| +------------------------+------------------+--------------+---------------+---------------+------------------+
| Sink                   |     7s 305.118ms |            5 |  1s 461.024ms |       0.154ms |     7s 200.083ms |
| +------------------------+------------------+--------------+---------------+---------------+------------------+
| Sink.PATCH             |     7s 296.221ms |            2 |  3s 648.111ms |      98.831ms |     7s 197.391ms |
| +------------------------+------------------+--------------+---------------+---------------+------------------+
| Source                 | 5m 43s 787.067ms |            6 | 57s 297.844ms | 15s 286.727ms | 3m 09s 149.695ms |
| +------------------------+------------------+--------------+---------------+---------------+------------------+
| Source.GET             | 1m 17s 333.000ms |         4241 |      18.235ms |       1.642ms |        716.396ms |
| +------------------------+------------------+--------------+---------------+---------------+------------------+
| Source.register_record |         59.720ms |         1862 |       0.032ms |       0.019ms |          0.235ms |
| +------------------------+------------------+--------------+---------------+---------------+------------------+

After adding 700+ lineage to the Database, it turns out over 3 hours of processing time:

+------------------------+------------------+--------------+---------------+---------------+------------------+
| Context                |       Total Time |   Call Count |      Avg Time |      Min Time |         Max Time |
+========================+==================+==============+===============+===============+==================+
| GET                    |         14.947ms |            3 |       4.982ms |       2.178ms |          6.398ms |
+------------------------+------------------+--------------+---------------+---------------+------------------+
| PUT                    |         25.682ms |            1 |      25.682ms |      25.682ms |         25.682ms |
+------------------------+------------------+--------------+---------------+---------------+------------------+
| Sink                   |     7s 305.118ms |            5 |  1s 461.024ms |       0.154ms |     7s 200.083ms |
+------------------------+------------------+--------------+---------------+---------------+------------------+
| Sink.PATCH             |     7s 296.221ms |            2 |  3s 648.111ms |      98.831ms |     7s 197.391ms |
+------------------------+------------------+--------------+---------------+---------------+------------------+
| Source                 | 5m 43s 787.067ms |            6 | 57s 297.844ms | 15s 286.727ms | 3m 09s 149.695ms |
+------------------------+------------------+--------------+---------------+---------------+------------------+
| Source.GET             | 1m 17s 333.000ms |         4241 |      18.235ms |       1.642ms |        716.396ms |
+------------------------+------------------+--------------+---------------+---------------+------------------+
| Source.register_record |         59.720ms |         1862 |       0.032ms |       0.019ms |          0.235ms |
+------------------------+------------------+--------------+---------------+---------------+------------------+

khoaihps avatar Mar 22 '26 11:03 khoaihps

Hi, I’m interested in this issue and have created a PR.

@khoaihps Could you please help test the performance using my branch if possible?

kojikokojiko avatar Mar 23 '26 17:03 kojikokojiko

@khoaihps

@kojikokojiko there are quite bit of changes went into main branch. Can you try running the test with latest main

harshach avatar Mar 23 '26 18:03 harshach

@harshach I have just created a PR https://github.com/open-metadata/OpenMetadata/pull/26848 making use of @kojikokojiko’s ideas, with a little touch of my own. Could you kindly review it?

khoaihps avatar Mar 30 '26 08:03 khoaihps