Sunday, September 27, 2015

How to Build Robust Application



https://en.wikipedia.org/wiki/Robustness_principle
Be conervative in what you do, be liberal in what you accept from others (often reworded as "Be conservative in what you send, be liberal in what you accept").

In tcp: In other words, code that sends commands or data to other machines (or to other programs on the same machine) should conform completely to the specifications, but code that receives input should accept non-conformant input as long as the meaning is clear.

容错技术介绍
容错按系统级别划分,分为三个级别,硬件容错、软件容错以及系统容错。硬件容错常用的方法包括使用冗余、多备份技术、增加内存、能源系统冗余等。硬件错误通常能够够在两个物理机上进行隔离处理。软件容错主要是正对软件的鲁棒性特征进行增强。常见的方法有checkpoint/restart,recovery blocks,N-Version Programs等。对于系统容错,设计一个独立与目标系统的子系统,通过定义定义规则来容忍系统缺陷。对缺陷的处理,有以下几类技术:

  1. 使用缺陷避免技术来避一些错误。使用成熟的设计方法论、验证以及确认方法论、代码检查、上线前的演练等。
  2. 在可能会存在的缺陷时,可以选择缺陷移除技术,例如测试、集成测试、回归测试、背靠背测试等;
  3. 或者是在遭遇错误是,缺陷回避的方式,是的潜在的缺陷不会被激活。常见技术是通过重新配置系统来达到避免的目标;
  4. 缺陷容忍技术,系统能够对缺陷进行侦测、诊断、孤立、覆盖、不错、以及系统恢复。使用以上多种技术混合。

2. Graceful Degradation

在系统遭遇某个错误不能提供完整功能,系统可以降低自己服务能力。
上述backup()方法中while循环中waitpid需要等待到child创建成功。可能永远不会成功,需要改进。

3. Selective Retry


重复调用仅当有机会重试成功。例如,内存短缺消失;主要针对突然地高负载资源短缺。它能够增加资源分配成功的可能性



Labels

Review (572) System Design (334) System Design - Review (198) Java (189) Coding (75) Interview-System Design (65) Interview (63) Book Notes (59) Coding - Review (59) to-do (45) Linux (43) Knowledge (39) Interview-Java (35) Knowledge - Review (32) Database (31) Design Patterns (31) Big Data (29) Product Architecture (28) MultiThread (27) Soft Skills (27) Concurrency (26) Cracking Code Interview (26) Miscs (25) Distributed (24) OOD Design (24) Google (23) Career (22) Interview - Review (21) Java - Code (21) Operating System (21) Interview Q&A (20) System Design - Practice (20) Tips (19) Algorithm (17) Company - Facebook (17) Security (17) How to Ace Interview (16) Brain Teaser (14) Linux - Shell (14) Redis (14) Testing (14) Tools (14) Code Quality (13) Search (13) Spark (13) Spring (13) Company - LinkedIn (12) How to (12) Interview-Database (12) Interview-Operating System (12) Solr (12) Architecture Principles (11) Resource (10) Amazon (9) Cache (9) Git (9) Interview - MultiThread (9) Scalability (9) Trouble Shooting (9) Web Dev (9) Architecture Model (8) Better Programmer (8) Cassandra (8) Company - Uber (8) Java67 (8) Math (8) OO Design principles (8) SOLID (8) Design (7) Interview Corner (7) JVM (7) Java Basics (7) Kafka (7) Mac (7) Machine Learning (7) NoSQL (7) C++ (6) Chrome (6) File System (6) Highscalability (6) How to Better (6) Network (6) Restful (6) CareerCup (5) Code Review (5) Hash (5) How to Interview (5) JDK Source Code (5) JavaScript (5) Leetcode (5) Must Known (5) Python (5)

Popular Posts