Comments (10)
I've done some testing with the session_affinity and it appears to work fine. It does not trigger off the JSESSION_ID
, rather it set's it's own GCLB
cookie.
The normal default in memory session should work OK with this setup, but if the affinity is not entirely sticky (if the GCLB cookie is lost, a node shuts down etc.) then session data will be lost. So a better setup would be to have an in memory cache fronting the gcloud datastore. This can be achieved with the following in your app.yaml:
env_variables:
JETTY_MODULES_ENABLE: session-cache-hash,gcp-datastore,session-store-gcloud
This will avoid hitting the datastore on every request, sessions will only be written when dirty. I can see in my tests that objects in the sessions are coming back with the same value and same hashcode (so they have not been serialized deserialized)!
I will add this to the doco!
from jetty-runtime.
Pull request #260 documents this
from jetty-runtime.
+1 from me
from jetty-runtime.
Note also that if session affinity is available, we can add a more efficient memory cache for sessions in each instance that will reduce the load on the shared session store and improve semantics for co-located requests. The image can easily be modified to take advantage of affinity.
from jetty-runtime.
Just dicovered this
https://cloud.google.com/blog/products/application-development/introducing-websockets-support-for-app-engine-flexible-environment
and this
https://cloud.google.com/appengine/docs/flexible/java/using-websockets-and-session-affinity
(see bottom of this page)
It looks like in order to offer WebSockets on the flex environment "they" implemented session-affinity
app.yaml
:
network:
session_affinity: true
from jetty-runtime.
@Petikoch Thanks for that - I'll test that out (probably next week) and if it works will see what session options should be turned on in the image to best make use of that.
from jetty-runtime.
Excellent, thanks a lot @gregw
from jetty-runtime.
Should it be enough to set session_affinity to true in app.yaml to enable session affinity or is there a specific Jetty module that also needs to be enabled with JETTY_MODULES_ENABLE? Does the GCP Load Balancer needs to be set up too? Documentation does not say anything about that and I cannot see any additional cookies (like the GCLB cookie mentioned by @gregw before) set in the response after having enabled session_affinity. Or is it just websockets for which App Engine flex supports session affinity?
from jetty-runtime.
If you set session_affinity to true, you will get session affinity implemented by the Google load balancer using its own additional cookie. This will work with no changes to Jetty.
However, one of the main points of session affinity is to allow efficient session management from an in memory session cache, so if you have affinity, you can turn this on with the session-cache-hash
module. It's not necessary, but it's kind of the point!
from jetty-runtime.
Thanks for the clarification, @gregw. This was exactly how I thought. However, as I wrote, basic session infinity does not seem to work in my case. I set session_affinity under network: in app.yaml, but do not see any additional (GCLB or other) cookies added to the HTTP responses. This is why I thought that I may be missing one or another Jetty module or the Load Balancer has to be configured in some way (I do not have configured it at all, so as I understand, all App Engine Flex defaults should be functioning).
from jetty-runtime.
Related Issues (20)
- Track the Jetty request span in Cloud Trace HOT 4
- Refactor GKE cluster zone into an environment variable
- Can Logback be used for logging instead of JUL? HOT 14
- Upgrade to the latest google-cloud-logging library HOT 2
- Add JMX support HOT 2
- Spring Boot 2.0 apps fail on startup due to log4j 2.10.0 conflict with Jetty 9.4.5 HOT 1
- Broken links in jetty-runtime/README.md
- launcher.gcr.io references are obsolete in README.md
- How can I change version of jetty from 9 as 9.4 for standard environment. [(websocket )JSR 356.] HOT 3
- Custom runtime for GAE based on gcr.io/google-appengine/jetty HOT 9
- Logging Smoke Test is Broken
- CVE-2017-14062 Vulnerability HOT 1
- TraceLoggingEnhancer.setCurrentTraceId is not in correctly formatted. HOT 3
- Jetty Session Management using Memcache backed by DataStore, Enabling Memorystore for Session Management HOT 1
- Jetty to stackdriver logging with google custom logging handler HOT 1
- ContextDepth increment HOT 2
- Convert to using the dockerfile-maven plugin HOT 4
- Use Java 11 HOT 2
- Upgrade base image to Debian 10 ("buster") HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jetty-runtime.