Skip to content

[Improvement] Optimize API Performance: Log and Store API Latency, Refactor Long Operations #1096

@iziang

Description

@iziang

Background

The current API implementation can be further optimized for better performance and observability.

Suggestions

  1. Log and Store API Latency

    • Print the latency (duration) of each API call in the logs.
    • Persist the latency data directly into the database for later analysis.
  2. Refactor Long Operations

    • Move time-consuming operations out of the session context to avoid holding database connections for extended periods.
    • This will help reduce connection pool pressure and improve overall API responsiveness.

Expected Benefits

  • Improved monitoring and analysis of API performance bottlenecks.
  • Reduced risk of database connection exhaustion due to long-held sessions.
  • Better scalability and reliability for the API service.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions