Go HTTP framework with high-performance and strong-extensibility for building micro-services.
Hertz
English | 中文
Hertz [həːts] is a high-usability, high-performance and high-extensibility Golang HTTP framework that helps developers build microservices. It was originally a fork of fasthttp and inspired by gin, echo and combined with the internal requirements in ByteDance. At present, it has been widely used inside ByteDance. Nowadays, more and more microservices use Golang. If you have requirements for microservice performance and hope that the framework can fully meet the internal customizable requirements, Hertz will be a good choice.
Basic Features
- High usability
- High performance
Comparison of four frameworks:
Comparison of three frameworks:
For detailed performance data, please refer to hertz-benchmark.
- High extensibility
- Multi-protocol support
- Network layer switching capability
Documentation
Getting Started
Example
The Hertz-Examples repository provides code out of the box. moreBasic Features
Contains introduction and use of general middleware, context selection, data binding, data rendering, direct access, logging, error handling. moreObservability
Contains instrumentation, logging, tracing. moreFramework Extension
Contains network library extensions, protocol extensions, logger extensions, monitoring extensions. moreReference
Framework configurable items list. moreFAQ
Frequently Asked Questions. morePerformance
Performance testing can only provide a relative reference. In production, there are many factors that can affect actual performance. We provide the hertz-benchmark project to track and compare the performance of Hertz and other frameworks in different situations for reference.Related Projects
- Netpoll: A high-performance network library. Hertz integrated by default.
- Example: Use examples of Hertz.
Extensions
Hertz-contrib is a partial extension library of Hertz, which users can integrate into Hertz through options according to their needs, built and maintained by the community.| Extensions | Description | |----------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | Autotls | Make Hertz support Let's Encrypt. | | Http2 | HTTP2 support for Hertz. | | Websocket | Enable Hertz to support the Websocket protocol. | | Etag | Support ETag (or entity tag) HTTP response header for Hertz. | | Limiter | Provides a current limiter based on the bbr algorithm. | | Monitor-prometheus | Provides service monitoring based on Prometheus. | | Obs-opentelemetry | Hertz's Opentelemetry extension that supports Metric, Logger, Tracing and works out of the box. | | Opensergo | The Opensergo extension. | | Pprof | Extension for Hertz integration with Pprof. | | Registry | Provides service registry and discovery functions. So far, the supported service discovery extensions are nacos, consul, etcd, eureka, polaris, servicecomb, zookeeper, redis. | | Sentry | Sentry extension provides some unified interfaces to help users perform real-time error monitoring. | | Tracer | Link tracing based on Opentracing. | | Basicauth | Basicauth middleware can provide HTTP basic authentication. | | Jwt | Jwt extension. | | Keyauth | Provides token-based authentication. | | Requestid | Add request id in response. | | Sessions | Session middleware with multi-state store support. | | Casbin | Supports various access control models by Casbin. | | Cors | Provides cross-domain resource sharing support. | | Csrf | Csrf middleware is used to prevent cross-site request forgery attacks. | | Secure | Secure middleware with multiple configuration items. | | Gzip | A Gzip extension with multiple options. | | I18n | Helps translate Hertz programs into multi programming languages. | | Lark | Use hertz handle Lark/Feishu card message and event callback. | | Loadbalance | Provides load balancing algorithms for Hertz. | | Logger | Logger extension for Hertz, which provides support for zap, logrus, zerologs logging frameworks. | | Recovery | Recovery middleware for Hertz. | | Reverseproxy | Implement a reverse proxy. | | Swagger | Automatically generate RESTful API documentation with Swagger 2.0. | | Cache | Hertz middleware for cache HTTP response with multi-backend support |
Blogs
- ByteDance Practice on Go Network Library
- Ultra-large-scale Enterprise-level Microservice HTTP Framework — Hertz is Officially Open Source!
- ByteDance Open Source Go HTTP Framework Hertz Design Practice
- Help ByteDance Reduce Costs and Increase Efficiency, the Design Practice for Large-scale Enterprise-level HTTP Framework Hertz
- Getting Started with Hertz: Performance Testing Guide
Contributing
RoadMap
Hertz RoadMapLicense
Hertz is distributed under the Apache License, version 2.0. The licenses of third party dependencies of Hertz are explained here.Community
- Email: conduct@cloudwego.io
- How to become a member: COMMUNITY MEMBERSHIP
- Issues: Issues
- Slack: Join our CloudWeGo community Slack Channel.
- Lark: Scan the QR code below with Lark to join our CloudWeGo/hertz user group.
Contributors
Thank you for your contribution to Hertz!Landscapes
CloudWeGo enriches the CNCF CLOUD NATIVE Landscape.