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

🎨 Speeds up sending messages to user with socketio #5331

Merged
merged 9 commits into from
Feb 14, 2024

Conversation

pcrespov
Copy link
Member

@pcrespov pcrespov commented Feb 14, 2024

What do these changes do?

This PR follows up from the incident reported by @matusdrobuliak66 and @GitHK on delays experienced consuming messages from socketio queue in rabbitMQ. @GitHK pointed out that the problem was in the delay caused by accessing redis everytime a socketio message was sent. @sanderegg proposed a solution that avoids this access by using instead the new rooms associated to user_id, i.e. rooms named f"user:{user_id}".

  • ♻️ minor renaming and cleanup
  • ♻️ Reactivated test on socketio

Related issue/s

  • Follows up from incident 48

How to test

  • Manually tested by checking that messages to the user were still delivered in different tabs and browsers (red arrows)
    image
    Screenshot 2024-02-14 at 09 48 46

Dev Checklist

DevOps Checklist

@pcrespov pcrespov self-assigned this Feb 14, 2024
Copy link

codecov bot commented Feb 14, 2024

Codecov Report

Attention: 2 lines in your changes are missing coverage. Please review.

Comparison is base (3c2ef61) 87.3% compared to head (522c9e4) 76.8%.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff            @@
##           master   #5331      +/-   ##
=========================================
- Coverage    87.3%   76.8%   -10.5%     
=========================================
  Files        1321     542     -779     
  Lines       54151   27180   -26971     
  Branches     1172     202     -970     
=========================================
- Hits        47282   20883   -26399     
+ Misses       6619    6247     -372     
+ Partials      250      50     -200     
Flag Coverage Δ
integrationtests 60.6% <72.2%> (-4.4%) ⬇️
unittests 86.5% <72.2%> (+1.4%) ⬆️

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

Files Coverage Δ
...rc/simcore_service_webserver/payments/_socketio.py 100.0% <100.0%> (ø)
...simcore_service_webserver/projects/projects_api.py 84.3% <100.0%> (ø)
...rc/simcore_service_webserver/socketio/_handlers.py 86.0% <100.0%> (ø)
...src/simcore_service_webserver/socketio/messages.py 100.0% <100.0%> (ø)
...tifications/_rabbitmq_exclusive_queue_consumers.py 88.7% <66.6%> (ø)

... and 917 files with indirect coverage changes

@pcrespov pcrespov added the a:webserver issue related to the webserver service label Feb 14, 2024
@pcrespov pcrespov changed the title WIP: 🎨 Speeds up sending messages to user with socketio 🎨 Speeds up sending messages to user with socketio Feb 14, 2024
@pcrespov pcrespov marked this pull request as ready for review February 14, 2024 08:57
@pcrespov pcrespov added this to the Schoggilebe milestone Feb 14, 2024
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.

Very nice.
Pleas make sure that if you start locally a service who's image is not present you are able to see the progress bar. After this is merged I will have a look at it's performance.

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.

Thank you! nice solution.

@pcrespov
Copy link
Member Author

Thank you! nice solution.

it's @sanderegg credit ;-)

Copy link
Member

@sanderegg sanderegg left a comment

Choose a reason for hiding this comment

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

thanks a lot for this!

@pcrespov
Copy link
Member Author

Very nice. Pleas make sure that if you start locally a service who's image is not present you are able to see the progress bar. After this is merged I will have a look at it's performance.

@GitHK there is not test for that feature? I am not sure I can reproduce it. I propose to test in master and also create an automatic for it. Socketio plugin is really undertested! I can help with that.

@pcrespov pcrespov enabled auto-merge (squash) February 14, 2024 10:12
@GitHK
Copy link
Contributor

GitHK commented Feb 14, 2024

Very nice. Pleas make sure that if you start locally a service who's image is not present you are able to see the progress bar. After this is merged I will have a look at it's performance.

@GitHK there is not test for that feature? I am not sure I can reproduce it. I propose to test in master and also create an automatic for it. Socketio plugin is really undertested! I can help with that.

I will test it on was-master when you have it merged since I need to see the images being pulled. That's what causes a lot of messages to be delivered and the socktio delivery of messages to be slow.

Copy link
Contributor

@bisgaard-itis bisgaard-itis left a comment

Choose a reason for hiding this comment

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

Looks good to me. Thanks

Copy link

Quality Gate Passed Quality Gate passed

Issues
0 New issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

@pcrespov pcrespov merged commit 4206404 into ITISFoundation:master Feb 14, 2024
55 checks passed
@pcrespov pcrespov deleted the fix/sio-slow-consuming branch February 14, 2024 15:23
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.

5 participants