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

What is Silky?

Silky is an open-source microservice development framework built on the .NET platform, focused on two core capabilities: RPC communication and microservice governance. It follows the mainstream .NET programming model and, with minimal intrusion, transforms a plain .NET host application into a microservice with service registration, discovery, remote invocation, and distributed transaction support.

Silky's core philosophy:

Interface as Service — A plain C# interface annotated with [ServiceRoute] becomes a complete microservice endpoint. The framework automatically generates both an HTTP WebAPI and an RPC endpoint — no manual routing, no extra configuration.

silky microservice framework


Core Architecture

┌──────────────────────────────────────────────────────────┐
│               HTTP / WebSocket Clients                    │
└─────────────────────────┬────────────────────────────────┘
                          │ HTTPS
            ┌─────────────▼─────────────┐
            │        Silky API Gateway   │
            │  Swagger · JWT · RateLimit │
            │  CORS  · Auditing · Profiler│
            └─────────────┬─────────────┘
                          │ DotNetty TCP RPC
       ┌──────────────────┼──────────────────┐
       │                  │                  │
 ┌─────▼─────┐      ┌─────▼─────┐     ┌─────▼─────┐
 │ Service A │ ←──► │ Service B │ ←──►│ Service C │
 │  (Host)   │  RPC │  (Host)   │  RPC│  (Host)   │
 └─────┬─────┘      └─────┬─────┘     └─────┬─────┘
       └──────────────────┼──────────────────┘
                          │
         ┌────────────────┼────────────────┐
   ┌─────▼──────┐  ┌──────▼─────┐  ┌──────▼──────┐
   │  Consul /  │  │   Redis /  │  │  MySQL / PG │
   │  Nacos /   │  │ Dist. Cache│  │  SQL Server │
   │  Zookeeper │  │            │  │  (EF Core)  │
   └────────────┘  └────────────┘  └─────────────┘

The overall architecture consists of the following layers:

1. Service Engine & Modular System

Silky is built on a modular design where each functional unit is encapsulated as an independent SilkyModule. Dependencies are declared via the [DependsOn] attribute, and the framework completes service registration and initialization in dependency order at startup.

  • Developers don't need to manage complex service registration order
  • Framework capabilities can be extended via custom modules or dynamically loaded plugins
  • Initialize / Shutdown lifecycle hooks allow custom logic (e.g., database migrations)

2. RPC Communication Layer

Silky uses DotNetty as the underlying transport and implements high-performance RPC over persistent TCP connections:

  • Interface Proxy: Autofac dynamic proxy — inject an interface and transparently call remote services
  • Multiple Codecs: JSON (default), MessagePack, ProtoBuf
  • Heartbeat Detection: Long connections include heartbeat to auto-detect and remove unhealthy instances
  • RPC Security: Internal RPC channel protected by rpc.token — external callers cannot bypass the gateway

3. Microservice Governance Layer

CapabilityDescription
Service Registration & DiscoverySupports Zookeeper / Nacos / Consul; real-time online/offline awareness via pub-sub or heartbeat polling
Load BalancingPolling, Random, HashAlgorithm — configurable per interface method
Timeout ControlGlobal or method-level RPC timeout; set to 0 for unlimited (dev environment)
FailoverAutomatic retry on IO or communication errors; configurable retry count and interval
Circuit BreakingN consecutive non-business exceptions trigger the breaker; powered by Polly
RPC Rate LimitingPer-instance max concurrent request count; excess traffic is routed to other instances
HTTP Rate LimitingIntegrates AspNetCoreRateLimit; per-IP or per-client-ID
Service Fallback[Fallback] attribute specifies a fallback interface; executed automatically on RPC failure
Cache InterceptionRead from Redis cache on RPC call; returns cached data without network request on cache hit

4. Host Types

Silky provides four host types to meet different deployment scenarios:

Host TypeBuilder MethodExposes HTTPRPC ServiceWebSocket
General HostConfigureSilkyGeneralHostDefaults❌✅❌
Web HostConfigureSilkyWebHostDefaults✅✅❌
WebSocket HostConfigureSilkyWebSocketDefaults❌✅✅
Gateway HostConfigureSilkyGatewayDefaults✅❌❌

5. Security

  • Centralized Gateway Authentication: JWT Token validation at the gateway; no repeated auth logic in individual services
  • RPC Token Protection: All cluster services share one rpc.token; external callers cannot access RPC ports directly
  • Interface-Level Access Control: [Authorize] / [AllowAnonymous] / [Governance(ProhibitExtranet = true)] for fine-grained control
  • SSL Support: RPC communication supports SSL/TLS encryption

6. Observability

  • Distributed Tracing: Integrates SkyAPM — traces HTTP requests, RPC calls, TCC distributed transactions, and EFCore queries end-to-end
  • Logging: Built-in Serilog support with structured logging to console, file, Elasticsearch, etc.
  • Dashboard: Built-in cluster management console — visualize all service instance statuses, service entry configurations, and real-time performance metrics

Ecosystem Integration

Silky is fully compatible with the ASP.NET Core ecosystem:

CategorySupported Components
ORM / Data AccessEntity Framework Core, FreeSql, Dapper
Message BusMassTransit, CAP (RabbitMQ, Kafka, etc.)
Object MappingAutoMapper (Silky.ObjectMapper.AutoMapper), Mapster (Silky.ObjectMapper.Mapster)
ValidationDataAnnotations (built-in), FluentValidation (Silky.Validation.Fluent)
CachingIn-memory (default), Redis (Silky.Caching.StackExchangeRedis)
RegistryZookeeper (Silky.RegistryCenter.Zookeeper), Nacos (Silky.RegistryCenter.Nacos), Consul (Silky.RegistryCenter.Consul)
TracingSkyAPM (Silky.SkyApm.Agent)
LoggingSerilog (Silky.Logging.Serilog)
Distributed LockDistributedLock.Redis (Silky.DistributedLock.Redis)

Supported .NET Versions

Silky VersionSupported .NET Versions
3.x (current stable).NET 6 / .NET 7 / .NET 8 / .NET 9 / .NET 10

Comparison with Other Frameworks

FeatureSilkyDaprMassTransitgRPC
LanguageC# / .NETMulti-languageC# / .NETMulti-language
RPC StyleInterface proxy (transparent)HTTP / gRPC SidecarMessage busCode gen (Protobuf)
Service GovernanceBuilt-inBuilt-in (Sidecar)PartialDIY
Distributed TransactionsTCC (built-in)Saga (Sidecar)Saga (Outbox)Not supported
Learning CurveLow (.NET native model)Medium (Sidecar architecture)MediumMedium
Deployment ComplexityLowHigh (requires Dapr Runtime)LowLow

Silky's advantage: extremely friendly to .NET developers — no new programming paradigm to learn. Use existing interface, DI, and middleware knowledge to build full-featured microservices without a Sidecar process.


Source Code

  • GitHub: https://github.com/liuhll/silky
  • Gitee: https://gitee.com/liuhll2/silky

Contributing

  • Discuss in Issues — report bugs or request features
  • Submit Pull Requests to contribute code
  • Join the QQ group (934306776) for community discussion
Edit this page