Silky Microservice FrameworkSilky Microservice Framework
Home
Docs
Config
Source
github
gitee
  • 简体中文
  • English
Home
Docs
Config
Source
github
gitee
  • 简体中文
  • English
  • Introduction

    • Silky Framework Overview
  • Getting Started

    • Glossary
    • Quick Start
    • Project Template
    • Microservice Architecture
    • Sample Projects
  • Host & Module

    • Host Types
    • Gateway Configuration
    • Module System
    • Plugin System
  • Gateway & HTTP

    • Swagger / OpenAPI
    • MiniProfiler
    • CORS
    • Audit Logging
  • Service & RPC

    • App Services & Service Entries
    • RPC Communication
    • WebSocket
    • Service Registry
    • Service Governance
  • Data & Cache

    • EFCore Data Access
    • Caching
    • Distributed Lock
  • Security & Auth

    • Identity & Authentication
    • Distributed Transactions
  • Infrastructure

    • Dependency Injection
    • Object Mapping
    • Validation
    • Link Tracking (SkyAPM)
    • Logging (Serilog)
    • Health Checks
    • Message Bus (MassTransit)
    • Unit & Integration Testing

Overview

In a distributed system, the service registry records the addresses and metadata of service instances. Service consumers query the registry by service name to get the address and initiate calls.

In Silky's RPC framework, there are three main roles: RPC Server, RPC Client, and Registry.

service-registry

  • RPC Server registers its service routes in the Registry at startup and sends periodic heartbeats to report its liveness.
  • RPC Client subscribes to services at startup, caches the returned node list in local memory, and establishes connections with RPC Servers.
  • When RPC Server nodes change, the Registry syncs the change and RPC Clients refresh their local cache.
  • The RPC Client selects an RPC Server from its local cache based on the load balancing algorithm.

Silky supports Zookeeper, Nacos, and Consul as the service registry.

Service Metadata

When a service provider registers with the registry, it writes service metadata consisting of:

  1. hostName: The name of the service provider host (NuGet package name)
  2. services: Array of application service information (service ID, name, protocol, entries, metadata)
  3. timeStamp: Timestamp of the last metadata update
  4. endpoints: Array of service instance endpoints (format differs by registry)

Example metadata registered with Zookeeper:

{
    "hostName": "DemoHost",
    "services": [
        {
            "id": "Demo.Application.Contracts.System.ISystemAppService",
            "serviceName": "SystemAppService",
            "serviceProtocol": 0,
            "serviceEntries": [
                {
                    "id": "Demo.Application.Contracts.System.ISystemAppService.GetInfo_Get",
                    "webApi": "api/system/demo/info",
                    "httpMethod": 0
                }
            ]
        }
    ],
    "timeStamp": 1714000000,
    "endpoints": [
        { "host": "192.168.1.10", "port": 2200, "processorTime": 0.5, "isHealth": true }
    ]
}

Zookeeper

Installation

<PackageReference Include="Silky.RegistryCenter.Zookeeper" Version="3.9.2" />

Configuration

registrycenter:
  type: Zookeeper
  connectionStrings: "127.0.0.1:2181"
  sessionTimeout: 40000     # session timeout (ms)
  connectionTimeout: 10000  # connection timeout (ms)
  operatingTimeout: 8000    # operation timeout (ms)
  routePath: /silky/services/routes

Silky uses Zookeeper's publish-subscribe model — changes are pushed to all clients in real time.

Nacos

Installation

<PackageReference Include="Silky.RegistryCenter.Nacos" Version="3.9.2" />

Configuration

registrycenter:
  type: Nacos
  
nacos:
  serverAddresses:
    - "http://127.0.0.1:8848"
  namespace: "silky"
  groupName: "DEFAULT_GROUP"
  username: "nacos"
  password: "nacos"

Nacos uses push notifications for real-time service discovery.

Consul

Installation

<PackageReference Include="Silky.RegistryCenter.Consul" Version="3.9.2" />

Configuration

registrycenter:
  type: Consul

consul:
  url: "http://127.0.0.1:8500"
  token: ""             # ACL token (if configured)
  heartbeatInterval: 5  # heartbeat interval (seconds)
  deregisterCriticalServiceAfter: "1m"

Consul uses a polling model — Silky periodically pulls the latest service list.

Selecting a Registry

RegistryDiscovery ModelHigh AvailabilityEcosystem
ZookeeperPush (real-time)High (ZAB consensus)Widely used in Java ecosystem
NacosPush (real-time)HighStrong in Alibaba/Spring Cloud ecosystem
ConsulPoll (periodic)High (Raft consensus)Rich built-in health checks and ACL

Choose based on your team's familiarity. All three provide equivalent functionality in Silky.

Edit this page
Prev
WebSocket
Next
Service Governance