[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-112469":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":9,"language":10,"languages":9,"totalLinesOfCode":9,"stars":11,"forks":12,"watchers":13,"openIssues":14,"contributorsCount":15,"subscribersCount":15,"size":15,"stars1d":16,"stars7d":17,"stars30d":17,"stars90d":15,"forks30d":15,"starsTrendScore":18,"compositeScore":19,"rankGlobal":9,"rankLanguage":9,"license":20,"archived":21,"fork":21,"defaultBranch":22,"hasWiki":21,"hasPages":21,"topics":23,"createdAt":9,"pushedAt":24,"updatedAt":25,"readmeContent":26,"aiSummary":27,"trendingCount":15,"starSnapshotCount":15,"syncStatus":28,"lastSyncTime":29,"discoverSource":30},112469,"million-users-challenge","arjaythedev\u002Fmillion-users-challenge","arjaythedev","Can one 16-core server hold a million users? Implement the API, I benchmark it.",null,"Rust",71,95,51,7,0,4,19,24,65.33,"MIT License",false,"main",[],"2026-11-19 08:41:03","2026-11-22 22:59:26","# The Million Users Challenge\n\nCan one **16-core server** hold **a million users**, and how far past it can you go? **[See the leaderboard](https:\u002F\u002Fbenchmarks.arjaythedev.com\u002Fmillion-users)**\n\nI benchmarked C#, Node, Java, Rust, Python and Go, each with its most common framework set up the normal way, on\n1 to 16 cores, with Postgres on its own machine. The best of them held 665,000 users on 16 cores. None reached a million.\n\n**Now it's your turn: implement the same API in any language and framework, make it as fast as you can, and I'll\nbenchmark it on the same boxes: how many users it holds on 16 cores, on 8 and on 4.**\n\nThe boxes are [Synteq](https:\u002F\u002Fsynteq.com\u002Farjay) VPSs. To test on the same hardware, sign up through\n[synteq.com\u002Farjay](https:\u002F\u002Fsynteq.com\u002Farjay) and you get **$20 of free credit**.\n\n## What's here\n\n| | |\n|---|---|\n| [`SPEC.md`](SPEC.md) | The API you implement: 5 endpoints, exact JSON and errors, and the SQL you run |\n| [`schema.sql`](schema.sql) | The Postgres schema (fixed) |\n| [`seed\u002Fmake-seed.sh`](seed\u002Fmake-seed.sh) | Builds the seed database `feed_seed` (50k users, 500k posts, 2M likes) and `seed\u002Ftokens.json` |\n| [`test\u002Ftest.sh`](test\u002Ftest.sh) | The test suite (42 checks). Your server must pass all of them |\n| [`test\u002Frun.sh`](test\u002Frun.sh) | Builds your submission, starts it on a fresh database copy and runs the tests (what CI runs) |\n| [`bench\u002F`](bench) | The load generator I score with, and how to load test your own server |\n| [`box\u002F`](box) | How both boxes are set up: kernel limits, the systemd unit your server runs in, the Postgres config |\n| [`examples\u002F`](examples) | The six servers from the video (C#, Node, Java, Rust, Python, Go), with their 16-core scores. Copy one as a starting point |\n\n## Quick start\n\n```bash\nbash seed\u002Fmake-seed.sh                          # needs node >= 18, psql and a Postgres >= 16; about 30 seconds\nmkdir submissions\u002Frust-axum-yourname            # your code + install.sh, build.sh, start.sh, README.md\nbash test\u002Frun.sh submissions\u002Frust-axum-yourname # needs curl, jq, openssl\n```\n\nTo load test it yourself, see [`bench\u002FREADME.md`](bench\u002FREADME.md#load-test-your-own-server).\n\n## Rules\n\n**The stack**\n\n1. Any language, framework, runtime and Postgres driver. Any number of processes or threads.\n\n2. **The database is PostgreSQL 18 on its own machine**, at `$DATABASE_URL`. No other database, cache server or\n   external service (no Redis, Memcached, SQLite). Postgres's config is fixed ([`box\u002Fpostgresql.conf`](box\u002Fpostgresql.conf)).\n   Session-level `SET` on your own connections is fine; server-wide changes (`ALTER SYSTEM`,\n   `ALTER DATABASE\u002FROLE ... SET`) are not.\n\n3. **Treat the database machine as never the bottleneck.** It has 16 cores to itself, and if a run is limited by\n   the database box rather than your server, I give it more resources and run again. In return, the work stays in\n   your server: you run the queries in [SPEC.md](SPEC.md#endpoints), one per request. Preparing them, pipelining\n   them, and batching several requests' writes into one statement or transaction are fine. Moving work into\n   Postgres is not (building the JSON in SQL, extra queries, functions).\n\n4. The schema and data are fixed. Don't create, alter or drop anything in the database: no tables, columns,\n   indexes, views, functions, triggers or extensions.\n\n5. At most **512 open connections** to Postgres in total.\n\n**Correctness**\n\n6. Pass the test suite 100% (`test\u002Frun.sh`).\n\n7. **No caching across requests.** Every request reads its data from Postgres while it is being served: no\n   response caches, query-result caches, in-memory copies of tables, and no remembered JWT verifications. Connection\n   pools and prepared statements are fine: they cache connections and query plans, not data.\n\n8. **Writes are committed before you respond.** No `synchronous_commit = off`, no unlogged tables. Group commit is\n   allowed if each response waits for its commit.\n\n9. Every token's HS256 signature and `exp` are checked on every request. No hard-coded responses, no detecting the\n   load test, nothing that only works because it's a benchmark.\n\n**The box**\n\n10. Your server runs on Ubuntu 24.04 x86_64 with **16 vCPUs and 32 GB RAM**, alone (Postgres is on the other box).\n    If you run out of memory, you lose. If your server crashes, it isn't restarted.\n\n11. **No Nginx: you serve the internet directly**, on ports 80 and 81 at the same time (see\n    [SPEC.md](SPEC.md#runtime-contract)). At a million users that's a million open keep-alive connections, and the search goes past that.\n\n12. It is built from source on the box with your `install.sh` and `build.sh`. Pin your dependency versions,\n    and don't ship prebuilt binaries. It must answer `GET \u002Fhealth` within 60 seconds of `start.sh`.\n\n13. Nothing on the box gets tuned for you beyond [`box\u002Fsetup-app-box.sh`](box\u002Fsetup-app-box.sh): no kernel\n    parameters, and no pinning of CPU or other processes. Settings inside your own process (GC, thread counts,\n    allocator, pool sizes) are fair game.\n\n## Submitting\n\nOpen a pull request that adds one folder, `submissions\u002F\u003Clanguage>-\u003Cframework>-\u003Cgithub-username>\u002F`, containing:\n\n| File | What it does |\n|---|---|\n| `install.sh` | Runs once as root on a clean Ubuntu 24.04: installs your toolchain\u002Fruntime (apt, official tarballs) |\n| `build.sh` | Builds your app as a normal user (may download pinned dependencies) |\n| `start.sh` | Runs the server **in the foreground**, configured only by the env vars in [SPEC.md](SPEC.md#runtime-contract) |\n| `README.md` | Language, framework, driver and versions; the optimizations you made and why |\n| your code | Source only: don't commit build output (`bin\u002F`, `target\u002F`, `node_modules\u002F`, …). Add a `.gitignore` |\n\nThe [examples](examples) show all three scripts for six languages.\n\nCI runs `install.sh` and `test\u002Frun.sh` on every pull request, and it must be green. Don't touch files outside your folder.\nBy submitting, you license your code under the repo's [MIT license](LICENSE).\n\n## Scoring\n\nI benchmark each passing submission like the video: your server on the 16-core app box, Postgres on the database\nbox (a fresh copy of the seed for every run), and the load generator ([`bench\u002F`](bench)) on separate machines. A\nsimulated user browses the feed with think time: about one page every 24 seconds, so a million users is about\n42,000 requests per second.\n\n1. **Find the limit**: 2-minute runs. After each passing run, the next one goes to where your server's CPU says it\n   would be at about 85% (at least 25% more users, at most 4×), until one fails; then narrowing down to within 5%.\n\n2. **Confirm it**: one 5-minute hold at that number. If it fails, step down 5% and try again.\n\nEvery run starts your server fresh on a fresh copy of the database. A run passes with p95 under 500 ms, p99 under\n1 s and under 1% errors.\n\n**You get three scores: the most users held for 5 minutes on 16 cores, on 8 cores and on 4 cores.** On 8 and 4 cores\nyour server, the kernel's network processing and all, gets only those cores. The leaderboard ranks by 4 cores; entries\nwithin 5% of each other share a rank. Entries within 5% of the best 4-core score are scored as the median of 3 runs\non 8 and on 4 cores, and are also run on 2 cores: among them, the 2-core score sets the order (within 5% still shares\na rank).\n\n**16 cores is capped at 1,000,000 users**: past that, the one Postgres box (not your server) becomes the limit, so\nholding a million on 16 cores is the top 16-core score, shown as `1,000,000 (max)`. **8 and 4 cores are searched up to\n3,000,000 users**, with your server talking to the same single Postgres box. A score that reaches the search's\nceiling shows `(max)`.\n\nA run where a load generator or the database box, not your server, is the limit doesn't count: I add capacity and\nrun it again.\n\n**Pull requests are benchmarked as they come in**, oldest first, and the result goes on the\n[leaderboard](LEADERBOARD.md) and as a comment on your PR.\n","这是一个面向高并发Web服务性能极限验证的开源基准挑战项目，旨在测试单台16核服务器能否稳定支撑百万级在线用户连接与请求。项目定义了标准化API接口（5个端点）、固定PostgreSQL数据结构及完整测试套件，提供跨语言（Java\u002FC#\u002FRust\u002FGo等）实现的参考方案与统一负载测试框架。核心特点包括：严格隔离数据库资源（专用16核PG实例）、禁止引入缓存层、要求通过42项功能与协议合规性测试，并支持本地验证与公平横向对比。适用于后端架构师、高性能服务开发者进行服务容量评估、框架选型验证及性能调优实践。",2,"2026-11-24 04:43:33","CREATED_QUERY"]