Page 1 of 1

face the following repeated

Posted: Thu Dec 26, 2024 4:09 am
by rriiffaatt77
Why use a unique database index as a backup because the cache may fail? When faced with this problem, students often only answer “use redis distributed locks to achieve idempotence”, which is wrong. Since the cache may fail, distributed locks are only a means to prevent concurrent operations and cannot fundamentally solve the idempotence problem by relying on a unique database index. Most simple payment systems are basically sufficient as long as the job is idempotent. 6. Subdatabase and subtable When the amount of data is large, subdatabase and table are inevitable. A classic interview question is: If the tables are divided, should the tables be divided by traders or by the trader's order numbers? If the tables are divided by traders,How to solve the problem of balancing the data flow volume of each table? If the table is divided by the number of merchant orders, what should the merchant do if he wants to query by time period? There are many solutions.



A typical solution is to divide the online database into tables australia email list according to the number of merchant orders, while having an offline database for redundant data in tables according to the number of merchants, or even directly using the capabilities of the offline data platform to query merchants by time period. The requirements are separated from the online library. 6.. Distributed transactions Distributed transactions are a good thing, but they are also very complex, and the so-called transaction suspension problems often occur. And although every company claims that it is simple and easy to use, with less intrusion into business code, this is not the case.



So I personally prefer to avoid using distributed transaction solutions and use eventual consistency instead. For most small and medium-sized businesses, some consistency is sufficient. 6.5 Amount Processing Specifications Teams with little R&D experience often make the following mistakes: There is no single, defined money class, and data types such as BigDecimal, double, and long are used across different systems for processing and storing amounts. A unified money class is defined, but it is not strictly followed in the code. There is still some code that uses BigDecimal, double, long, and other data types to process amounts.