All Projects → shoy160 → spear

shoy160 / spear

Licence: Apache-2.0 license
Spear轻量级微服务框架,高扩展性,目前已支持TCP、HTTP、WebSocket以及GRPC协议,采用Consul/Nacos作为服务注册与发现组件,TCP协议采用DotNetty底层实现,HTTP协议采用ASP.NET CORE MVC实现。

Programming Languages

C#
18002 projects

Projects that are alternatives of or similar to spear

Saea
SAEA.Socket is a high-performance IOCP framework TCP based on dotnet standard 2.0; Src contains its application test scenarios, such as websocket,rpc, redis driver, MVC WebAPI, lightweight message server, ultra large file transmission, etc. SAEA.Socket是一个高性能IOCP框架的 TCP,基于dotnet standard 2.0;Src中含有其应用测试场景,例如websocket、rpc、redis驱动、MVC WebAPI、轻量级消息服务器、超大文件传输等
Stars: ✭ 318 (+548.98%)
Mutual labels:  mvc, tcp
Pool
General Purpose Connection Pool for GRPC,RPC,TCP Sevice Cluster
Stars: ✭ 98 (+100%)
Mutual labels:  tcp, grpc
clean-architecture
Example about clean architecture in golang
Stars: ✭ 20 (-59.18%)
Mutual labels:  grpc
grpc-chat
Simple Chat Server/Client implemented with gRPC
Stars: ✭ 107 (+118.37%)
Mutual labels:  grpc
agentgo
Hi! Agentgo is a tool for making remote command executions from server to client with golang, protocol buffers (protobuf) and grpc.
Stars: ✭ 15 (-69.39%)
Mutual labels:  grpc
kontent-boilerplate-express-apollo
Kontent Boilerplate for development of Express application using Apollo server and GraphQL.
Stars: ✭ 21 (-57.14%)
Mutual labels:  mvc
FuckDPI V2
FuckDPIv2 can fuck the Korean Government's internet censorship by fragmenting SSL ClientHello.
Stars: ✭ 44 (-10.2%)
Mutual labels:  tcp
go-grpc
Package otgrpc provides OpenTracing support for any gRPC client or server.
Stars: ✭ 57 (+16.33%)
Mutual labels:  grpc
aranya
Control all kinds of devices with Kubernetes
Stars: ✭ 16 (-67.35%)
Mutual labels:  grpc
bazel-cache
Minimal cloud oriented Bazel gRPC cache
Stars: ✭ 33 (-32.65%)
Mutual labels:  grpc
universal-model-vue
Universal Model for Vue
Stars: ✭ 25 (-48.98%)
Mutual labels:  mvc
sdr-modem
Modem based on software defined radios.
Stars: ✭ 15 (-69.39%)
Mutual labels:  tcp
zepto
⚡️Lightweight web framework written in go
Stars: ✭ 115 (+134.69%)
Mutual labels:  grpc
epump
ePump是一个基于I/O事件通知、非阻塞通信、多路复用、多线程等机制开发的事件驱动模型的 C 语言应用开发框架,利用该框架可以很容易地开发出高性能、大并发连接的服务器程序。
Stars: ✭ 26 (-46.94%)
Mutual labels:  tcp
go-tensorflow
Tools and libraries for using Tensorflow (and Tensorflow Serving) in go
Stars: ✭ 25 (-48.98%)
Mutual labels:  grpc
xperience-training-13
Kentico Xperience 13 training website
Stars: ✭ 18 (-63.27%)
Mutual labels:  mvc
Coalesce
Helping you quickly build amazing sites
Stars: ✭ 42 (-14.29%)
Mutual labels:  mvc
mocket
Reliable UDP server client for flaky networks
Stars: ✭ 21 (-57.14%)
Mutual labels:  tcp
kruiser
A proxy that transparently exposes gRPC Kubernetes services cluster-externally
Stars: ✭ 14 (-71.43%)
Mutual labels:  grpc
grpc-tutorial
gRPC tutorial for Japanese readers
Stars: ✭ 579 (+1081.63%)
Mutual labels:  grpc

