Skip to content

Conversation

jarnura
Copy link
Member

@jarnura jarnura commented Nov 3, 2023

Type of Change

  • Enhancement
  • Refactoring
  • Dependency updates

Description

  • Currently, In GetTracker, UpdateTracker, and PostUpdateTracker, the concurrent database calls become sequential because of the mutex lock of async-bb8 to get a connection from the connection pool.

    • The I/O(Database call), which ends and releases the lock, makes all concurrent calls sequential.
  • Any errors inside the spawned concurrent calls propagated as an internal server error.

Solution:

  • Instead, use the has_broken function from the connection manager to check whether a connection is valid and run the function immediately. So that inside all concurrent calls, acquire a lock to pick a connection and then release before doing an I/O call.

  • Match on the JoinHandle and propagate the join error as an internal server error and others as it is.

    • created a function called flatten_join_error to propagate the proper error.
  • The runtime changed into tokio::main, so that we get more performance with tokio::spawn instead using actix-web::main

  • Added Box::pin to large futures

Motivation and Context

To reduce the overall latency of the confirm call.

How did you test it?

A load test setup is required with tracing enabled. A minimalistic postman load test tool itself suffices.

Enable traces_enabled=true, use_xray_generator = true. Run the load test, narrow it down to get_traces in traces, and check the waterfall.

Screenshot 2023-11-03 at 2 05 59 PM

Checklist

  • I formatted the code cargo +nightly fmt --all
  • I addressed lints thrown by cargo clippy
  • I reviewed the submitted code
  • I added unit tests for my changes where possible
  • I added a CHANGELOG entry if applicable

@jarnura jarnura added A-framework Area: Framework A-core Area: Core flows S-waiting-on-review Status: This PR has been implemented and needs to be reviewed labels Nov 3, 2023
@jarnura jarnura added this to the October 2023 Milestone milestone Nov 3, 2023
@jarnura jarnura self-assigned this Nov 3, 2023
@jarnura jarnura requested review from a team as code owners November 3, 2023 08:43
@jarnura jarnura requested a review from dracarys18 November 3, 2023 08:54
@jarnura jarnura requested a review from a team as a code owner November 3, 2023 12:09
@jarnura jarnura requested a review from SanchithHegde November 3, 2023 12:10
akshay-97 and others added 2 commits November 7, 2023 18:11
Co-authored-by: akshay.s <[email protected]>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
dracarys18
dracarys18 previously approved these changes Nov 9, 2023
@jarnura jarnura requested a review from a team as a code owner November 13, 2023 11:32
@dracarys18 dracarys18 requested review from a team as code owners November 13, 2023 11:52
dracarys18
dracarys18 previously approved these changes Nov 14, 2023
akshay-97
akshay-97 previously approved these changes Nov 14, 2023
SanchithHegde
SanchithHegde previously approved these changes Nov 14, 2023
@jarnura jarnura dismissed stale reviews from SanchithHegde, akshay-97, and dracarys18 via ae9581d November 15, 2023 13:27
@jarnura jarnura added this pull request to the merge queue Nov 16, 2023
@jarnura jarnura removed the S-waiting-on-review Status: This PR has been implemented and needs to be reviewed label Nov 16, 2023
Merged via the queue into main with commit d634fde Nov 16, 2023
@jarnura jarnura deleted the pref/pool branch November 16, 2023 06:02
@jarnura jarnura restored the pref/pool branch November 16, 2023 07:47
@jarnura jarnura deleted the pref/pool branch November 16, 2023 07:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-core Area: Core flows A-framework Area: Framework
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants