> For the complete documentation index, see [llms.txt](https://kk-5.gitbook.io/interview/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://kk-5.gitbook.io/interview/jia-gou.md).

# 架构

1\)常见的缓存策略

A)WEB缓存 B)应用程序缓存 C)数据库缓存 D)REDIS等服务器端的缓存

2\)分布式ID生成

数据库或者使用UUID的方式,REDIS生成ID

3\)分布式事务

两段式提交和补偿机制

两段式:事务协调器,统一通知各个客户端统一调用,在收到各个客户端回复后,开始告诉各个客户端开始调用

补偿:先处理业务,然后在定时或者是回调查看业务是否处理完成.如果不一致强制所有状态到某一个回滚点

XA:有一个全局的事务管理器和局部的资源管理器,事务管理器负责全局事务,并协调资源.在分布式更新阶段各个服务器首先标志自己已经完成,如果所有节点都回答准备好提交,空值服务器指示他们提交并等待响应.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://kk-5.gitbook.io/interview/jia-gou.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
