Using Redis For Session Storage

Wesley13
• 阅读 575

A few days back, I was just messing around with Redis and all of a sudden there was a necessity where I had to externalize the sessions from Apache Tomcat. Redis seemed to be a great option for this. It took a bit of tweaking, but by the end, things were as smooth as ever. I thought of designing the architecture to show how Redis can help us by being the ultimate session store with really low latency. The diagram below depicts the entire scenario with great precision.

Using Redis For Session Storage

Here's my explanation for the diagram above:

1、Any request coming from the internet would be received by the web server first. The web server is running with a load balancer configured.

2、There would be multiple Tomcat instances running across the app layer which would be connected with the common Redis Server (I have not looked into Redis Cluster so am not mentioning it here).

3、Next we would follow the traditional approach; any request coming from the internet would go through the load balancer which would then decide which container to send it to.

4、Since different containers are connected to the same Redis server, and we have externalized the session management, even if one server goes down the sessions will remain intact and the other Tomcat containers would replace any downed servers, leaving behind a great experience. This model could be scaled pretty well.

This approach can easily scale up the web application and also is easy to set up. I would write a detailed article about the setup in some time.

点赞
收藏
评论区
推荐文章
Stella981 Stella981
3年前
Redis Linux 安装运行实战全记录
下载Redis去Redis官网下载最新的Linux包,Redis官方没有Windows版的下载。https://redis.io/(https://www.oschina.net/action/GoToLink?urlhttps%3A%2F%2Fredis.io%2F)下载后把包上传到Linux服务器。安装Red
Stella981 Stella981
3年前
Jenkins+Ansible+Gitlab自动化部署三剑客
JenkinsAnsibleGitlab自动化部署三剑客小中大showerlee2016031113:00Ansible(https://www.oschina.net/action/GoToLink?urlhttp%3A%2F%2Fwww.
Wesley13 Wesley13
3年前
P2P技术揭秘.P2P网络技术原理与典型系统开发
Modular.Java(2009.06)\.Craig.Walls.文字版.pdf:http://www.t00y.com/file/59501950(https://www.oschina.net/action/GoToLink?urlhttp%3A%2F%2Fwww.t00y.com%2Ffile%2F59501950)\More.E
Stella981 Stella981
3年前
Redis安装部署
1.下载安装包官网地址:https://redis.io/download(https://www.oschina.net/action/GoToLink?urlhttps%3A%2F%2Fredis.io%2Fdownload)2.解压tarxzvf redis5.0.5.tar.gz3.编译安装cdred
Stella981 Stella981
3年前
Python 环境搭建
pythonbug集目录\toc\00python模块下载地址pyhton模块下载地址(https://www.oschina.net/action/GoToLink?urlhttp%3A%2F%2Fwww.lfd.uci.edu%2F%7Egohlke%2Fpythonlibs%2F)01pythonpip
Stella981 Stella981
3年前
Redis 响应延迟问题排查
参考原文:http://redis.io/topics/latency(https://www.oschina.net/action/GoToLink?urlhttp%3A%2F%2Fredis.io%2Ftopics%2Flatency)最近数据量越来越多,并发写操作很多的情况下,Redis出现响应慢的情况;可以使用Redis命令来测试一下
Easter79 Easter79
3年前
Swift项目兼容Objective
!456.jpg(http://static.oschina.net/uploads/img/201509/13172704_1KcG.jpg"1433497731426906.jpg")本文是投稿文章,作者:一叶(博客(https://www.oschina.net/action/GoToLink?urlhttp%3A%2F%2F00red
Easter79 Easter79
3年前
The Complete Guide To Rooting Any Android Phone
PhoneWhitsonGordon(https://www.oschina.net/action/GoToLink?urlhttp%3A%2F%2Fwww.lifehacker.com.au%2Fauthor%2Fwhitsongordon%2F)7April,20118:00AMShare(https://ww
Stella981 Stella981
3年前
CentOS 下 Redis 安装图解
下载redis.tar下载tar地址为:http://redis.io/download(https://www.oschina.net/action/GoToLink?urlhttp%3A%2F%2Fredis.io%2Fdownload)!image(http://static.oschina.net/up
Stella981 Stella981
3年前
Redis官网——如何利用Redis做服务器集群的分布式锁
链接:http://redis.io/topics/distlock(https://www.oschina.net/action/GoToLink?urlhttp%3A%2F%2Fredis.io%2Ftopics%2Fdistlock)原理很简单,一段时间内轮询加锁的key重点,不同语言的开源实现Beforedescribingth