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

untymage's avatar

File vs Cookie (session drivers), Which is faster?

Hello i wanna choose on of the session driver that laravel provides, Which is faster ? I feel like if i choose cookie its better and faster and it store in user browser rather than my storage, what do you think?

0 likes
1 reply
MichalOravec's avatar

The fastest is memcached / redis.

User cookies have an upper limit of 4KB also cookie needs to be transmitted to and from the server on every request.

File based sessions have no size limits, and are more secure.

So if you have to choose only from file or cookie, definitely choose file.

2 likes

Please or to participate in this conversation.