Re: Tomcat session management with Redisson

2019-02-18 Thread Harpreet Sandhu
If you want to go with redis in HA environment. You should opt redis
sentinel over master-slave architecture.

On Tue 19 Feb, 2019, 12:29 AM Herb Burnswell  On Fri, Feb 15, 2019 at 12:21 PM Christopher Schultz <
> ch...@christopherschultz.net> wrote:
>
> > -BEGIN PGP SIGNED MESSAGE-
> > Hash: SHA256
> >
> > Herb,
> >
> > On 2/14/19 12:41, Herb Burnswell wrote:
> > > Tomcat 8.5.23 RHEL   7.5
> > >
> > > We are looking to set up session management via Redisson to offload
> > > the CPU consumption of using Tomcat's built in clustering session
> > > management.  We have CPU licensing limits and need to conserve as
> > > much CPU as possible.
> >
> > Dumb question: aren't you just going to move the CPU cycles to another
> > system?
> >
>
> Thanks for the reply.  Short answer, yes.  But that is the idea.  We can
> only use 2 CPU's per application node (3 nodes) with our licensing
> structure so we do not want to take cycles away from the application to
> manage sessions.
>
>
> > Another dumb question: do you actually need clustering?
> >
>
> If I'm using the term correctly, yes.  The idea would be for HA
> functionality; If users were connected to node 3 and the node failed for
> some reason, their session would be picked up by node 1 or 2
> uninterrupted.  Sorry if I confused the intent.
>
>
> >
> > > I have never set up a configuration this way, however I have Redis
> > > set up and running as 1 Master, 1 Slave.  I seemingly just need to
> > > point our application to it.  I have read this doc on how to:
> > >
> > > https://github.com/redisson/redisson/tree/master/redisson-tomcat
> > >
> > > It seems pretty straight forward except for the redisson.conf
> > > configuration:
> > >
> > > Add RedissonSessionManager into tomcat/conf/context.xml
> > >
> > >  > > configPath="${catalina.base}/redisson.conf" readMode="REDIS"
> > > updateMode="DEFAULT"/>
> >
> > I would do this in the application's context.xml file instead of the
> > global/default one. That means modifying the application's
> > META-INF/context.xml file, or, if you deploy via files from outside
> > your WAR/dir application, then conf/[engine]/[hostname]/[appname].xml.
> >
>
> Yes, this is requiring the editing a application specific xml file.
>
>
> >
> > > I am more familiar with YAML so plan on configuring the
> > > redisson.conf as such.  I have read the referenced configuration
> > > wiki page:
> > >
> > > https://github.com/redisson/redisson/wiki/2.-Configuration
> > >
> > > However, it has a great deal of options and I'm not sure what is
> > > and is not needed.
> > >
> > > I am reaching out here on the Tomcat user group to see if anyone
> > > else is using Redisson for session management and if maybe I can
> > > get some guidance on a basic redisson.conf configuration.  I'd also
> > > be interested in comments on if there are better options or things
> > > to watch out for.
> >
> > I don't have any experience with either Redis or Redisson, but what is
> > wrong with the default/sample configuration you have provided above?
> >
>
> I have through much trial and error been using this config:
>
> {
>"masterSlaveServersConfig":{
>   "idleConnectionTimeout":1,
>   "connectTimeout":1,
>   "timeout":3000,
>   "retryAttempts":3,
>   "retryInterval":1500,
>   "failedSlaveReconnectionInterval":3000,
>   "failedSlaveCheckInterval":6,
>   "password":"",
>   "subscriptionsPerConnection":5,
>   "clientName":true,
>   "subscriptionConnectionMinimumIdleSize":1,
>   "subscriptionConnectionPoolSize":50,
>   "slaveConnectionMinimumIdleSize":32,
>   "slaveConnectionPoolSize":64,
>   "masterConnectionMinimumIdleSize":32,
>   "masterConnectionPoolSize":64,
>   "readMode":"SLAVE",
>   "subscriptionMode":"SLAVE",
>   "slaveAddresses":[
>  "   ],
>   "masterAddress":":6379",
>   "database":0
>},
>"threads":0,
>"nettyThreads":0,
>"transportMode":"NIO"
> }
>
> However, I am getting a couple exceptions and am not sure what might be the
> issue:
>
> INFO   | jvm 1| main| 2019/02/18 10:09:33.068 | Feb 18, 2019
> 10:09:33 AM org.apache.catalina.core.StandardContext startInternal
> INFO   | jvm 1| main| 2019/02/18 10:09:33.068 | SEVERE: The session
> manager failed to start
> INFO   | jvm 1| main| 2019/02/18 10:09:33.068 |
> org.apache.catalina.LifecycleException: Failed to start component
> [org.redisson.tomcat.RedissonSessionManager[]]
> INFO   | jvm 1| main| 2019/02/18 10:09:33.068 | at
> org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:167)
> INFO   | jvm 1| main| 2019/02/18 10:09:33.068 | at
>
> org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5224)
> INFO   | jvm 1| main| 2019/02/18 10:09:33.068 | at
> org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
> INFO   | jvm 1| main| 2019/02/18 10:09:33.068 

Re: nginx + Tomcat 9

2018-07-13 Thread Harpreet Sandhu
You should go with HAProxy. I have used it in the infra of one of Payment
Gateway..
It works really good.
Let me know.. if I can help you in setting up HAProxy.

Best,
Harpreet Sandhu

On Fri 13 Jul, 2018, 7:43 PM Giacomo Arru - BETA Technologies,
 wrote:

> Hi Simon,
>
> I only get oputput in logs with nginx debug, but it is way too much
> verbose and I can't determine why the connection times out.
>
> I get no useful messages in tomcat logs neither.
>
> I think I'll set up and HAProxy test environment and see how it works with
> my app and tomcat.
>
> I suspect I need the nginx+ payment options/support. I'm happy to pay but
> I've read about HAProxy vs nginx and it may be better fitting my needs; so
> it's worth the test.
>
>
> Giacomo
>
>
>
>
>
> Da: "Simon De Uvarow" 
> A: "users" 
> Inviato: Mercoledì, 11 luglio 2018 17:29:02
> Oggetto: Re: nginx + Tomcat 9
>
> On Wed, Jul 11, 2018 at 10:41 AM Giacomo Arru - BETA Technologies
>  wrote:
>
> > I tried to enable debug logging for org.apache.tomcat.websocket but
> > without success
> >
> > here is my logging.properties
> >
> >
> >
> > handlers = java.util.logging.ConsoleHandler
> >
> > .handlers = 1catalina.org.apache.juli.AsyncFileHandler,
> > java.util.logging.ConsoleHandler
> >
> > java.util.logging.ConsoleHandler.level = ALL
> > java.util.logging.ConsoleHandler.formatter =
> > org.apache.juli.OneLineFormatter
> >
> > org.apache.coyote.http2.level = ALL
> > org.apache.tomcat.websocket.level = ALL
> > org.apache.coyote.http11.Http11AprProtocol = ALL
> >
> >
> >
> >
> >
> > Giacomo
> >
> >
> >
> >
> >
> > Da: "Mark Thomas" 
> > A: "users" 
> > Inviato: Martedì, 10 luglio 2018 23:27:09
> > Oggetto: nginx + Tomcat 9
> >
> > On 10/07/18 17:59, Giacomo Arru - BETA Technologies wrote:
> > > Hi,
> > > we are using nginx as proxy for our web app deployed in Tomcat 9.
> > >
> > > The app uses websocket. The websocket connection dies after 30/40
> > seconds and we can't figure out why.
> > >
> > > Any suggestions?
> >
> > Turn on debug logging for the org.apache.tomcat.websocket package
> > Mark
> >
> > -
> > To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> > For additional commands, e-mail: users-h...@tomcat.apache.org
> >
> >
> > --
> > Questo messaggio stato analizzato con Libra ESVA ed risultato non
> infetto.
> > Seguire il link qui sotto per segnalarlo come spam:
> >
>
>
> I had a similar problem. I could resolved it by sending a keep alive
> message from the browser.
> If you still get disconnections (backend or middlerware could disconnect),
> you need some logic in the frontend to restart the connection.
> I didn't have to change any tomcat configuration, or the websocket code.
>
> You can test connecting direct to tomcat websocket (without nginx) to
> check
> where is the problem.
> You can also read these nginx configs:
> proxy_connect_timeout
> proxy_read_timeout
>
> Hope it helps,
>
>
> "No olvides, no traiciones, lo que llevas bien dentro de ti. No olvides,
> no
> traiciones, lo que siempre te ha hecho vivir."
>
> --
> Questo messaggio stato analizzato con Libra ESVA ed risultato non infetto.
> Seguire il link qui sotto per segnalarlo come spam:
>