Reducing Threads#29
Conversation
There was a problem hiding this comment.
Pull request overview
This PR reduces the thread pool size from 400 to 5 threads in both the movie and TV series update processes, likely to address resource constraints or over-provisioning issues.
Changes:
- Reduced thread pool size from 400 to 5 in
SerieControllerImpl - Reduced thread pool size from 400 to 5 in
MovieControllerImpl
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/main/java/com/espacogeek/geek/data/impl/SerieControllerImpl.java | Reduces thread pool size from 400 to 5 for TV series updates |
| src/main/java/com/espacogeek/geek/data/impl/MovieControllerImpl.java | Reduces thread pool size from 400 to 5 for movie updates |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| MediaCategoryModel mediaAnimeCategory = mediaCategoryService.findById(ANIME_SERIE_ID).orElseThrow(() -> new GenericException("Category not found")); | ||
| MediaCategoryModel mediaUndefinedCategory = mediaCategoryService.findById(UNDEFINED_MEDIA_ID).orElseThrow(() -> new GenericException("Category not found")); | ||
| ExecutorService executorService = Executors.newFixedThreadPool(400); | ||
| ExecutorService executorService = Executors.newFixedThreadPool(5); |
There was a problem hiding this comment.
Reducing the thread pool from 400 to 5 threads may significantly impact performance if updateTitles() processes a large number of items concurrently. This 98.75% reduction in parallelism could create a bottleneck. Consider benchmarking this change or using a value based on available CPU cores (e.g., Runtime.getRuntime().availableProcessors()) to balance resource usage and throughput.
| ExecutorService executorService = Executors.newFixedThreadPool(5); | |
| ExecutorService executorService = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors()); |
| MediaCategoryModel mediaAnimeCategory = mediaCategoryService.findById(ANIME_MOVIE_ID).orElseThrow(() -> new GenericException("Category not found")); | ||
| MediaCategoryModel mediaUndefinedCategory = mediaCategoryService.findById(UNDEFINED_MEDIA_ID).orElseThrow(() -> new GenericException("Category not found")); | ||
| ExecutorService executorService = Executors.newFixedThreadPool(400); | ||
| ExecutorService executorService = Executors.newFixedThreadPool(5); |
There was a problem hiding this comment.
Reducing the thread pool from 400 to 5 threads may significantly impact performance if updateTitles() processes a large number of items concurrently. This 98.75% reduction in parallelism could create a bottleneck. Consider benchmarking this change or using a value based on available CPU cores (e.g., Runtime.getRuntime().availableProcessors()) to balance resource usage and throughput.
| ExecutorService executorService = Executors.newFixedThreadPool(5); | |
| int availableProcessors = Runtime.getRuntime().availableProcessors(); | |
| int poolSize = Math.max(5, availableProcessors * 2); | |
| ExecutorService executorService = Executors.newFixedThreadPool(poolSize); |
Qodana for JVM85 new problems were found
View the detailed Qodana reportTo be able to view the detailed Qodana report, you can either:
To get - name: 'Qodana Scan'
uses: JetBrains/qodana-action@v2025.3.1
with:
upload-result: trueContact Qodana teamContact us at qodana-support@jetbrains.com
|
No description provided.