Welcome to 安企CMS some mechanical manufacturing Co., Ltd. official website!

7. Go Language CMS Development Practice: Technical Architecture Analysis of AnQiCMS Based on Iris Framework

Source:News Information/Time:2026-06-26

Tag: Go Language, Iris, AnQiCMS, Technical Architecture

category_id: 35

category_id: 35

Many people ask me why AnQiCMS is developed in Go language. This question can be answered from two aspects: one is why choose Go, and the other is why choose the Iris framework.

Why choose the Go language

Why choose the Go language

Performance

Go is a compiled language, compiled into machine code, and runs directly.PHP is an interpreted language, the code needs to be interpreted each time a request is made.The speed of compilation execution is faster than interpretation, and this gap is natural.

Go's concurrency model is also better than PHP. PHP-FPM creates a process for each request, and a large number of processes are created during high concurrency.Go uses goroutines to handle concurrency, each goroutine only occupies 2KB of stack space, and a process can simultaneously run tens of thousands of goroutines.

Deployment is simple

Go compiles into a binary file. Place it on a Linux server, chmod +x and then run it.Do not need to install PHP, install extensions, configure environment variables, configure Nginx reverse proxy (although it is still recommended in production environment).

Docker deployment is even simpler, one command:

docker pull anqicms/anqicms
docker run -p 8080:8080 anqicms/anqicms

Low memory usage

Go has a garbage collection mechanism and does not require manual memory management. However, its GC efficiency is higher than that of many languages, with faster memory recycling and less fragmentation.

I have tested that AnQiCMS usually resides in memory around 45MB, and about 80MB during 200 concurrent accesses. Under the same concurrency, PHP-FPM usually requires several hundred MB to even several GB.

Cross-compilation is convenient

Go supports cross-compilation. To compile Linux binary files on Mac, you can handle it with two environment variables:

GOOS=linux GOARCH=amd64 go build -o anqicms

This is very friendly to CI/CD pipelines

Why choose the Iris framework

Why choose the Iris framework

There are many Web frameworks for Go, such as Gin, Echo, Beego, and Iris, which are widely used. AnQiCMS chose Iris for several reasons:

Good performance

Iris's performance ranks among the top in Go frameworks. The official benchmark tests show that Iris's QPS is slightly higher than Gin. Although the gap is not particularly large, for CMS, a faster underlying layer means the overall performance is faster.

Complete features

Iris comes with many built-in features such as routing, middleware, session management, and template engine. AnQiCMS doesn't need to build many wheels on its own.

Flexible routing

The Iris router supports regular expressions, wildcards, and parameter binding, making it flexible. The pseudo-static rules and URL mapping of AnQiCMS can be implemented conveniently with the Iris routing system.

Comprehensive documentation

The Iris documentation is comprehensive, and most problems can be solved by checking the documentation.

AnQiCMS project structure

AnQiCMS project structure

The AnQiCMS project structure is clear, with main directories:

anqicms/
├── cmd/            # 入口程序
├── pkg/            # 核心包
│   ├── admin/      # 后台管理
│   ├── app/        # 应用层
│   ├── model/      # 数据模型
│   ├── service/    # 业务逻辑
│   └── web/        # 前台页面
├── template/       # 模板文件
├── static/         # 静态资源
├── uploads/        # 上传文件
└── conf/           # 配置文件

The core logic is under the pkg directory, divided by functional modules. This structure is clear and easy to maintain.

Database design

Database design

AnQiCMS uses MySQL. The database design has several characteristics:

Modeling

Content is organized by model, with each model corresponding to a table. Article model, product model, page model, each has an independent table. This design has strong scalability, adding a new model only requires adding a new table and new fields.

Fields are configurable

Supports custom fields. Each model can add custom fields, including text, numbers, dates, dropdown selections, images, etc. Custom fields exist in the extension table, and you can join them when querying.

Caching mechanism

Supports page caching and fragment caching. You can control the granularity of caching using the cache tag in the template, down to the level of individual modules.

Concurrency Handling

Concurrency Handling

The Iris concurrency model is based on Go's goroutines. Each HTTP request is processed by a goroutine, and goroutines communicate through channels.

The background management and front-end page are independent routing groups that do not affect each other. Background operations will not block the front-end page, and high concurrency on the front-end will not slow down the background.

Logs are written asynchronously, which does not affect the speed of request processing.

safety mechanisms

safety mechanisms

Authentication

JWT authentication. After the user logs in successfully, the JWT token is returned, and the token is used for identity verification in subsequent requests. The token has an expiration time and can be set to auto-renew.

Passwords are encrypted and stored using bcrypt, not in plain text or MD5.

Protection

SQL injection protection: All database operations go through parameterized queries and do not concatenate SQL strings.

XSS protection: User input content is encoded with HTML entities before output.

CSRF protection: Form requests must carry CSRF Token, and the server verifies it before processing the request.

Background domain whitelist: You can set allowed domains in the background to prevent illegal access to the background.

Plugin mechanism

Plugin mechanism

AnQiCMS supports the plugin mechanism. Plugins can be modules written in Go or template files.

Plugin registration: Upload plugin files in the background 'Plugin Management' and the system will automatically parse the plugin list and dependencies.

Plugin lifecycle: Installation → Activation → Uninstallation, each stage has corresponding hook functions.

Performance optimization

Performance optimization

Static resource processing

Static files (CSS, JS, images) are processed directly by Nginx without going through AnQiCMS. Nginx's static file processing capabilities are far superior to those of the application server.

Database optimization

Index design is reasonable. Articles table, categories table, and tags table all have appropriate indexes. List queries use indexes to avoid full table scans.

Caching strategy

Supports multi-level caching:

  1. Page caching: Caches the entire page, suitable for content that does not change often.
  2. Fragment caching: Page local caching, suitable for column lists, navigation, etc.
  3. Data caching: Single data caching, suitable for configuration information, etc.

Gzip compression

The response content supports Gzip compression to reduce the volume of transmission.

Summary

Summary

AnQiCMS chooses the Go+Iris technology stack, the core reason is performance and deployment convenience. For enterprise website construction, these advantages are directly converted into lower server costs and simpler operation and maintenance processes.

At the code level, the project structure is clear, the database design is reasonable, and the security mechanism is in place. Enterprises with development capabilities can carry out secondary development on the basis of AnQiCMS to expand functions.

Online customer service
WeChat contact
Customer service
Scan code to add Wechat (same mobile phone number)
Telephone consultation
Back to top