spear

Spear轻量级微服务框架,高扩展性,目前已支持TCP、HTTP协议,采用Consul作为服务注册与发现组件,TCP协议采用DotNetty底层实现,HTTP协议采用ASP.NET CORE MVC实现。

Package Name NuGet Downloads
Spear.ProxyGenerator nuget stats
Spear.Core nuget stats Wiki
Spear.Codec.MessagePack nuget stats
Spear.Codec.ProtoBuffer nuget stats
Spear.Consul nuget stats
Spear.Nacos nuget stats
Spear.Protocol.Http nuget stats
Spear.Protocol.Tcp nuget stats
Spear.Protocol.WebSocket nuget stats
Spear.Protocol.Grpc nuget stats

Contracts

[ServiceRoute("test")] //自定义路由键
public interface ITestContract : ISpearService
{
    Task Notice(string name);
    Task<string> Get(string name);
}

Server

var services = new MicroBuilder();
//服务协议
var protocol = ServiceProtocol.Tcp;
services.AddMicroService(builder =>
{
    //服务端需指定编解码器和使用协议
    builder
        .AddJsonCoder()             //Json编解码
        //.AddMessagePackCodec()    //MessagePack
        //.AddProtoBufCodec()       //ProtoBuf
        .AddSession()
        //.AddNacos()
        .AddConsul("http://127.0.0.1:8500"); //Consul服务注册与发现
    switch (protocol)
    {
        case ServiceProtocol.Tcp:
            builder.AddTcpProtocol();       //TCP
            break;
        case ServiceProtocol.Http:
            builder.AddHttpProtocol();      //Http
            break;
        case ServiceProtocol.Ws:
            builder.AddWebSocketProtocol(); //WebSocket
            break;
        case ServiceProtocol.Grpc:
            builder.AddGrpcProtocol();      //GRpc
            break;
    }
});

services.AddTransient<ITestContract, TestService>();

var provider = services.BuildServiceProvider();

provider.UseMicroService(address =>
{
    address.Service = "192.168.1.xx";   //服务注册地址,需要保持与客户端的网络访问
    address.Host = "localhost";         //主机地址
    address.Port = 5001;                //端口地址
    address.Weight = 1.5;               //服务权重
    address.Gzip = true;                //是否启用GZip压缩
});

Client

var services = new MicroBuilder()
    .AddMicroClient(builder =>
    {
        //支持多编解码&多协议
        builder
            .AddJsonCodec()
            .AddMessagePackCodec()
            .AddProtoBufCodec()
            .AddHttpProtocol()          //Http
            .AddTcpProtocol()           //TCP
            .AddWebSocketProtocol()     //WebSocket
            .AddGrpcProtocol()          //GRpc
            .AddSession()
            //.AddNacos()
            .AddConsul("http://127.0.0.1:8500");
    });
var provider = services.BuildServiceProvider();
var proxy = provider.GetService<IProxyFactory>();
var service = proxy.Create<ITestContract>();

BenchMark

Protocol:Tcp,Codec:Json,Gzip:False

image

Protocol:Tcp,Codec:Json,Gzip:True

image

Protocol:Tcp,Codec:MessagePack,Gzip:True

image

Protocol:Tcp,Codec:ProtoBuf,Gzip:True

image

Protocol:Http,Codec:Json,Gzip:False

image

Protocol:Http,Codec:Json,Gzip:True

image

Protocol:Http,Codec:MessagePack,Gzip:True

image

Protocol:Http,Codec:ProtoBuf,Gzip:True

image

Protocol:WebSocket,Codec:Json,Gzip:False

image

Protocol:WebSocket,Codec:Json,Gzip:True

image

Protocol:WebSocket,Codec:MessagePack,Gzip:True

image

Protocol:WebSocket,Codec:ProtoBuf,Gzip:True

image

Protocol:GRpc

image

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].