The documentation is incomplete.
In this project, we've developed a Kotlin Spring Boot application to test asynchronous API calls and demonstrate multithreading capabilities. The application interacts with a Flask API running locally to simulate HTTP requests.
For test part, we've developed a Python application with module of threading and another with concurrent.futures which sets settings at yaml format.
- Multithreading: Utilized Java 21 virtual threads to handle concurrent API requests efficiently.
- Asynchronous API Calls: Demonstrated how to make asynchronous HTTP GET requests using Spring's
RestTemplate. - Thread Identification: Included thread identifiers to differentiate threads calling the virtual threads API.
- Performance Metrics: Recorded start and end times for API calls to calculate runtime.
- Different xxx:
- Test performance:
- Ensure that both the Kotlin Spring Boot application and the Flask API are running locally.
- Explore further optimization techniques for multithreading and asynchronous processing.
- Experiment with different configurations and APIs to test performance under various conditions.
- Consider integrating additional monitoring and logging tools for more detailed analysis.
| Action | Kotlin thread pool | Kotlin Multithreading | Python thread pool | Python concurrent |
|---|---|---|---|---|
| Calls | x1000 | x1000 | x1000 | x1000 |
| Threads | x10 | - | x10 | x10 |
| Time | 1584 ms | 462 ms | 202555.592 ms | 20467.969 ms |
- Kotlin 1.9.22
- Spring Boot 3.2.3
- Java 21 Virtual Threads
- Python 3.9.0
- requests==2.26.0
- PyYAML==6.0
- Flask==2.0.2
- Clone the repository to your local machine.
- Ensure you have JDK 17+ and Maven installed.
- Navigate to the project directory.
- Run
mvn spring-boot:runto start the Kotlin Spring Boot application. - Ensure the Flask API server is running locally on port 5000
http://localhost:5000/books/1,http://localhost:5000/books/2. - Access
http://localhost:8080/test-api,http://localhost:8080/test-api21to trigger the asynchronous API requests.
src/main/kotlin/com/example/demo: Contains Kotlin source files.Application.kt: Entry point for the Spring Boot application.ApiController.kt: Controller class handling API requests.
src/main/resources: Contains application properties and configurations.pom.xml: Maven project configuration file.
- This project serves as a demonstration of multithreading and asynchronous processing in Kotlin Spring Boot applications and python......
- For any questions or issues, please open an issue on GitHub.