ロードバランシングをサポートしていますか?
はい、SSLcatは強力なロードバランシング機能を内蔵し、複数のロードバランシングアルゴリズムとインテリジェント接続プール管理をサポートしています。
ロードバランシングアルゴリズム
SSLcatは複数のロードバランシングアルゴリズムをサポートしています:
- ラウンドロビン (Round Robin) - リクエストを各バックエンドに順次配信
- 最少接続 (Least Connections) - 接続数が最も少ないバックエンドを選択
- IPハッシュ (IP Hash) - クライアントIPハッシュに基づいてバックエンドを選択
- 重み付きラウンドロビン (Weighted Round Robin) - 重みに基づいてリクエストを配信
基本設定
複数のバックエンドサーバーを設定:
proxies:
- domain: "app.example.com"
targets:
- "http://backend1.example.com:3000"
- "http://backend2.example.com:3000"
- "http://backend3.example.com:3000"
protocol: "http"
load_balance: "round_robin"
重み付きロードバランシング
異なるバックエンドに重みを設定:
proxies:
- domain: "app.example.com"
targets:
- target: "http://backend1.example.com:3000"
weight: 3
- target: "http://backend2.example.com:3000"
weight: 2
- target: "http://backend3.example.com:3000"
weight: 1
protocol: "http"
load_balance: "weighted_round_robin"
ヘルスチェック
バックエンドヘルスチェックを設定:
proxies:
- domain: "app.example.com"
targets:
- "http://backend1.example.com:3000"
- "http://backend2.example.com:3000"
- "http://backend3.example.com:3000"
protocol: "http"
load_balance: "least_conn"
health_check:
enabled: true
path: "/health"
interval: 30
timeout: 5
retries: 3
フェイルオーバー
フェイルオーバーメカニズムを設定:
proxies:
- domain: "app.example.com"
targets:
- "http://primary.example.com:3000"
- "http://backup1.example.com:3000"
- "http://backup2.example.com:3000"
protocol: "http"
load_balance: "round_robin"
failover:
enabled: true
max_failures: 3
recovery_time: 60
接続プール管理
インテリジェント接続プール設定:
proxies:
- domain: "app.example.com"
targets:
- "http://backend1.example.com:3000"
- "http://backend2.example.com:3000"
protocol: "http"
load_balance: "round_robin"
connection_pool:
max_connections: 100
max_idle_connections: 10
idle_timeout: 90
keep_alive: true
セッション保持
セッション保持機能を設定:
proxies:
- domain: "app.example.com"
targets:
- "http://backend1.example.com:3000"
- "http://backend2.example.com:3000"
protocol: "http"
load_balance: "ip_hash"
session_sticky:
enabled: true
cookie_name: "SSLCAT_SESSION"
cookie_ttl: 3600
監視と統計
ロードバランシング監視機能:
- バックエンド状態 - 各バックエンドの状態を表示
- 接続統計 - 接続数分布を表示
- 応答時間 - 各バックエンドの応答時間を表示
- エラー率 - 各バックエンドのエラー率を表示
ベストプラクティス
ロードバランシング設定の推奨事項:
- ヘルスチェックを有効化 - バックエンドサービスの可用性を確保
- 重みを合理的に設定 - バックエンドの性能に基づいて重みを設定
- フェイルオーバーを設定 - サービスの可用性を向上
- パフォーマンスを監視 - ロードバランシング効果を継続的に監視
SSLcatのロードバランシング機能により、高可用性のサービスアーキテクチャを構築できます。