* Refactor carbon-server service in docker-compose.yml to use pre-built image and remove unnecessary build context and volume mounts

* Enhance performance and security features:
- Update compiler flags for better optimization and security.
- Implement MIME type caching for improved response handling.
- Introduce worker thread pool for efficient connection management.
- Optimize socket settings for low latency and enhanced performance.
- Add support for CPU affinity in worker threads.
- Implement graceful shutdown for worker threads during cleanup.
This commit is contained in:
2025-11-24 18:10:38 +00:00
committed by GitHub
parent 91e300afbc
commit 9535e0d2c8
5 changed files with 222 additions and 84 deletions

View File

@@ -9,8 +9,10 @@ NC := \033[0m
# Compiler and flags
CC = gcc
CFLAGS = -Wall -Wextra -O2 -D_GNU_SOURCE
LDFLAGS = -pthread
CFLAGS = -Wall -Wextra -Werror -O3 -march=native -mtune=native -flto -D_GNU_SOURCE -fstack-protector-strong
CFLAGS += -fPIE -fno-strict-overflow -Wformat -Wformat-security -Werror=format-security
CFLAGS += -D_FORTIFY_SOURCE=2 -fvisibility=hidden
LDFLAGS = -pthread -Wl,-z,relro,-z,now -pie
LIBS = -lssl -lcrypto -lmagic -lnghttp2
# Source files and object files
@@ -72,11 +74,20 @@ install-deps:
@echo "$(GREEN)Dependencies installed ✓$(NC)"
# Debug build
debug: CFLAGS += -g -DDEBUG
debug: CFLAGS = -Wall -Wextra -g -DDEBUG -D_GNU_SOURCE -fstack-protector-strong -O0
debug: clean all
# Release build
release: CFLAGS += -O3 -march=native -flto
# Release build with maximum optimizations
release: CFLAGS = -Wall -Wextra -O3 -march=native -mtune=native -flto -D_GNU_SOURCE
release: CFLAGS += -fPIE -fstack-protector-strong -D_FORTIFY_SOURCE=2 -fomit-frame-pointer
release: CFLAGS += -funroll-loops -finline-functions -ffast-math
release: clean all
# Profile-guided optimization build
pgo-generate: CFLAGS += -fprofile-generate
pgo-generate: clean all
pgo-use: CFLAGS += -fprofile-use -fprofile-correction
pgo-use: clean all
.PHONY: all clean install-deps debug release