internal/website/docs/guides/comparison.md
How Go Micro compares to other Go microservices frameworks.
| Feature | Go Micro | go-kit | gRPC | Dapr |
|---|---|---|---|---|
| Learning Curve | Low | High | Medium | Medium |
| Boilerplate | Low | High | Medium | Low |
| Plugin System | Built-in | External | Limited | Sidecar |
| Service Discovery | Yes (mDNS, Consul, etc) | No (BYO) | No | Yes |
| Load Balancing | Client-side | No | No | Sidecar |
| Pub/Sub | Yes | No | No | Yes |
| Transport | HTTP, gRPC, NATS | BYO | gRPC only | HTTP, gRPC |
| Zero-config Dev | Yes (mDNS) | No | No | No (needs sidecar) |
| Production Ready | Yes | Yes | Yes | Yes |
| Language | Go only | Go only | Multi-language | Multi-language |
go-kit (requires more setup):
// Define service interface
type MyService interface {
DoThing(ctx context.Context, input string) (string, error)
}
// Implement service
type myService struct{}
func (s *myService) DoThing(ctx context.Context, input string) (string, error) {
return "result", nil
}
// Create endpoints
func makeDo ThingEndpoint(svc MyService) endpoint.Endpoint {
return func(ctx context.Context, request interface{}) (interface{}, error) {
req := request.(doThingRequest)
result, err := svc.DoThing(ctx, req.Input)
if err != nil {
return doThingResponse{Err: err}, nil
}
return doThingResponse{Result: result}, nil
}
}
// Create transport (HTTP, gRPC, etc)
// ... more boilerplate ...
Go Micro (simpler):
type MyService struct{}
type Request struct {
Input string `json:"input"`
}
type Response struct {
Result string `json:"result"`
}
func (s *MyService) DoThing(ctx context.Context, req *Request, rsp *Response) error {
rsp.Result = "result"
return nil
}
func main() {
svc := micro.NewService(micro.Name("myservice"))
svc.Init()
svc.Handle(new(MyService))
svc.Run()
}
You can use gRPC with Go Micro for native gRPC compatibility:
import (
grpcServer "go-micro.dev/v5/server/grpc"
grpcClient "go-micro.dev/v5/client/grpc"
)
svc := micro.NewService(
micro.Server(grpcServer.NewServer()),
micro.Client(grpcClient.NewClient()),
)
See Native gRPC Compatibility for a complete guide.
Go Micro: Built-in with plugins
// Zero-config for dev
svc := micro.NewService(micro.Name("myservice"))
// Consul for production
reg := consul.NewRegistry()
svc := micro.NewService(micro.Registry(reg))
go-kit: Bring your own
// You implement service discovery
// Can be 100+ lines of code
gRPC: No built-in discovery
// Use external solution like Consul
// or service mesh like Istio
Go Micro: Client-side, pluggable strategies
// Built-in: random, round-robin
selector := selector.NewSelector(
selector.SetStrategy(selector.RoundRobin),
)
go-kit: Manual implementation
// You implement load balancing
// Using loadbalancer package
gRPC: Via external load balancer
# Use external LB like Envoy, nginx
Go Micro: First-class
broker.Publish("topic", &broker.Message{Body: []byte("data")})
broker.Subscribe("topic", handler)
go-kit: Not provided
// Use external message broker directly
// NATS, Kafka, etc
gRPC: Streaming only
// Use bidirectional streams
// Not traditional pub/sub
See specific migration guides:
Coming Soon:
Choose Go Micro if:
Choose go-kit if:
Choose gRPC if:
Choose Dapr if:
Rough benchmarks (requests/sec, single instance):
| Framework | Simple RPC | With Discovery | With Tracing |
|---|---|---|---|
| Go Micro | ~20k | ~18k | ~15k |
| gRPC | ~25k | N/A | ~20k |
| go-kit | ~22k | N/A | ~18k |
| HTTP std | ~30k | N/A | N/A |
Benchmarks are approximate and vary by configuration
Start with Go Micro if you're building Go microservices and want to move fast. You can always:
micro.Transport(grpc.NewTransport())The pluggable architecture means you're not locked in.