Cette page est affichée en anglais. Une traduction française est en cours.
ScriptsMay 15, 2026·3 min de lecture

Drogon — High-Performance C++ Web Framework

Drogon is a C++17/20 HTTP application framework for building high-performance web servers and APIs. It uses non-blocking I/O with an event-driven architecture, supports WebSocket, HTTP/2, and includes a built-in ORM.

Prêt pour agents

Cet actif peut être lu et installé directement par les agents

TokRepo expose une commande CLI universelle, un contrat d'installation, le metadata JSON, un plan selon l'adaptateur et le contenu raw pour aider les agents à juger l'adaptation, le risque et les prochaines actions.

Native · 98/100Policy : autoriser
Surface agent
Tout agent MCP/CLI
Type
Skill
Installation
Single
Confiance
Confiance : Established
Point d'entrée
Drogon
Commande CLI universelle
npx tokrepo install e2febac6-5016-11f1-9bc6-00163e2b0d79

Introduction

Drogon is a C++ web application framework designed for building extremely fast HTTP services. Named after the dragon in Game of Thrones, it prioritizes raw throughput and minimal overhead. Drogon consistently ranks among the top frameworks in the TechEmpower benchmarks, making it a strong choice for latency-sensitive backend services.

What Drogon Does

  • Serves HTTP/1.1 and HTTP/2 requests with non-blocking asynchronous I/O
  • Provides a controller-based routing system with support for RESTful APIs
  • Includes built-in WebSocket support for real-time bidirectional communication
  • Offers an asynchronous ORM (Drogon ORM) for PostgreSQL, MySQL, and SQLite
  • Generates boilerplate code via the drogon_ctl command-line tool

Architecture Overview

Drogon runs an event loop per thread using epoll (Linux), kqueue (macOS/BSD), or IOCP (Windows) for non-blocking socket I/O. Incoming requests are dispatched to handler coroutines or callback-based controllers. The framework manages a thread pool for blocking operations and database queries. All handler interfaces default to asynchronous mode where responses are returned via callbacks or C++20 coroutines.

Self-Hosting & Configuration

  • Configuration is done via a JSON file (config.json) or programmatically in main.cc
  • Listeners, thread count, session settings, and SSL certificates are set in the config
  • Static file serving is built in and configured with document_root and upload_path
  • Database connections are pooled and configured per-database with async query support
  • The drogon_ctl tool generates controllers, filters, plugins, and model code from templates

Key Features

  • C++20 coroutine support for writing async code that reads like synchronous code
  • Built-in support for gzip/brotli compression, sessions, cookies, and file uploads
  • CSP (C++ Server Pages) template engine for server-side rendered HTML views
  • Plugin system for extending the framework with custom middleware and services
  • Cross-platform: runs on Linux, macOS, FreeBSD, OpenBSD, HaikuOS, and Windows

Comparison with Similar Tools

  • Crow — Header-only C++ micro-framework; simpler API but fewer built-in features and no ORM
  • Oat++ — C++ web framework with built-in serialization; similar performance but different API style
  • Pistache — C++ REST framework; lightweight but less actively maintained
  • Actix Web (Rust) — High-performance Rust framework; similar benchmark rankings but different language ecosystem
  • FastAPI (Python) — Developer-friendly Python framework; much easier to write but orders of magnitude slower

FAQ

Q: How does Drogon compare in benchmarks? A: Drogon consistently ranks in the top tier of the TechEmpower Web Framework Benchmarks across JSON serialization, database queries, and plaintext categories.

Q: Does Drogon support C++20 coroutines? A: Yes. Drogon supports C++20 coroutines for writing async handlers with co_await, making the code much more readable than callback-based approaches.

Q: What databases does the ORM support? A: Drogon ORM supports PostgreSQL, MySQL/MariaDB, and SQLite with async query execution and connection pooling. Models are generated from the database schema using drogon_ctl.

Q: Can I use Drogon for microservices? A: Yes. Drogon's small binary size, fast startup, and high throughput make it well-suited for containerized microservices behind a load balancer.

Sources

Fil de discussion

Connectez-vous pour rejoindre la discussion.
Aucun commentaire pour l'instant. Soyez le premier à partager votre avis.

Actifs similaires