lnt+memcache realizes seesion sharing

illustrate

In the previous chapter nginx+tomcat+redis load balancing to achieve session sharing , this time we use another method to achieve session session sharing, and to achieve a set of online running environment,

reset prompt

This time, the focus will be on the implementation of memcache and keepalived functions

lab environment

jdk:  8u141
tomcat:  8.5.30  * 2 
nginx:  1.12.1    * 2
keepalived:  yum
memcache:    yum   * 2   
IP地址: 192.168.172.129-134   总六台  第一次手动加简单的ansible,第二次直接用ansible其它的(学习中)     

Software download:
memcached-session-manager

需要下载的包[memcached-session-manager-tc8-2.3.0、spymemcached-2.12.3、memcached-session-manager-2.3.0、msm-javolution-serializer-2.1.1,javolution-5.4.3.1] 

java 需要下载的包jdk-8u141-linux-x64

Topology

lnt+memcache realizes seesion sharing

Topology - Experiment Description

  1. Keepalived realizes high availability of Nginx load balancing, and keepalived realizes high service availability will be implemented in this chapter;
  2. Nginx reverse proxy tomcat server, we will not use the IP address here, but directly use the host name to achieve it, When tomcatA hangs up, go online directly to replace tomcatB but the host name remains the same, use the docker network method;
  3. We will directly use the memcacehd method for session maintenance. This chapter will focus on emphasizing it, as well as the final comparison with redis;
  4. If there are any recruiters, please accept me. The name is my Q. You can add me at any time, Beijing area.
  5. If you want to realize the pre-warming function of the database and the function of KEY corresponding to memcached, you need to connect with the development.

Description of memcache

memcache features

  Memcached is an open source, high-performance memory storage software. As a high-speed distributed cache server, memcached has the following characteristics.

  • 1. Completely based on memory cache
  • 2. Nodes are completely independent
  • 3. The cached data exists in the form of kv
  • 4. There is no persistence mechanism. Once the server is restarted, this part of the data will be lost.
  • 5. When the data capacity of the memory cache exceeds the set memory value, the Lru algorithm is automatically used to delete the expired kv pair.
  • 6. Memcache will divide the set memory into blocks, then group the blocks, and then provide services
  • 7. cs architecture
  • 8. The distributed memcached does not communicate with each other, and is implemented as a consistent Hash modulo, (3 mem stores only one N%3 at a time, and the same is true)

memcace tutorial
  Memcached is concise and powerful. Its concise design facilitates rapid development, reduces the difficulty of development, and solves many problems in large data caches. Its API is compatible with most popular development languages.
  The general purpose of use is to reduce the number of database accesses by caching database query results, so as to improve the speed and scalability of dynamic Web applications.
lnt+memcache realizes seesion sharing

Related questions

1. What is Memcached and what does it do?
  Memcached is an open source, high-performance memory storage software . Its
  function is to temporarily cache all kinds of data in the database in the pre-planned memory space, so as to reduce the direct concurrent access of the database, thereby improving the access performance of the database.

2. Memcache memory management mechanism
  Memcache uses the slab allocation mechanism to allocate and manage memory. The general principle is to first divide the memory allocated for memcache into memory blocks of a specific length according to a predetermined size, and then group the blocks. These memory blocks will not be released. , can be reused.
  Disadvantages of Slab Allocator: Since the allocated length is fixed, the allocated memory cannot be used effectively

3. What are the differences between memcache and redis
  Data types: redis supports more data types and data features than memcache, such as set list
  performance: memcache is completely based on memory, while redis is a cache that supports persistence. Memcached, but after memcached restarts, the data will be completely lost
  and persistent: once memcache restarts, all data will be lost. Redis has various mechanisms, such as master-slave, sentinel + master-slave, and clustering.

4. How to implement Memcached service distributed cluster?
  Memcached clusters are different from web service clusters. The sum of all Memcached data is the database data. Each Memcached is partial data.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325390155&siteId=291194637