kleydon / prisma-session-store

Express session store for Prisma
MIT License
116 stars 18 forks source link

Response time #57

Closed thvozdovic closed 2 years ago

thvozdovic commented 2 years ago

Hey, I'm using this prisma session store but I noticed the response time is almost 10x longer than when using memorystore, is this expected or not?

Making a request to a non-existent page without the prisma session store takes about 40ms on average, while it takes around 450ms when the prisma store is used.

kleydon commented 2 years ago

Hi @thvozdovic,

Strange; hadn't encountered this.

Authentication will take significantly longer than requesting a non-existent page, since it requires at least one db request/response, and possibly more than that if the page requires dynamic data. (If you're coming from using JWTs or equivalent for authentication, this "extra" db hit, for each page-load, may seem surprising.)

But as for why this session store might take longer than another session store - Not sure why that would be...

Perhaps in the transpilation from typescript to javascript, optimization is not yet what it should be?

Another though: in-memory data stores are significantly faster than their alternatives. If memorystore is in-memory (as its name suggests), and the database you are using with prisma-session-store is not in-memory (e.g. postgres, mysql, etc): Perhaps that could account for the speed difference?

kleydon commented 2 years ago

Anyone still experiencing unexpected reponse time issues with prisma-session-store?

kleydon commented 2 years ago

Closing for now; we can re-open if this re-surfaces.