Skip to content
This repository was archived by the owner on Sep 16, 2021. It is now read-only.
This repository was archived by the owner on Sep 16, 2021. It is now read-only.

Enable session clustering in jetty9 non compat. was: Copying session variables between different instances is broken #183

Closed

Description

@johnshunfan

Currently, session variables stored in MVM instance are not copied over to the other instances. Will this ever be done automatically in the runtime? What are best practices for manually copying session variables around? I was considering generating an ID using secure random and storing it in a cookie, then using the ID as a key for datastore entities storing session variables.
@lesv

Activity

  1. lesv commented on Feb 25, 2016

    @lesv

    An alternative phrasing of this might be: JSESSIONID is unique within an instance, but when you have multiple instances -- you appear to get a new JSESSIONID, what is the best practice for dealing with state for the non-compat runtimes as currently configured?

  2. ludoch commented on Feb 25, 2016

    @ludoch
    Contributor

    This is for non compat, right?

    Please be specific. If this is for non compat, it seems that this is in
    userland to find the best option.

    On Thu, Feb 25, 2016 at 11:56 AM, Les Vogel notifications@github.com
    wrote:

    An alternative phrasing of this might be: JSESSIONID is unique within an
    instance, but when you have multiple instances -- you appear to get a new
    JSESSIONID, what is the best practice for dealing with state for the
    non-compat runtimes as currently configured?

    —
    Reply to this email directly or view it on GitHub
    #183 (comment)
    .

  3. lesv commented on Feb 25, 2016

    @lesv

    Sorry - Yes - this is for non-compat - and yes - we are seeking advice for how to handle this in userland.

  4. ludoch commented on Feb 25, 2016

    @ludoch
    Contributor

    https://www.eclipse.org/jetty/documentation/current/session-clustering-gcloud-datastore.html
    or
    https://www.eclipse.org/jetty/documentation/current/session-clustering-infinispan.html
    or
    https://www.eclipse.org/jetty/documentation/current/session-clustering-mongodb.html
    or
    https://www.eclipse.org/jetty/documentation/current/session-clustering-jdbc.html
    or many other possible solutions

    On Thu, Feb 25, 2016 at 1:03 PM, Les Vogel notifications@github.com wrote:

    Sorry - Yes - this is for non-compat - and yes - we are seeking advice for
    how to handle this in userland.

    —
    Reply to this email directly or view it on GitHub
    #183 (comment)
    .

  5. lesv commented on Feb 25, 2016

    @lesv

    Your responses all require configuration that can't be set by our users, if we could use that stuff, we would.

  6. ludoch commented on Feb 25, 2016

    @ludoch
    Contributor

    Maybe we should add an option for the cloud datastore?

    On Thu, Feb 25, 2016 at 1:12 PM, Les Vogel notifications@github.com wrote:

    Your responses all require configuration that can't be set by our users,
    if we could use that stuff, we would.

    —
    Reply to this email directly or view it on GitHub
    #183 (comment)
    .

  7. ludoch commented on Feb 25, 2016

    @ludoch
    Contributor

    Extra config might be able to define as xml files in your app. Will check with the Jetty folks.

  8. lesv commented on Feb 25, 2016

    @lesv

    There is an issue for using Memcache & Cloud Datastore.

    An Extra config to enable these things would be a win.

  9. lesv commented on Feb 25, 2016

    @lesv

    We are trying to do the right thing w/ Jetty, w/o the proper configuration files being enabled. The alternative is something like https://github.com/hazelcast/hazelcast-wm/blob/master/src/main/java/com/hazelcast/web/WebFilter.java (adjusted for our environment)

  10. reopened this on Feb 26, 2016
  11. gregw commented on Feb 26, 2016

    @gregw
    Contributor

    How about we start by adding an example to the java-docs-samples repository of how to extend this image with configuration for a different session manager (gcloud data store would be the obvious choice).

    Once we all look at that , we can see how difficult and/or easy it is and then decide if we need to move a parameterised version of it into the base image.

    Note that we will not have full memecache+datastore support until we go to 9.4 and the new session manager that @janbartel has been developing.

  12. gregw commented on Feb 26, 2016

    @gregw
    Contributor

    as a secondary approach, @janbartel is investigating if the session managers can be entirely configured from within a WEB-INF/jetty-web.xml file, which would allow it all to be within the application... but as that still requires a new image / Dockerfile it may just be simplest to configure normally following the example(s) we develop.

  13. janbartel commented on Feb 26, 2016

    @janbartel
    Contributor

    I've investigated the approach that @gregw mentioned of putting all jars and config into the webapp, and it is not particularly easy to make work. If it was absolutely essential, it could be done, but the cleanest approach is probably the one @gregw first suggested of documenting how to extend the docker image to include a session manager.

  14. lesv commented on Feb 26, 2016

    @lesv

    Cool - @ludoch should decide on direction.

    For now, I've asked @shun-fan to do login and Session handling as Filters (We are working on a Getting Started sample and documentation) and we can change that once things change.

    As for the Datastore plugin, unless you've rev'd it recently, I suspect it's not based on the correct API set. (https://github.com/GoogleCloudPlatform/gcloud-java)

    I'm not sure if extending the image is easiest approach for our users. It tends to get messy and difficult to maintain. (I've done it a few times).

  15. janbartel commented on Feb 27, 2016

    @janbartel
    Contributor

    @lesv looks like gcloud-java is up to rev 0.1.4. Jetty is at 0.0.8. On a quick compile attempt, looks like there is some incompatibility in the api. I'll work on updating to 0.1.4. I'll see if I can get it into a jetty 9.3.8.RC1 release or not (we just did RC0).

  16. gregw commented on Feb 27, 2016

    @gregw
    Contributor

    @lesv I'm a bit unsure how applications are going to deployed on this image (the non -compat Jetty9 image). I thought creating a new image in the normal docker way was the intended path to use this image! Is there another path that does need a new image? If so, can you point me to it?
    light bulb moment Is it just a normal gcloud:deploy but in a non-compat mode?

    If so, then perhaps we should come up with a simple way for such deployments to activate additional jetty modules and to add either properties and/or XML configuration?

    We should also provide and example app for this (or is there one already?)

  17. lesv commented on Feb 28, 2016

    @lesv

    Yep - it's a normal "mvn gcloud:deploy" -- hence my grumpiness at Ludo
    earlier. What ever turns it on should be easy to do.

    On Sat, Feb 27, 2016 at 9:54 AM, Greg Wilkins notifications@github.com
    wrote:

    @lesv https://github.com/lesv I'm a bit unsure how applications are
    going to deployed on this image (the non -compat Jetty9 image). I thought
    creating a new image in the normal docker way was the intended path to use
    this image! Is there another path that does need a new image? If so, can
    you point me to it?

    light bulb moment
    http://images.clipartpanda.com/idea-light-bulb-clip-art-black-and-white-MTLEnkBTa.jpeg
    Is it just a normal gcloud:deploy but in a non-compat mode?

    If so, then perhaps we should come up with a simple way for such
    deployments to activate additional jetty modules and to add either
    properties and/or XML configuration?

    We should also provide and example app for this (or is there one already?)

    —
    Reply to this email directly or view it on GitHub
    #183 (comment)
    .

    • • *Les Vogel
    • • *Cloud Developer Relations
    • • *lesv@google.com
    • • *+1-4 <%2B1-650-338-7103>08-676-7023
  18. lesv commented on Feb 28, 2016

    @lesv

    I should point out that it is both mvn gcloud:deploy and mvn jetty:run (running locally) that we promote. Ideally we should find a solution that can work in both cases.

  19. gregw commented on Feb 29, 2016

    @gregw
    Contributor

    @lesv Ah I'm understanding the scenario now. I had not realised the jetty9 image was intended for use by the SDK for apps that do not need to compat level.

    Having discussed this with @janbartel, we have a little bit of a challenge to make this nice. The jetty-maven-plugin predates the module system used by jetty's start.jar, thus to configure the server for jetty:run you pass it custom XML. To configure the server for a gcloud:deploy, it would be best to pass it a list of modules & parameters (and only custom XML for very special config).

    So I think module/param based configuration is a good feature to add to jetty:run, but I will defer to @janbartel if that can be done in the 9.3.x or will it need a bit more drastic re factoring of our distribution artefacts in 9.4.x so that the modules can be made available to the plugin.

    Meanwhile, we will have a look at how we can best pass modules and configuration for a gcloud:deploy usage. Do you (@lesv ) have an example app we can look at? Is it just that you use a Dockerfile that names the instance or is there something in the appengine-web.xml ?

  20. changed the title [-]Copying session variables between different instances is broken[/-] [+]Enable session clustering in jetty9 non compat. was: Copying session variables between different instances is broken[/+] on Mar 1, 2016
  21. janbartel commented on Apr 27, 2016

    @janbartel
    Contributor

    Just want to document that I've begun the IP clearance process at Eclipse to allow jetty to update to gcloud-datastore version 0.2.0.

  22. gregw commented on Apr 27, 2016

    @gregw
    Contributor

    An example non compat session clustering example has been prepared at GoogleCloudPlatform/java-docs-samples#123, but some more work is needed

  23. gregw commented on Apr 28, 2016

    @gregw
    Contributor

    Closing as a duplicate of #167

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions