我们使用单台 Tomcat 的时候不会有共享 sesssion 的疑虑,只要使用 Tomcat 的默认配置即可,session 即可存储在 Tomcat 上。但是随着业务的扩大,增加 Tomcat 节点构成 Tomcat 集群大势所趋,分布式带来了增加更大规模并发请求的优势,但是也随之到来了一个问题,每个 Tomcat 只存储来访问自己的请求产生的 session,如果 Tomcat-A 已经为客户端 C 创建了会话 session,那么 Tomcat-B 并不知道客户端已与集群中的 Tomcat-A 产生了会话,在访问时就会为 C 再创建一份 session,如果是基于 session 的验证会话权限的接口(如用户登录认证后才可访问的数据接口),将会导致在访问集群中不同节点的时候重复认证。session 的不共享导致原来的会话管理机制在 Tomcat 集群中无法工作。

Memcached or Redis? It’s a question that nearly always arises in any discussion about squeezing more performance out of a modern, database-driven Web application. When performance needs to be improved, caching is often the first step taken, and Memcached or Redis are typically the first places to turn.

These renowned cache engines share a number of similarities, but they also have important differences. Redis, the newer and more versatile of the two, is almost always the superior choice.
控制器提供访问应用程序的行为,通常通过服务接口定义或注解定义两种方法实现。 控制器解析用户的请求并将其转换为一个模型。在 Spring MVC 中一个控制器可以包含多个 Action(动作、方法)。

Monitoring the metrics and runtime characteristics of an application server is essential to ensure the adequate functioning of the applications running on that server, as well as to prevent or resolve potential issues in a timely manner.

As far as Java applications go, one of the most commonly used servers is Apache Tomcat, which will be the focus of this article.
Tomcat performance monitoring can be done either by relying on JMX beans or by using a dedicated monitoring tool like MoSKito or JavaMelody.