In the last session a few different concepts were taught:
- ACID properties
- SQL transaction modes with demonstration on different levels
- Redis caching
My understanding of these concepts are as follows:
1. ACID properties: We were taught about atomicity and isolation. So atomicity simply means that either a transaction occurs or it doesn't. There shouldn't be any intermediate results for a transaction. For example, let us consider a transaction whereby a transfer of money is occuring from one bank account to another, if the debit occurs from the sender's account but fails at a point before crediting in receiver's account, the transaction is rolled back. We were also taught about isolation which means when two or more transactions are parallely running, data access and writing should not affect each other and it also entirely depends on the requirement.
2. SQL transactions: I tried queries in MySQL between different transaction using different modes: READ-COMMITTED, READ-UNCOMMITTED, REPEATABLE-READ and SERIALIZABLE.
3. Redis caching: We were taught about redis and its uses. Two different scenarios were demonstrated and performance was evaluated using locust tool. When we didn't use redis for caching the read operations on a large database consisting of 1 lakh records in a specific table. When the load testing was tried, we got about 40,000 requests throughout the test period. After redis cache was introduced to the same scenario, we got about 84,000 requests. We followed cache aside technique for the application and it had clear improvements in number of requests it could handle. Cache aside works as follows:
Request comes from client ---> Redis cahce is checked for data ---> If data is present, return the data ---> If data is not present, the request is sent to the database ---> Fetched data is stored in redis cache for subsequent requests ---> Data is returned to the client.
Top comments (0)