Skip to content

Redis session #5822

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
trondkr opened this issue Jul 18, 2019 · 2 comments
Closed

Redis session #5822

trondkr opened this issue Jul 18, 2019 · 2 comments

Comments

@trondkr
Copy link

trondkr commented Jul 18, 2019

Hi, I have an AWS Redis server I set up to use for Parse Server cache and session. The setup for session and cache is shown below. My problem is that even when the server is not being called, at least a few commands are issued to the Redis server every second and a new session key is stored. After 2 days of running the server its reached 200K keys. This happens when my app is not running at all.

I wonder if I am using the wrong settings or if something else could be wrong? It would be great if someone could share with me their setup of a similar system.

System : "parse-server": "3.5.0", "connect-redis": "^3.4.1", "redis": "*"

Thanks. Cheers, Trond

var RedisCacheAdapter = require('parse-server').RedisCacheAdapter;
var Redis = require("ioredis");
var RedisStore = require('connect-redis')(session);

var redisOptions  = {url: process.env.REDIS_URL};
var redisCache = new RedisCacheAdapter(redisOptions)
var redisiosClient = new Redis(process.env.REDIS_URL);

app.set('trust proxy', 1);
app.enable('trust proxy');
app.use(session({
     name:'sessions',
        secret: process.env.COOKIE_SESSION_SECRET,
       proxy: true, 
       resave: false,
       saveUninitialized: false,
       store: new RedisStore({
            client:redisiosClient,
            ttl: 7 * 24 * 60 * 60
      })
 }));

Screenshot 2019-07-17 at 20 34 03

@davimacedo
Copy link
Member

I think this issue is not related to Parse Server. You might want to ask some help in connect-redis repository. Anyway, here it goes my piece of help: Do you have some health check running time by time? Perhaps in an AWS Load Balancer? It seems that you have something hitting your servers and opening new sessions regularly.

@trondkr
Copy link
Author

trondkr commented Jul 19, 2019

@davimacedo Thanks for your help on this. The problem was solved by using sticky session and the number of operations explained by AWS load balancer doing periodic checking.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants