France-ioi / AlgoreaBackend

Backend for the new Algorea platform
MIT License
1 stars 2 forks source link

Update item slow and blocked by propagation #1063

Closed GeoffreyHuck closed 3 months ago

GeoffreyHuck commented 3 months ago

A few things to speed up things and get more info.

Optimize query to authenticate the user

The query took ~1.2s in preprod, now it takes ~0.2s.

This will speed up all service calls.

Results propagation now has step by step transactions

  1. A step for the initialization
  2. The main steps
  3. A step for the ending

Add logs for propagation

Add logs for how long the propagation steps take.

Log level: DEBUG

Add logs for database lock acquisition

Add logs for how long it takes to acquire a database lock.

Log level: DEBUG

LOW_PRIORITY MySQL

We cannot use LOW_PRIORITY as it doesn't work for InnoDB, which uses row-level locking.

From the manuel "With the LOW_PRIORITY modifier, execution of the UPDATE is delayed until no other clients are reading from the table. This affects only storage engines that use only table-level locking (such as MyISAM, MEMORY, and MERGE)."

Review

Easier to review commit by commit.

codecov[bot] commented 3 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 100.00%. Comparing base (bc44c85) to head (1393a31).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #1063 +/- ## ========================================= Coverage 100.00% 100.00% ========================================= Files 236 236 Lines 14229 14254 +25 ========================================= + Hits 14229 14254 +25 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.