냐옹펀치

본문 바로가기
사이트 내 전체검색

3

자유게시판

자유게시판

Django local memory caching not working on heroku

페이지 정보

작성자 cd4c2678f147490175.120.25.235
댓글 5건 조회 81회 작성일 2023년 9월 13일 7:18 오전

본문

about local memory cache on Heroku
In general local memory cache works fine on Heroku. There is a limitation though: both the local_cache dict and the Django locmem cache backend are local to the process and the dyno.

So, for example, if you are using gunicorn, it will by default use sub-processes to handle the requests. And each subprocess will have its own locmem cache. The default WEB_CONCURRENCY setting is at least 2, depending on the dyno size.

Now about the general setup question:
In general local caching can be totally fine (and extremely fast) for production use, if the process/dyno-limitation is fine for you, and the fact that you cannot clear the whole cache without restarting all your dynos.

File system caching also works, but is again only local to your dyno, which means cleaning it is only possible by restarting all your dynos.

In an environment with multiple servers / containers for one application it is actually better to have a separate cache somewhere like redis, memcached, ... which all the dynos can access.

cache and OTP
in general you can use the cache here to store the token. The risk in here is, depending on the actual cache backend: if the cache is full, it will remove data. This is normally fine for a real cache, but it would be a problem for OTP.

In your case you could configure separate cache only for the OTP tokens, which is big enough to hold all currently valid tokens.

댓글목록

프로필이미지

님의 댓글의 댓글

아이피 (175.120.25.235) 작성일

https://stackoverflow.com/questions/69380984/django-local-memory-cache-is-re-fetching-each-time

프로필이미지

님의 댓글의 댓글

아이피 (175.120.25.235) 작성일

ubuntu django local memory cache not working

프로필이미지

님의 댓글의 댓글

아이피 (175.120.25.235) 작성일

https://docs.djangoproject.com/en/2.0/topics/cache/#local-memory-caching

프로필이미지

님의 댓글의 댓글

아이피 (175.120.25.235) 작성일

https://devcenter.heroku.com/articles/django-memcache

프로필이미지

님의 댓글의 댓글

아이피 (175.120.25.235) 작성일

https://www.honeybadger.io/blog/caching-in-django/

회원로그인

회원가입

사이트 정보

회사명 : 회사명 / 대표 : 대표자명
주소 : OO도 OO시 OO구 OO동 123-45
사업자 등록번호 : 123-45-67890
전화 : 02-123-4567 팩스 : 02-123-4568
통신판매업신고번호 : 제 OO구 - 123호
개인정보관리책임자 : 정보책임자명

Copyright © 소유하신 도메인. All rights reserved.