Django Sessions

前端 未结 5 1474
野趣味
野趣味 2021-01-31 15:34

I\'m looking at sessions in Django, and by default they are stored in the database. What are the benefits of filesystem and cache sessions and when should I use them?

5条回答
  •  名媛妹妹
    2021-01-31 16:12

    One thing that has to be considered when choosing session backend is "how often session data is modified"? Even sites with moderate traffic will suffer if session data is modified on each request, making many database trips to store and retrieve data.

    In my previous work we used memcache as session backend exclusively and it worked really well. Our administrative team put really great effort in making two special memcached instances stable as a rock, but after bit of twiddling with initial setup, we did not have any interrupts of session backends operations.

提交回复
热议问题