可用性原则 logo

可用性原则

Organization
microwind
可用性原则

设计系统使其在各种条件下都能持续提供服务,最大化正常运行时间和服务质量。

Overview

Publishermicrowind
Repositoryai-skills
Skill name可用性原则
Stars
93
Forks
25
Bundled files
2
LicenseMIT
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • 2 bundled files

    Scripts, templates, and references the model can read while it works. Files are read-only and never executed.

  • Open source

    Published by microwind on GitHub. Read the source before you install it.

Installation

Install the 可用性原则 AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/microwind/ai-skills/tree/main/design-principles/availability-principle
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/microwind/ai-skills.git /tmp/ai-skills
mkdir -p .claude/skills
cp -r /tmp/ai-skills/design-principles/availability-principle .claude/skills/microwind-36
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable 可用性原则 in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads 可用性原则 on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so 可用性原则 is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

可用性原则 (Availability Principle)

概述

可用性衡量系统正常提供服务的时间比例:系统应该在用户需要时可用。

可用性等级:

等级可用率年停机时间
2个999%3.65天
3个999.9%8.76小时
4个999.99%52.6分钟
5个999.999%5.26分钟

提高可用性的策略

1. 冗余设计

单点故障消除:

❌ 单点架构
Client → [单一服务器] → [单一数据库]

✅ 冗余架构
Client → [负载均衡器]
            ├→ [服务器A] ──→ [主数据库]
            ├→ [服务器B]      ↕ 同步
            └→ [服务器C] ──→ [从数据库]

2. 健康检查

java
// ✅ 健康检查端点
@RestController
public class HealthController {

    @GetMapping("/health")
    public ResponseEntity<Map<String, String>> health() {
        Map<String, String> status = new LinkedHashMap<>();

        // 检查数据库
        try {
            jdbcTemplate.queryForObject("SELECT 1", Integer.class);
            status.put("database", "UP");
        } catch (Exception e) {
            status.put("database", "DOWN");
            return ResponseEntity.status(503).body(status);
        }

        // 检查缓存
        try {
            redisTemplate.opsForValue().get("health-check");
            status.put("cache", "UP");
        } catch (Exception e) {
            status.put("cache", "DOWN");
        }

        status.put("status", "UP");
        return ResponseEntity.ok(status);
    }
}

3. 优雅降级

python
class ProductService:
    def __init__(self, db, cache, recommendation_service):
        self.db = db
        self.cache = cache
        self.recommendation_service = recommendation_service

    def get_product_page(self, product_id: str) -> dict:
        # 核心功能:必须可用
        product = self._get_product(product_id)

        # 非核心功能:降级处理
        try:
            recommendations = self.recommendation_service.get(product_id)
        except ServiceUnavailableError:
            recommendations = []  # 推荐服务挂了,返回空列表,页面仍可用

        return {"product": product, "recommendations": recommendations}

    def _get_product(self, product_id: str):
        # 缓存降级
        try:
            return self.cache.get(f"product:{product_id}")
        except CacheError:
            return self.db.find_product(product_id)  # 缓存挂了走数据库

4. 超时与重试

typescript
// ✅ 合理的超时和重试策略
async function callExternalService(url: string): Promise<Response> {
    const maxRetries = 3;
    const timeout = 3000;  // 3秒超时

    for (let attempt = 1; attempt <= maxRetries; attempt++) {
        try {
            const controller = new AbortController();
            const timeoutId = setTimeout(() => controller.abort(), timeout);

            const response = await fetch(url, { signal: controller.signal });
            clearTimeout(timeoutId);

            if (response.ok) return response;

            // 5xx 错误重试,4xx 不重试
            if (response.status < 500) throw new Error(`Client error: ${response.status}`);
        } catch (error) {
            if (attempt === maxRetries) throw error;
            // 指数退避
            await sleep(Math.pow(2, attempt) * 100);
        }
    }
    throw new Error('Max retries exceeded');
}

可用性检查清单

□ 无单点故障(数据库、缓存、服务都有冗余)
□ 有健康检查接口
□ 非核心功能支持降级
□ 外部调用有超时设置
□ 有失败重试机制(带退避策略)
□ 有监控告警(响应时间、错误率、资源使用)
□ 有灾备方案和恢复演练
□ 部署支持滚动更新(零停机发布)

与其他原则的关系

原则关系
容错性容错是可用性的技术保障
可扩展性扩展能力防止过载导致不可用
关注点分离核心与非核心分离,支持独立降级

总结

核心:消除单点故障、优雅降级、快速恢复。

实践:冗余部署、健康检查、超时重试、监控告警。

Bundled files

The model reads these on demand while the skill is loaded. They are exposed as readable files and are never executed.

Frequently asked questions

What does the 可用性原则 AI skill do?

设计系统使其在各种条件下都能持续提供服务,最大化正常运行时间和服务质量。

Why use 可用性原则 on TypingMind?

Because you install it once and use it with any model. 可用性原则 is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install 可用性原则 in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/microwind/ai-skills/tree/main/design-principles/availability-principle. TypingMind reads its SKILL.md and bundles its files and installs it as a skill you can enable per chat.

Which AI models can use 可用性原则?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with 可用性原则?

As many as you like. As long as a model supports skills, you can use 可用性原则 with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the 可用性原则 AI skill free?

Yes. It is published on GitHub by microwind under the MIT license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