Skip to content

TK's blog

This world is full of logic.

  • Tomcat
    • About Tomcat session cluster
    • How to setup Tomcat cluster
    • The problem of Tomcat session cluster
    • About Tomcat’s default session manager
    • About Tomcat DeltaManager
    • About Tomcat BackupManager
    • Tips on customizing session manager
    • Tomcat sticky session
    • Tuning Connection Pool for production system
  • Java
    • How to analyze high cpu usage of a Java program?
    • Java runtime parameters to enable JMX
    • Oracle JDBC slow connection on some virtual server
    • Java heap dump from command line
    • Mockito thenReturn() vs thenAnswer()
  • Spring framework
    • 8 ways to declare Spring beans
    • The inner working of DispatcherServlet
    • Implementing REST API with Spring MVC
    • About Spring ViewResolver
    • Sending data from controller to view
    • Spring Transaction with @Transactional explained
    • Combining multiple transactional method in one transaction
    • Simple ETL with Spring Batch
    • More on Spring Batch Reader
    • More on Spring Batch Writer
    • Spring Batch – Read once, Write multi example
    • Spring Batch tip – Partitioning
  • Mybatis
    • Mybatis cache mechanism
    • Integrating Mybatis with Spring
    • Using Ehcache instead of Mybatis internal cache
    • Some points to consider when using Mybatis cache
    • Implementing dynamic SQL on Mybatis
    • Parameterizing SQL on Mybatis
    • Handling big data on Mybatis
    • A tip on using user transaction on Mybatis
  • Redis
    • Installing Redis on Linux
    • Redis configuration for standalone mode
    • Setting Redis replication
    • Managing Redis replication with sentinel
    • Important Sentinel options
    • Internal working of Sentinel
    • Redis architecture for production
    • Tips on developing with Jedis
    • Redis replication gap tuning
  • Zookeeper
    • The use of Zookeeper
    • Building Zookeeper cluster
    • Programming Zookeeper – Connecting to Zookeeper
    • Programming Zookeeper – Watcher
    • Building a robust Zookeeper client : connection management
  • Kafka
    • Kafka first step – running a simple server
    • Building Kafka cluster
    • How Kafka Topic failover works?
    • How Kafka consumer works?
    • Managing Kafka log
    • At which point does Kafka consumer start to read
    • Some useful commands to manage Kafka
    • Kafka tip – keeping the order of delivery
  • MySQL
    • The difference of Isolation level – Read Committed vs Repeatable Read
    • MySQL gap lock, next key lock by example
  • Contact

Category: Redis

Redis replication gap tuning

Redis manages replication offset between master and slaves. If you type in "INFO REPLICATION" at redis-cli, the following output comes out. For the above result, offset number can vary depending on each environment. But slave0's offset should be equal or similar to master_repl_offset. The gap between master_repl_offset and slave's offset is the amount which is … Continue reading Redis replication gap tuning →

TK Redis Leave a comment January 16, 2019

Tips on developing with Jedis

