Software Architecture - Caching
Caching = menyimpan data sementara.
1. Jika disimpan data di database
Memory DB, Redis atau Memcache. Ketika ada request masuk maka akan masuk ke memory database.
2. Time to leave (TTL), di dlm memory DB akan di delete, redis atau memcache sudah ada fitur TTL, utk service lain
3. data yg dicache lebih dari Kapasitas RAM. Cara melakukan delete di cache. yaitu :
- Delete Oldest data => LIFO data
- Delete oldest access => LIFO delete utk data yg paling lama diakses/ paling terakhir diakses.
memory Db skrng sudah bagus fitur delete oldest akses
Cache data structure :
key - value
Tidak semua jenis query dapat di cache, dan harus by id
jika cache searching product by name, ketika query ke DB ada 50 product, kemudian di cache
Database punya cache feature atau tidak ?
MySQL punya fitur caching sebagian disimpan di harddisk, dan sebagian di memory. mysql punya bawaan ketika data diakses terus maka disimpan di memory.
Software Architecture - Caching
Reviewed by Riventus
on
January 27, 2021
Rating: 5
Software Architecture - Caching
January 27, 2021 by Author
0 comments:
Post a Comment