perf: php session is always written because of __MTIME value#9885
perf: php session is always written because of __MTIME value#9885tpayen wants to merge 1 commit into
Conversation
|
As far as I can see the ps. why don't you use the |
|
Yeah ok I thought the
We are using a Redis backend as session handler, so we don't have choice ;-) But we also have lock session issues with redis so we are thinking to change maybe for redis sentinel |
Yes, I suppose.
|
Yes, we use 'php' as 'session_storage' with session_handler configured with 'RedisCluster' 'cause we use a redis cluster (multiple masters) and it's not supported in roundcube : But as RedisCluster doesn't support session locking, this isn't the best option. If we go to Redis Sentinel, I'll probably make a PR to support sentinel in roundcube (the client needs to know the sentinels). We need clustering as we have 100k-150k very actives users |
On each request the session
__MTIMEvariable is updated with thetime()value so the session is written on each request.It can be a performance issue when using shared session handler as Redis, as we can see a lot of network traffic to update all this data.
To reduce the network consumption we choose to update
__MTIMEonly a time to time, and a little arbitrary we choose to do it each 1/10 session lifetime. As__MTIMEacted probably as a keep alive for the session, it's steel a good idea to update it regulary, but not too regularyIn our infrastructure, this change reduce the network consumption of Redis by half, so I think it worth the change