When developing Java client, Jedis or Lettuce is used. Among them, Jedis is a lightweight Redis java client. There are pros and cons for Jedis. (As of this writing, 3.0.0-m1 is the latest) Pros Lightweight and faster than Lettuce API is easy and intuitive Cons Supports Redis 2 and 3 (Redis 4 is not supported … Continue reading Tips on developing with Jedis →

TK Redis Leave a comment November 30, 2018

Redis architecture for production

Redis is a very fast cache server. But in production, there is something to consider. Redis works in single thread To be exact, Redis is a multi threaded server. But the main logic runs in a single thread. For the following single Redis process when I check it's threads The result shows that a Redis … Continue reading Redis architecture for production →

TK Redis 1 Comment November 29, 2018

Internal working of Sentinel

This post is based on Redis 4.0.6. Main source of Sentinel is sentinel.c. When a Redis process is run in sentinel mode, sentinelTimer() is called. Inside it, all Sentinel's logic flows. The way to recognize the other Sentinel At initial Sentinel config, there is no info for the other Sentinels. There are only options for … Continue reading Internal working of Sentinel →

TK Redis Leave a comment November 28, 2018

Important Sentinel options

At the previous post, I wrote about setting up Sentinel. This post explains some important options for a production system. The following is a sample Sentinel config. (based on Redis 4.0.x) You can check full documentation here. sentinel monitor format : sentinel monitor <master-name> <ip> <redis-port> <quorum> master-name : master alias which is used as … Continue reading Important Sentinel options →

TK Redis Leave a comment November 20, 2018November 20, 2018

Managing Redis replication with sentinel

Setting up Redis replication is simple. But to support high availability, we need to set up sentinel. Sentinel's main functions are as follows. To monitor master and slave state If a master is down, sentinel promotes a new master among slaves (automatic fail over) If the old master runs again, sentinel changes it's role as … Continue reading Managing Redis replication with sentinel →

TK Redis 1 Comment November 19, 2018November 19, 2018

Setting Redis replication

Redis supports 1:N master-slave replication. Communcation between them is bi-directional. The following is step by step procedure. (Tested on version 4.0.6) Test environment 2 Redis are running on a host. One is master (port : 6379) and another is slave (port : 6479) Setting up replication Setting up replication happens only at slaves. The following … Continue reading Setting Redis replication →

TK Redis Leave a comment November 15, 2018November 15, 2018

Redis configuration for standalone mode

Running redis-server without any options is good for test, but not enough for production environment. To customize it, you need to build configuration file. The following options are from version 4.x. And you can refer full documentation here. Basic options for standalone mode bind some_ip  # If you do not set bind ip, then Redis … Continue reading Redis configuration for standalone mode →

TK Redis Leave a comment November 14, 2018

Installing Redis on Linux

We can install Redis on Linux by using pkg manager (i.e. yum on RHEL). But it is difficult to get the latest version in rpm. So I prefer to install it by compiling latest source code. The following is step by step procedure. (Tested on 4.0.6) 1. To download source code You can download  the … Continue reading Installing Redis on Linux →

TK Redis Leave a comment November 14, 2018
  • Tomcat
    • About Tomcat session cluster
    • How to setup Tomcat cluster
    • The problem of Tomcat session cluster
    • About Tomcat’s default session manager
    • About Tomcat DeltaManager
    • About Tomcat BackupManager
    • Tips on customizing session manager
    • Tomcat sticky session
    • Tuning Connection Pool for production system
  • Java
    • How to analyze high cpu usage of a Java program?
    • Java runtime parameters to enable JMX
    • Oracle JDBC slow connection on some virtual server
    • Java heap dump from command line
    • Mockito thenReturn() vs thenAnswer()
  • Spring framework
    • 8 ways to declare Spring beans
    • The inner working of DispatcherServlet
    • Implementing REST API with Spring MVC
    • About Spring ViewResolver
    • Sending data from controller to view
    • Spring Transaction with @Transactional explained
    • Combining multiple transactional method in one transaction
    • Simple ETL with Spring Batch
    • More on Spring Batch Reader
    • More on Spring Batch Writer
    • Spring Batch – Read once, Write multi example
    • Spring Batch tip – Partitioning
  • Mybatis
    • Mybatis cache mechanism
    • Integrating Mybatis with Spring
    • Using Ehcache instead of Mybatis internal cache
    • Some points to consider when using Mybatis cache
    • Implementing dynamic SQL on Mybatis
    • Parameterizing SQL on Mybatis
    • Handling big data on Mybatis
    • A tip on using user transaction on Mybatis
  • Redis
    • Installing Redis on Linux
    • Redis configuration for standalone mode
    • Setting Redis replication
    • Managing Redis replication with sentinel
    • Important Sentinel options
    • Internal working of Sentinel
    • Redis architecture for production
    • Tips on developing with Jedis
    • Redis replication gap tuning
  • Zookeeper
    • The use of Zookeeper
    • Building Zookeeper cluster
    • Programming Zookeeper – Connecting to Zookeeper
    • Programming Zookeeper – Watcher
    • Building a robust Zookeeper client : connection management
  • Kafka
    • Kafka first step – running a simple server
    • Building Kafka cluster
    • How Kafka Topic failover works?
    • How Kafka consumer works?
    • Managing Kafka log
    • At which point does Kafka consumer start to read
    • Some useful commands to manage Kafka
    • Kafka tip – keeping the order of delivery
  • MySQL
    • The difference of Isolation level – Read Committed vs Repeatable Read
    • MySQL gap lock, next key lock by example
  • Contact
Blog at WordPress.com.
Cancel

 
Loading Comments...
Comment
    ×