CoSky
High-performance, low-cost microservice governance platform. Service Discovery and Configuration Service | 高性能、低成本微服务治理平台
Install / Use
/learn @Ahoo-Wang/CoSkyREADME
CoSky - High-Performance Microservice Governance Platform
CoSky is a lightweight, low-cost service registration, service discovery, and configuration service SDK. By leveraging Redis in your existing infrastructure (which you've likely already deployed), CoSky eliminates additional operational costs and deployment burdens. Powered by Redis's high performance, CoSky delivers exceptional TPS&QPS (100,000+/s JMH Benchmark). Through its combination of local process caching strategies and Redis PubSub, CoSky achieves real-time cache refreshing with outstanding QPS performance ( 70,000,000+/s JMH Benchmark) and maintains real-time consistency between process cache and Redis.
Service Discovery
<p align="center"> <img src="./docs/CoSky-Discovery.png" alt="CoSky-Discovery"/> </p>Configuration
<p align="center"> <img src="./docs/CoSky-Configuration.png" alt="CoSky-Configuration"/> </p>Examples
Service Consumer --RPC--> Service Provider Examples
Installation
Gradle
Kotlin DSL
val coskyVersion = "lastVersion";
implementation("me.ahoo.cosky:spring-cloud-starter-cosky-config:${coskyVersion}")
implementation("me.ahoo.cosky:spring-cloud-starter-cosky-discovery:${coskyVersion}")
implementation("org.springframework.cloud:spring-cloud-starter-loadbalancer:3.0.3")
Maven
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>demo</artifactId>
<properties>
<cosky.version>lastVersion</cosky.version>
</properties>
<dependencies>
<dependency>
<groupId>me.ahoo.cosky</groupId>
<artifactId>spring-cloud-starter-cosky-config</artifactId>
<version>${cosky.version}</version>
</dependency>
<dependency>
<groupId>me.ahoo.cosky</groupId>
<artifactId>spring-cloud-starter-cosky-discovery</artifactId>
<version>${cosky.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-loadbalancer</artifactId>
<version>3.0.3</version>
</dependency>
</dependencies>
</project>
bootstrap.yaml (Spring-Cloud-Config)
spring:
application:
name: ${service.name:cosky}
data:
redis:
url: redis://localhost:6379
cloud:
cosky:
namespace: ${cosky.namespace:cosky-{system}}
config:
config-id: ${spring.application.name}.yaml
service-registry:
auto-registration:
enabled: ${cosky.auto-registry:true}
logging:
file:
name: logs/${spring.application.name}.log
🌐 REST-API Server (Optional)
Choose from three deployment options based on your environment:
🖥️ Option 1: Standalone Executable
Download the latest release and run directly:
# Download cosky-server
wget https://github.com/Ahoo-Wang/cosky/releases/latest/download/cosky-server.tar
# Extract and run
tar -xvf cosky-server.tar
cd cosky-server
bin/cosky --server.port=8080 --spring.data.redis.url=redis://localhost:6379
🐳 Option 2: Docker Deployment
Quick deployment with Docker:
docker pull ahoowang/cosky:latest
docker run --name cosky -d -p 8080:8080 \
-e SPRING_DATA_REDIS_URL=redis://your-redis-host:6379 \
ahoowang/cosky:latest
☸️ Option 3: Kubernetes Deployment
Deploy in your Kubernetes cluster:
apiVersion: apps/v1
kind: Deployment
metadata:
name: cosky
labels:
app: cosky
spec:
replicas: 1
selector:
matchLabels:
app: cosky
template:
metadata:
labels:
app: cosky
spec:
containers:
- name: cosky
image: ahoowang/cosky:latest
ports:
- containerPort: 8080
protocol: TCP
env:
- name: SPRING_DATA_REDIS_URL
value: redis://your-redis-host:6379
resources:
requests:
cpu: 250m
memory: 1024Mi
limits:
cpu: "1"
memory: 1280Mi
volumeMounts:
- name: volume-localtime
mountPath: /etc/localtime
volumes:
- name: volume-localtime
hostPath:
path: /etc/localtime
type: ""
---
apiVersion: v1
kind: Service
metadata:
name: cosky
labels:
app: cosky
spec:
selector:
app: cosky
ports:
- name: rest
port: 80
protocol: TCP
targetPort: 8080
🎨 Dashboard
Access the web-based management interface at:
<p align="center"> <img src="./docs/dashboard-dashboard.png" alt="CoSky-Dashboard"/> </p>
The CoSky Dashboard provides:
- Real-time service monitoring and management
- Configuration management with version control
- Namespace isolation and management
- Role-based access control (RBAC)
- Audit logging for compliance
- Service topology visualization
- Easy import/export functionality
Login
<p align="center"> <img src="./docs/dashboard-login.png" alt="CoSky-Dashboard-login"/> </p>Service dependent topology
<p align="center"> <img src="./docs/dashboard-topology.png" alt="CoSky-Dashboard-topology"/> </p>Role-based access control(RBAC)
- cosky: Reserved username, super user, with the highest authority. When the application is launched for the first time,
the super user (cosky) password will be initialized and printed on the console. Don't worry if you forget your
password, you can configure
enforce-init-super-user: true, CoSky will help you reinitialize the password and print it on the console.
---------------- ****** CoSky - init super user:[cosky] password:[6TrmOux4Oj] ****** ----------------
- admin: Reserved roles, super administrator roles, have all permissions, a user can be bound to multiple roles, and a role can be bound to multiple resource operation permissions.
- Permission control granularity is namespace, read and write operations
Role Permissions
<p align="center"> <img src="./docs/dashboard-role.png" alt="CoSky-Dashboard-role"/> </p>Add Role
<p align="center"> <img src="./docs/dashboard-role-add.png" alt="CoSky-Dashboard-role-add"/> </p>User Management
<p align="center"> <img src="./docs/dashboard-user.png" alt="CoSky-Dashboard-user"/> </p>Add User
<p align="center"> <img src="./docs/dashboard-user-add.png" alt="CoSky-Dashboard-user-add"/> </p>Audit Log
<p align="center"> <img src="./docs/dashboard-audit-log.png" alt="CoSky-Dashboard-audit-log"/> </p>Namespace
<p align="center"> <img src="./docs/dashboard-namespace.png" alt="CoSky-Dashboard-namespace"/> </p>Config
<p align="center"> <img src="./docs/dashboard-config.png" alt="CoSky-Dashboard-config"/> </p>Edit configuration
<p align="center"> <img src="./docs/dashboard-config-edit.png" alt="CoSky-Dashboard-config-edit"/> </p>Rollback configuration
<p align="center"> <img src="./docs/dashboard-config-rollback.png" alt="CoSky-Dashboard-config-rollback"/> </p>Import configuration from Nacos
<p align="center"> <img src="./docs/dashboard-config-import.png" alt="CoSky-Dashboard-config-rollback"/> </p>Service
<p align="center"> <img src="./docs/dashboard-service.png" alt="CoSky-Dashboard-service"/> </p>Edit Service Instance
<p align="center"> <img src="./docs/dashboard-service-edit.png" alt="CoSky-Dashboard-service-edit"/> </p>REST-API
https://ahoo-cosky.apifox.cn/
🚀 Performance Benchmarks
<p align="center"> <strong>CoSky delivers exceptional performance, outperforming alternatives by orders of magnitude</strong> </p>Test Environment
- Hardware: MacBook Pro (M1)
- Redis: Deployed locally on the same machine
- Methodology: All benchmarks conducted using JMH (Java Microbenchmark Harness)
Config Service Performance
gradle cosky-config:jmh
# or
java -jar cosky-config/build/libs/cosky-config-lastVersion-jmh.jar -bm thrpt -t 25 -wi 1 -rf json -f 1
Results
Benchmark Mode Cnt Score Error Units
ConsistencyRedisConfigServiceBenchmark.getConfig thrpt 256733987.827 ops/s
RedisConfigServiceBenchmark.getConfig thrpt 241787.679 ops/s
RedisConfigServic
