I have a java springboot application running in an Amazion ECS container. This application is reading data from Elasticache for Redis OSS using Jedis library. The Elasticache Redis replication group is running in non-clustered mode, with TLS, encryption at rest and in transit. Additionally, there is IAM based authentication mechanism in place. While running this application, I am noticing high lag in fetching the data from Elasticache Redis. On avg it is around 50 milliseconds and sometimes even going higher like 300-400 ms. Please note, both the ECS cluster and the Elasticahce Redis instance are running in same VPC in AWS.
I have tried changing the versions of Jedis client version, changing the instance size of Redis OSS from t2.medium to t3.large but no change is seen. Is there any obvious reason for this lag already known? Can you suggest me some ways to improve the performance to bring it down? Or am I making some mistake?