How the Hulk Framework Boosts Go Service Development and Operations

This article explains the background, design, components, ecosystem, and real‑world benefits of the Hulk Go web framework developed by the short‑video R&D team, showing how it improves development efficiency, code quality, performance, observability, and incident response for large‑scale microservices.

21CTO
21CTO
21CTO
How the Hulk Framework Boosts Go Service Development and Operations

Background

Hulk is a Go service development framework built by the short‑video R&D department on top of GDP2 (Go Develop Platform). It provides out‑of‑the‑box components for rapid web service development and forms a Go ecosystem tailored to business scenarios.

1.1 Why Upgrade Architecture?

The original PHP monolith faced issues as traffic grew to tens of millions of DAU, including low development efficiency due to a single codebase, bottlenecks in deployment pipelines, poor runtime performance, and limited SRE capabilities.

1.2 Why Not Use GDP2 Directly?

When the Go migration started, GDP2 was not yet officially released, prompting the team to create Hulk as an interim solution.

1.3 Hulk vs. GDP2 Comparison

1.3.1 Web Server Capability

Hulk currently offers an HTTP server with many built‑in middlewares.

1.3.2 Features/Components

Hulk reuses many GDP2 capabilities (e.g., bns, net, codec) and adds business‑specific enhancements such as redis, mysql, task scheduling, configuration center, and service governance.

1.3.3 Framework Ecosystem

Hulk integrates with surrounding tools and infrastructure, including Prometheus+Grafana, Sentry, Apollo, and custom services.

1.3.4 Summary

Reuses core GDP2 capabilities.

Provides second‑level wrappers for common components (httpserver, ral, redis, mysql).

Adds missing business features (task scheduling, config center, service governance).

Adopts industry‑proven open‑source practices.

Understanding Hulk

2.1 Design Philosophy

Hulk follows a layered architecture with four functional layers: basic components, generic components, extended components, and application‑level logic.

2.2 Framework Structure

2.2.1 Basic Components

Logging : Supports PHP‑compatible formats and ftrace integration.

Cloud‑Native Monitoring : Prometheus metrics for requests, Redis, RAL, etc.

Configuration Center : Real‑time config delivery via Apollo/iConf with versioning, hot‑release, gray‑release, and audit.

Event Tracing : Sentry integration captures full context (stack, request, instance) for rapid fault localization.

2.2.2 Generic Components

RAL : Enhances GDP2 RAL with string‑based initialization, lazy loading, and hooks for monitoring, circuit breaking, and degradation.

Service Governance : Built on Sentinel and the config center for rate limiting, traffic shaping, circuit breaking, and degradation.

Coroutine Pool : Automatic goroutine scheduling, panic handling, task submission, and WaitGroup support.

Event Notification : Integration with Ruliu to send alerts to group chats, combined with Sentry for instant issue awareness.

2.2.3 Extended Components

Redis : Metrics hook, Sentry hook, and degradation hook for fine‑grained control.

MySQL : Metrics and Sentry hooks similar to Redis.

Distributed Lock : Redis‑based lock using redsync.

Scheduled Tasks : Supports both lock‑protected and lock‑free modes for multi‑instance deployments.

2.2.4 HTTP Server

logger_middleware : Logs request/response, supports dynamic log level control.

timer_middleware : Captures latency, QPS, error codes, etc.

recover_middleware : Captures panics and forwards to Sentry/Ruliu.

flow_control_middleware : Interface rate limiting per IDC/instance.

timeout_middleware : IDC‑level request timeout control.

Other middlewares include internal_user, jager_opentracing, thirdparty_auth, b2logger, etc.

2.3 Framework Ecosystem

Standard directory conventions for uniform project structure.

Code generator to scaffold projects following the conventions.

hklib: Common library with over 50 middle‑service client wrappers.

Infrastructure: Prometheus+Thanos, Sentry, Apollo, Pyroscope.

iconf: Internal config center extending Apollo features.

artemis: Service visualization and intelligent fault localization system.

2.4 Framework Adoption

All short‑video Go services are built on Hulk, achieving measurable resource and performance gains.

Framework Capabilities and Applications

3.1 Improving Code Quality

Hulk enhances code quality through standardized project layout, code generators, adherence to Baidu Go coding standards, static analysis tools (go_fmt, goc), and integrated performance testing platforms (nGrinder, Pyroscope).

3.2 Accelerating Development Iteration

Rich reusable components (enhanced Redis/MySQL, RAL, middleware), configuration‑driven initialization, and low‑code support reduce code changes and deployment cycles.

3.3 Fast Issue Detection and Localization

Integrated Sentry for real‑time error tracing, Ruliu for alerting, Prometheus+SIA for multi‑dimensional monitoring, ftrace‑compatible logging, and the Artemis platform for near‑real‑time dashboards, key logs, and service call chains.

3.4 Service Visualization and Intelligent Fault Localization

Artemis provides deployment topology, multi‑dimensional monitoring, key log aggregation, and call‑chain visualization with availability coloring, enabling seconds‑level fault pinpointing.

Conclusion

Hulk is a Go web framework that builds on internal and open‑source foundations, offering a comprehensive ecosystem that supports development, deployment, operation, and maintenance of large‑scale microservices, delivering efficiency, performance, and observability benefits.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

ObservabilityGoWeb framework
21CTO
Written by

21CTO

21CTO (21CTO.com) offers developers community, training, and services, making it your go‑to learning and service platform.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.