微服务经典面试题

image-20250316105303531

SpringCloud

常见组件有哪些

image-20250316105506529

image-20250316105528515

注册中心eureka、nacos

image-20250316105614434

image-20250316105818495

image-20250316105905690

image-20250316105921661

image-20250316110049741

image-20250316110232221

AP模式:高可用模式;CP模式:强一致模式

Ribbon负载均衡,负载均衡策略,自定义负载均衡

image-20250316110427652

image-20250316110542021

image-20250316110847256

Ribbon的默认负载均衡策略是最后一个——区域敏感策略。如果没有区域的概念,那就默认是轮询。

image-20250316111048381

image-20250316111246278

服务雪崩、熔断降级

image-20250316114338143

image-20250316114452972

image-20250316114645732

image-20250316114818116

服务降级针对的是某个接口,是部分服务;服务熔断针对的是整个服务。

微服务的监控—skywalking

image-20250316115332879

image-20250316115828442

image-20250316115907630

业务相关

微服务限流(漏桶算法、令牌桶算法)

image-20250316162355485

image-20250316162612222

image-20250316162713192

image-20250316163010192

令牌桶需要使用Redis,所以需要在对应文件配置redis。

image-20250316163148725

令牌桶和漏桶,区别在于漏桶是以固定速率漏出请求,而令牌桶给出令牌的速率不固定,根据有多少请求申请令牌决定。

分布式系统理论—CAP和BASE

image-20250316163349889

image-20250316163416467

image-20250316163458662

image-20250316163523720

image-20250316163709035

image-20250316164228900

image-20250316164310170

分布式事务解决方案

image-20250316165541361

image-20250316170212082

image-20250316170734684

image-20250316171606306

AT模式推荐且常用。

image-20250316172818753

TCC中的Try、 Confirm、cancel三步需要手动代码实现,代码耦合度高。而XA和AT是依赖框架自动完成的。代码耦合度低。

image-20250316174630144

MQ是异步的,性能较高,但需要手动解决,实时性较差。

image-20250316175936551

银行业务需要强一致性;互联网业务需要高可用性。

分布式服务的接口幂等性如何设计

image-20250316181816307

image-20250316181944806

image-20250316182124351

image-20250316182159634

image-20250316182321589

你们项目中使用了什么分布式任务调度—xxl-job

image-20250316182500286

image-20250316182621399

image-20250316182715668

image-20250316182946883

image-20250316183044011