REDIS & Elasticsearch

김지영·2022년 6월 26일
0

Above is my understanding of how search(ing for data in database) works.

The client sends the user's request to backend, and it will check the database to see if the data is available. However, repeating this for every request can be time-consuming, since each request means the backend will access the DB (at least) once.

Redis provides fast access to DB with its in-memory data structures. While being fast, Redis is also non-volatile (since "volatility" is what comes in our minds the first when we think of anything in-memory...) because it writes to permanent storage (i.e. disk).

As you can see in my pipeline diagram above, when there is a cache miss (i.e. data not available in Redis), backend will proceed with the request it received and visit the on-disk DB. Then there is ElasticSearch.

ElasticSearch's powerful design allow queries to get rapid results. Their implementation of inverted indices is the main characteristic of the search engine. Search queries do not need to visit all the rows of a table because each term is indexed. (I'm not sure if my explanation is accurate here... but basically, ElasticSearch is very fast 🤪)

profile
아줌마

0개의 댓글