Skip to content

perf: extension de la parallélisation au Tracker (au-delà du périmètre de l'étape 4)#2

Merged
Xajah merged 1 commit into
masterfrom
dev
Jun 5, 2026
Merged

perf: extension de la parallélisation au Tracker (au-delà du périmètre de l'étape 4)#2
Xajah merged 1 commit into
masterfrom
dev

Conversation

@Xajah

@Xajah Xajah commented Jun 5, 2026

Copy link
Copy Markdown
Owner

Cette PR complète l'étape 4 en propageant la parallélisation introduite pour les tests
à la boucle interne du Tracker, le composant qui actualise périodiquement la position de tous les utilisateurs enregistrés en arrière-plan.

Deux modifications :

  • Tracker : la boucle séquentielle forEach -> trackUserLocation est remplacée par un
    pipeline stream + CompletableFuture.allOf.join sur trackUserLocationAsync. Le Tracker bénéficie maintenant directement du pool TourGuideService et peut absorber des volumes d'utilisateurs croissants en production sans dégradation, conformément à la conception pensée pour les tests de performance.
  • TestPerformance : chaque test à haut volume arrête le Tracker dès la création de la
    TourGuideService, pour isoler la mesure de performance de la contention que produirait un Tracker actif en parallèle sur le même pool. Sans cette isolation, le temps mesuré serait approximativement doublé pour highVolumeTrackLocation, sans changement réel de la performance de l'opération testée.

Après ces changements, la suite de tests complète passe en environ 5 minutes 23 secondes en local, et les seuils fixés restent largement respectés (highVolumeTrackLocation en 3 min 19, highVolumeGetRewards en 1 min 43).

Two related changes that propagate the etape 4 parallelization beyond
the tests and keep the perf measurements clean:

- Tracker : the per-iteration loop now uses trackUserLocationAsync with
  CompletableFuture.allOf().join() instead of a sequential forEach over
  trackUserLocation. The Tracker, which actualises the location of all
  registered users every five minutes, now benefits directly from the
  TourGuideService thread pool. This makes the parallelization useful
  in real-world production scenarios (Tracker running with many users),
  not only in the performance tests.

- TestPerformance : each high-volume test now calls
  tourGuideService.tracker.stopTracking() immediately after creating
  the TourGuideService, before starting the measurement. This isolates
  the performance measurement from the background Tracker, which would
  otherwise contend for the same TourGuideService pool concurrently
  (causing measured times to roughly double without changing the
  underlying performance of the tested operation). After isolation,
  measured times return to the values reported in the documentation
  (highVolumeTrackLocation around 3m19, highVolumeGetRewards around
  1m43 on the reference machine).

Refs: OpenClassrooms Projet 8 - etape 4 extension (amelioration des performances reelles du Tracker).
@Xajah Xajah merged commit a5d85ba into master Jun 5, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant