Skip to content

Development: Defer eager bean initialization and refactor services to reduce server startup time #10951

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 31 commits into
base: chore/mark-everything-as-lazy
Choose a base branch
from

Conversation

tobias-lippert
Copy link
Contributor

@tobias-lippert tobias-lippert commented May 30, 2025

Checklist

General

Server

Motivation and Context

Server startup is quite slow. Locally it takes ~40s. On production it takes multiple minutes.
Stacked on top of #10962 for easier reviewing.

Description

  • enable spring.main.lazy-initialization again.
  • Make all the schedule services not listen to application ready event but to our custom full startup event that fires a bit later
  • Refactored different services to reduce the number of services that need to instantiated at startup.
  • Implemented a deferred eager initialization of beans. To avoid that many beans need to be initialized as soon as a request is made, we trigger bean initialization as soon as the startup is complete.

Steps for Testing

For manual testing you can approve both and this PR

  • Deploy this branch and click around in the application to make sure nothing broke
  • Optional: Check the logs in grafana and compare the full startup time with develop

Testserver States

You can manage test servers using Helios. Check environment statuses in the environment list. To deploy to a test server, go to the CI/CD page, find your PR or branch, and trigger the deployment.

Review Progress

Code Review

  • Code Review 1
  • Code Review 2

Manual Tests

  • Test 1
  • Test 2

Test Coverage

unchanged

@github-project-automation github-project-automation bot moved this to Work In Progress in Artemis Development May 30, 2025
@github-actions github-actions bot added tests server Pull requests that update Java code. (Added Automatically!) config-change Pull requests that change the config in a way that they require a deployment via Ansible. assessment Pull requests that affect the corresponding module athena Pull requests that affect the corresponding module atlas Pull requests that affect the corresponding module buildagent Pull requests that affect the corresponding module communication Pull requests that affect the corresponding module core Pull requests that affect the corresponding module exam Pull requests that affect the corresponding module exercise Pull requests that affect the corresponding module fileupload Pull requests that affect the corresponding module iris Pull requests that affect the corresponding module lecture Pull requests that affect the corresponding module lti Pull requests that affect the corresponding module labels May 30, 2025
@tobias-lippert tobias-lippert changed the title Development: Speedup server start Development: Deferred eager bean initialization and service refactorings to reduce number of bean instantiations at startup Jun 1, 2025
@tobias-lippert tobias-lippert changed the base branch from develop to chore/mark-everything-as-lazy June 1, 2025 18:53
Copy link

github-actions bot commented Jun 1, 2025

End-to-End (E2E) Test Results Summary

TestsPassed ☑️Skipped ⚠️Failed ❌️Time ⏱
End-to-End (E2E) Test Report201 ran197 passed3 skipped1 failed57m 41s 430ms
TestResultTime ⏱
End-to-End (E2E) Test Report
e2e/exercise/programming/ProgrammingExerciseStaticCodeAnalysis.spec.ts
ts.Static code analysis tests › Configures SCA grading and makes a successful submission with SCA errors❌ failure2m 17s 308ms

@helios-aet helios-aet bot temporarily deployed to artemis-test3.artemis.cit.tum.de June 1, 2025 20:09 Inactive
@github-actions github-actions bot removed atlas Pull requests that affect the corresponding module fileupload Pull requests that affect the corresponding module modeling Pull requests that affect the corresponding module tutorialgroup Pull requests that affect the corresponding module labels Jun 2, 2025
Copy link

github-actions bot commented Jun 2, 2025

End-to-End (E2E) Test Results Summary

TestsPassed ✅Skipped ⚠️FailedTime ⏱
End-to-End (E2E) Test Report201 ran198 passed3 skipped0 failed59m 2s 482ms
TestResultTime ⏱
No test annotations available

@helios-aet helios-aet bot temporarily deployed to artemis-test3.artemis.cit.tum.de June 2, 2025 12:29 Inactive
Copy link

github-actions bot commented Jun 2, 2025

End-to-End (E2E) Test Results Summary

TestsPassed ☑️Skipped ⚠️Failed ❌️Time ⏱
End-to-End (E2E) Test Report201 ran197 passed3 skipped1 failed54m 13s 583ms
TestResultTime ⏱
End-to-End (E2E) Test Report
e2e/exercise/quiz-exercise/QuizExerciseParticipation.spec.ts
ts.Quiz Exercise Participation › DnD Quiz participation › Student can participate in DnD Quiz❌ failure2m 4s 559ms

@tobias-lippert tobias-lippert added this to the 8.1.4 milestone Jun 2, 2025
Copy link

github-actions bot commented Jun 2, 2025

End-to-End (E2E) Test Results Summary

TestsPassed ✅Skipped ⚠️FailedTime ⏱
End-to-End (E2E) Test Report201 ran198 passed3 skipped0 failed55m 53s 202ms
TestResultTime ⏱
No test annotations available

Copy link
Contributor

@jfr2102 jfr2102 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

code 👍

@helios-aet helios-aet bot temporarily deployed to artemis-test3.artemis.cit.tum.de June 2, 2025 18:51 Inactive
Copy link

@HawKhiem HawKhiem left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested on TS3. So far no errors found

@helios-aet helios-aet bot temporarily deployed to artemis-test2.artemis.cit.tum.de June 2, 2025 19:04 Inactive
@krusche krusche changed the title Development: Deferred eager bean initialization and service refactorings to reduce number of bean instantiations at startup Development: Defer eager bean initialization and refactor services to reduce server startup time Jun 3, 2025
Copy link

@DenizOzturk95 DenizOzturk95 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I deployed and tested this in TS2 with multiple accounts, student, instructor and admin, and different exercises, and didn't observe anything broken.
But I had a weird helios issue, where despite building the image and deploying it, helios doesn't reflect it. it's stuck in this state (for the past 15 minutes).

image

I don't know whether this is due to helios, a fault of my own or something in your code that breaks it. I inspected the build logs on GitHub and to see it was deployed. I assume its probably just a visual bug, since as I wrote this review it updated.

@helios-aet helios-aet bot temporarily deployed to artemis-test2.artemis.cit.tum.de June 3, 2025 11:13 Inactive
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
assessment Pull requests that affect the corresponding module athena Pull requests that affect the corresponding module buildagent Pull requests that affect the corresponding module communication Pull requests that affect the corresponding module config-change Pull requests that change the config in a way that they require a deployment via Ansible. core Pull requests that affect the corresponding module exam Pull requests that affect the corresponding module exercise Pull requests that affect the corresponding module iris Pull requests that affect the corresponding module lecture Pull requests that affect the corresponding module lti Pull requests that affect the corresponding module plagiarism Pull requests that affect the corresponding module programming Pull requests that affect the corresponding module quiz Pull requests that affect the corresponding module ready for review server Pull requests that update Java code. (Added Automatically!) tests text Pull requests that affect the corresponding module
Projects
Status: Work In Progress
Status: Todo
Development

Successfully merging this pull request may close these issues.

5 participants