Skip to content
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

🎨 Rabbitmq/only listens to logs if needed #4180

Conversation

sanderegg
Copy link
Member

@sanderegg sanderegg commented Apr 28, 2023

What do these changes do?

  • when a project is opened by the frontend through a webserver instance, only that instance will start listening to the logs of that project vs all webserver instances listen to all logs of every projects/users
  • when a project is closed the webserver instance stops listening to the project logs
  • when a user disconnects (websocket connection lost), the webserver instance will also stop listening to the project logs

Bonuses:

  • fix closing of webserver's rabbitmq client by closing the connection (this auto-closes the channels without error)
  • add client name in close message of rabbitmq client
  • fixed some tests missing mocks

IMPORTANT NOTE: currently this will work because we use sticky connections!!
NOTE2: The studies running through the oSparc API will not generate load on the webserver(s) anymore.
NOTE3: The studies running through one specific instance of the webserver will not load the other for nothing anymore.
NOTE4: Expected reduction of CPU load on the webservers.

Related issue/s

How to test

DevOps Checklist

@sanderegg sanderegg self-assigned this Apr 28, 2023
@sanderegg sanderegg added this to the The Next Milestone milestone Apr 28, 2023
@codecov
Copy link

codecov bot commented Apr 28, 2023

Codecov Report

Merging #4180 (4345052) into master (ad4d076) will increase coverage by 18.4%.
The diff coverage is 100.0%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master   #4180      +/-   ##
=========================================
+ Coverage    65.8%   84.3%   +18.4%     
=========================================
  Files         370     961     +591     
  Lines       19140   41640   +22500     
  Branches        0     955     +955     
=========================================
+ Hits        12605   35111   +22506     
+ Misses       6535    6325     -210     
- Partials        0     204     +204     
Flag Coverage Δ
integrationtests 61.4% <91.4%> (-4.5%) ⬇️
unittests 82.3% <72.2%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...ackages/service-library/src/servicelib/rabbitmq.py 94.3% <100.0%> (ø)
...server/src/simcore_service_webserver/groups_api.py 95.9% <100.0%> (+40.1%) ⬆️
...core_service_webserver/notifications/_constants.py 100.0% <100.0%> (ø)
...ice_webserver/notifications/_rabbitmq_consumers.py 95.7% <100.0%> (+0.1%) ⬆️
...re_service_webserver/notifications/project_logs.py 100.0% <100.0%> (ø)
...core_service_webserver/projects/projects_events.py 100.0% <100.0%> (ø)
...re_service_webserver/projects/projects_handlers.py 91.2% <100.0%> (+42.3%) ⬆️

... and 805 files with indirect coverage changes

@sanderegg sanderegg added the a:webserver issue related to the webserver service label Apr 28, 2023
@sanderegg sanderegg force-pushed the rabbitmq/only_listens_to_logs_if_needed branch 3 times, most recently from 843b236 to 329d6a0 Compare May 5, 2023 13:41
@sanderegg sanderegg marked this pull request as ready for review May 5, 2023 13:44
@sanderegg sanderegg requested review from pcrespov and GitHK as code owners May 5, 2023 13:44
@sanderegg sanderegg force-pushed the rabbitmq/only_listens_to_logs_if_needed branch from a9bdd6f to 8507cbd Compare May 5, 2023 14:20
Copy link
Contributor

@GitHK GitHK left a comment

Choose a reason for hiding this comment

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

👍

@sanderegg sanderegg force-pushed the rabbitmq/only_listens_to_logs_if_needed branch from 7ab6cbc to 8c81f8d Compare May 8, 2023 06:51
Copy link
Member

@pcrespov pcrespov left a comment

Choose a reason for hiding this comment

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

Great improvement! thx!

Regarding IMPORTANT NOTE: currently this will work because we use sticky connections!!
Is there a way to add a test that reminds us about this condition in case sometime is broken? For instance, just a test that checks "stickiness" and raises an error with this note!

@sanderegg sanderegg requested a review from Surfict as a code owner May 8, 2023 08:01
Copy link
Contributor

@matusdrobuliak66 matusdrobuliak66 left a comment

Choose a reason for hiding this comment

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

👍

@sanderegg sanderegg force-pushed the rabbitmq/only_listens_to_logs_if_needed branch from 4eb76cd to 4345052 Compare May 8, 2023 10:54
@codeclimate
Copy link

codeclimate bot commented May 8, 2023

Code Climate has analyzed commit 4345052 and detected 0 issues on this pull request.

View more on Code Climate.

@sonarqubecloud
Copy link

sonarqubecloud bot commented May 8, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@sanderegg sanderegg enabled auto-merge (squash) May 8, 2023 11:19
@sanderegg sanderegg disabled auto-merge May 8, 2023 13:04
@sanderegg sanderegg merged commit 2e8d8e4 into ITISFoundation:master May 8, 2023
@sanderegg sanderegg deleted the rabbitmq/only_listens_to_logs_if_needed branch May 8, 2023 13:04
@matusdrobuliak66 matusdrobuliak66 changed the title Rabbitmq/only listens to logs if needed 🎨 Rabbitmq/only listens to logs if needed May 11, 2023
@matusdrobuliak66 matusdrobuliak66 mentioned this pull request May 30, 2023
24 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a:webserver issue related to the webserver service
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants