sticky-session | Sticky session balancer based on a cluster module
kandi X-RAY | sticky-session Summary
kandi X-RAY | sticky-session Summary
A simple performant way to use socket.io with a cluster.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Listen for changes
- Server constructor .
sticky-session Key Features
sticky-session Examples and Code Snippets
Community Discussions
Trending Discussions on sticky-session
QUESTION
i have a kubernetes environment i am trying to publish my socket.io nodejs app to it for scaling.
It only emits the message to clients connected to same server, other clients are not getting any message at all.
Using:
socket.io@4.1.0
sticky@1.0.1
cluster-adapter@0.1.0
I was following this documentation:
Here is my clustered-socket.js:
...ANSWER
Answered 2021-Dec-12 at 13:41Use an adapter that uses a database connected to all nodes like Redis, Mongodb or Postgres adapters.
QUESTION
I am using two ec2 instances on a classic load balancer. My users were having 502 errors in the middle of their analysis, especially while having ajax calls. In other words, if a user is connected to a server instance, an ajax call in the middle of using the program is directed to the other server instance. And that causes that error. I need the user targeted to the same server instance during the his/her session.
After googling the issue mentioned above, I found this:
https://docs.aws.amazon.com/elasticloadbalancing/latest/application/sticky-sessions.html
According to these documentations, I should apply sticky sessions to my load balancer. However, it requires clients to have their cookies enabled on their browsers. I really don't want that.
Is there any other solution for this issue? I really would appreciate any suggestion.
...ANSWER
Answered 2021-Aug-27 at 03:50The problem you are facing is because your application is statefull. In ideal load balanced and auto-scaled setup, all your instances should be stateless, which means there wouldn't be any issue with re-directing users to other instances.
For this to work, all state information related to your user's sessions should be stored and handled outside of the instances, e.g. in DynamoDB or ElasticCache. This will add more cost and requires changes to your application, but this is what you should aim at and it would allow you to pass stateid
in url, instead of cookies.
Sadly, I don't think you can achieve what you want without load balancer cookies or application level cookies.
QUESTION
I have the following configuration for request-based sticky session using Spring Cloud LoadBalancer
...ANSWER
Answered 2021-Jun-18 at 15:33There are 2 things to consider here:
In the sample, the cookie has to be passed on to the actual load-balanced request, for example like so:
QUESTION
We are have enabled horizontal pod autoscaling in GKE, our pods are sitting behind a clusterIP type service and we are routing public traffic to that Service using NGINX Ingress controller. When monitoring the usages we have noticed that traffic is not equally distributed between pods. it's routing traffic to one single pod. but whenever we manually deleted that particular pod it will route traffic to another available pod.
Is there any way we can enable ingress rules to distribute traffic equally
Ingress
...ANSWER
Answered 2021-May-20 at 14:07Your Ingress should have a serviceName which in your case is "gateway-443" and "gateway-80" but the actual name specified in the Service in metadata.name is "gateway-8243".
(If this is on purpose, please post the YAML of the other resources so I can take a look at the whole setup.)
Also please take a look at this page that has lots of good examples on how to achieve what you are looking to do.
QUESTION
Using spring-boot 2.17 with hazelcast 3.11 and tomcat 9.0.39.
I have set a WebFilter bean:
...ANSWER
Answered 2020-Dec-09 at 18:09You should put boolean properties with string values:
QUESTION
I am trying to implement sticky sessions. I have found out that I can add a prefix to the exiting cookies servers to identify them. See here for more
...ANSWER
Answered 2020-Oct-28 at 22:28You are looking for the dynamic
option as part of the cookie
directive. You will also want to look into dynamic-cookie-key
.
QUESTION
I have a deployment which comprises 2 pods with a webapp in them. Nginx ingress controller is installed to expose those 2 pods using tls-passthrough. I have tried to use annotations to setup sticky-sessions but to no avail. No cookie is present in the headers hence no stickyness. What could I do to make it work ? Many thanks for your wise answers.
The Ingress I have created :
...ANSWER
Answered 2020-Jul-27 at 10:25I am posting this as a community wiki answer for better visibility.
As already mentioned in the comments: any other annotation will not work when used alongside the ssl-passthrough
. This is also being mentioned by the official docs:
Because SSL Passthrough works on layer 4 of the OSI model (TCP) and not on the layer 7 (HTTP), using SSL Passthrough invalidates all the other annotations set on an Ingress object.
QUESTION
I have created a Jmeter script to check the performance of a site. The website is hosted in AWS with elastic scaling and with sticky sessions. Basically the AWS load balancer will assign a session cookie to each user so the load balancer can direct the user to the correct instance.
My problem is, as I'm using a cookie manager and clearing all the cookies with each iteration. Does it clear these assigned cookies too? I suspect this because the script error rate is lower when we execute the script on a single AWS instance than in auto-scaling ( multiple instances )
Any idea ?
...ANSWER
Answered 2020-Jul-08 at 15:58I don't know about how do you "clear" cookies, if you use this box of the HTTP Cookie Manager:
then it removes all cookies on each new iteration of the Thread Group (other loop generation options like Loop Controller or While Controller will not trigger clearing of cookies)
Also if your Load Balancer has more that one IP address you might want to add the DNS Cache Manager to your Test Plan in order to avoid DNS requests caching on JVM or OS side.
QUESTION
I have a Flask app running in AWS using Flask-JWT-Extended. It is serving REST API calls to a web app.
As I understand from the documentation, the tokens are generated and stored in memory. I am considering storing them external to the Flask app in either a database or Redis. The reason for this is to support load balancing:
- I presume that sticky-sessions would be required to make sure that the client's token can be properly decoded and analyzed for validity
- I am considering putting the app in AWS Lambda, which would probably wipe out the JWT list once the request was served.
My questions are:
- Is there any reason this scheme would not generally work?
- If the tokens are stored outside the Flask app, it is not clear how to override the local token storage and access an external storage medium. Can this be done?
ANSWER
Answered 2020-Feb-02 at 03:31The tokens are not stored in memory. JWT works by creating tokens that can be verified to have not been tampered with without having to keep any state on the server (just make sure to keep the JWT_SECRET_KEY really and truly secret). Here is an article about stateless authentication you might want to read up on: https://blog.imaginea.com/stateless-authentication-using-jwt-2/
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install sticky-session
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page