Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

marbobo's avatar
Level 12

Is it okay to use the same driver and database for session and cache? i am talking about redis driver

hi guys. so in few days we will be launching our project. and the estimated users that will use actively is around 1k - 5k. currently our session driver is database because it is not yet officially release. but I have setup redis already as a session driver. I just wondering if it is okay to use redis for session driver and also use it as cache driver (same driver and same database).. because I am wondering if I will seperate my session driver and cache driver. what do you think guys? I need anykind of tips. btw the server will be hosted using aws and i am planning to use elasticache redis or memcache.

0 likes
5 replies
marbobo's avatar
Level 12

thank you for spending time answering my inquiries. do you think it will not affected the performance if the cache and session is store in the same driver and database?

rodrigo.pedra's avatar

It shouldn't. As you said you are using the managed Redis from AWS it is even less likely to have any performance issue. And if, in the future, your user base grows a lot that this becomes a possibility, you can switch to a different driver then, or move to something like Vapor.

When a large user-base becomes a performance issue, I usually say it is a good problem to solve.

Just be sure to have them (your app and the Redis Cache) on the same VPC, to avoid any network latency, and you should be good to go.

1 like
marbobo's avatar
Level 12

you mean vapor the serverless service by taylor right? I'll ask another question. do you think it is much better option to go serverless (lambda) for our project? because right now we are not even release we are still on pre registration phase and a lot of users already registered and subscribed to our premium plan. so I am expected a much more active users when we go live.

our current stacks is a ec2 vm i am checking about auto scale on aws but i dont really have real experience with it. also in lambda i dont have experience. i am familiar with it but no real experience.

what should be the best way to proceed? going serverless with lambda or with autoscaling in aws?

rodrigo.pedra's avatar

It depends on the usage load you're expecting. By your description (1k-5k users) I would start with an EC2, but if your project is somehow very usage intensive maybe exploring Vapor can be an option.

By Vapor I mean the Laravel offering.

As you are concerned with performance, take a look on these articles, if you have time:

https://usefathom.com/blog/moved-to-vapor

https://laravel-news.com/5-ways-to-write-laravel-code-that-scales

But I would say that if your app is ready for showtime, deploy it on the infra-structure you are more familiar with and optimize as the needs for it arise.

The sooner you start running your app, the sooner you receive feedback from real usage on it.

Please or to participate in this conversation.