redis/redis
The runtime is one `redis-server` binary whose `main()` in `src/server.c` initializes config, ACL, the module system and connection types, then hands control to the `ae` event loop (`aeMain`). The same binary multiplexes into sentinel, `redis-check-rdb` and `redis-check-aof` modes by argv[0] inspection. Storage is entirely in-process (`kvstore`/`dict`/`listpack`/`quicklist`/`rax`/`ebuckets`), persisted by RDB snapshot and/or AOF manifest, and replicated over a custom PSYNC protocol. Build is GNU Make: `src/Makefile` compiles the core and vendored `deps/`, while the top-level `Makefile` delegates to `scripts/*.sh` for the module-bundle workflow. Deployment shape is a bare binary + `redis.conf` (or the generated `redis-full.conf`), with an Ubuntu 24.04 build image in `docker/Dockerfile.noble`.
- `main()` in src/server.c is the single entrypoint for redis-server, redis-sentinel, redis-check-rdb and redis-check-aof: it calls `checkForSentinelMode()` on argv, then dispatches to `redis_check_rdb_main()` / `redis_check_aof_main()` when `strstr(exec_name, "redis-check-rdb"/"redis-check-aof")` matches, before any config parsing.
- Startup order in `main()` is fixed and dependency-driven: `initServerConfig()` → `ACLInit()` (commented 'must be initialized ASAP because the basic networking code and client creation depends on it') → `moduleInitModulesSystem()` → `connTypeInitialize()` → `keyMetaInit()`.
- The event loop is created in `initServer()` via `aeCreateEventLoop(server.maxclients+CONFIG_FDSET_INCR)`, and per-DB storage is allocated as three parallel structures — `kvstoreCreate()` for `db->keys`, `db->expires`, plus `blessedKvstoreCreate()` for `db->blessed_keys` and `estoreCreate()` for `db->subexpires`.
- `main()` ends with `aeMain(server.el)` after `redisSetCpuAffinity(server.server_cpulist)` and `setOOMScoreAdj(-1)`; everything after that point is event-loop driven.
- The core links 130+ objects listed in `REDIS_SERVER_OBJ` in src/Makefile, including the non-upstream modules `bless.o t_array.o sparsearray.o chk.o hotkeys.o gcra.o vector.o fwtree.o estore.o client_comp.o cluster_asm.o iothread.o keymeta.o`.
- Vendored third-party code lives in `deps/` and is built as separate targets: `DEPENDENCY_TARGETS=hiredis linenoise lua hdr_histogram fpconv xxhash tre` — note `tre` (regex) is a dependency of the new array type, which includes `../deps/tre/local_includes/tre.h`.
- The top-level Makefile is not upstream's: it includes `modules/manifest.mk`, defines a `GOALS_WITH_ARGS` positional-argument capture mechanism, and routes `build`/`clean`/`test`/`deploy`/`bootstrap`/`run`/`tarball` to `scripts/*.sh` rather than recursing into `src/`.
- `modules/modules.yaml` is the single source of truth pinning four external modules to immutable refs: redisbloom v8.11.81, redisearch v8.10.1 (with `build_env: LTO=1 REDISEARCH_GENERATE_HEADERS=0 INLINE_LSE_ATOMICS=0`), redisjson v8.10.0, redistimeseries v8.10.0.
- Test entrypoints are four shell wrappers that locate tclsh 8.5–9.0 and invoke `tests/test_helper.tcl`: `./runtest`, `./runtest-moduleapi` (which first runs `$MAKE -C tests/modules` then names 48 `--single unit/moduleapi/*` suites), `./runtest-cluster`, `./runtest-sentinel`.
- `make -C src test` depends on building redis-server, redis-check-aof, redis-cli, redis-benchmark and `module_tests` before shelling out to `(cd ..; ./runtest)`; `test-modules`, `test-sentinel`, `test-cluster` are separate targets.
- External integrations are network protocols rather than SDKs: the cluster bus (`src/cluster_legacy.c`), the PSYNC replication protocol (`src/replication.c`), TLS via OpenSSL gated on `BUILD_TLS=yes|module` (`src/tls.c`), and optional zstd compression gated on `-DUSE_COMPRESSION=1` detected via pkg-config.
- The deployment artifact set is defined by `scripts/deploy.sh` / `scripts/uninstall.sh`: core binaries and symlinks into `$(PREFIX)/bin` (default `/usr/local`) and module `.so` files into `$(PREFIX)/lib/redis/modules`, with `loadmodule` paths rewritten into a generated `redis-full.conf`.
- `docker/Dockerfile.noble` is the only container definition — an Ubuntu 24.04 multi-arch build environment (amd64+arm64) that installs Redis prereqs and then runs `modules/docker-install-bundled-module-deps.sh` to execute each bundled module's `.install/install_script.sh`. It is a build image, not a runtime image.
- Memory allocator selection is a build-time runtime boundary: `MALLOC` defaults to `jemalloc` on Linux and `libc` elsewhere, and is forcibly downgraded to `libc` whenever `SANITIZER` is set.