Hyeongju Lee 이형주

A community rhythm game's server:
up to ~2,000 concurrent players

On WJMax, a community rhythm game made by two people, I handled the server, database and security; the other member built the game client. In the published server code, load, retries and input checks are covered by tests.

Period
Aug 2023 – Feb 2024By commit history
Type
Side projectTeam of two
Role
Server, database and securityGame client by the other member
Stack
FastAPI · DockerAWS EC2 · RDS MySQL · Cloudflare
Peak during updates~2,000playersConcurrent players
Usual~300playersAverage concurrent players
CI3databasesTests on SQLite · MySQL 8.0 · 8.4

Architecture

The game client reports the play count of each of a song's eight charts, and the server receives the reports and stores them in the database.

Built by me Others
  1. 01Client
    • Others
      The game client was built by the other member of the team.
      Scale
      ~300 concurrent players on average, up to ~2,000 during updates.
      Reports
      Sends the play count of each of a song's eight charts to the server.
  2. 02Edge
    • What I did
      Set up a Cloudflare proxy and WAF in front of the server, so abuse of the unauthenticated reports is stopped before it reaches the server.
      Stack
      • Cloudflare
      • WAF
  3. 03API server
    • What I did
      Ran the FastAPI play-log API in a Docker container on EC2. The public version deals with connection-pool exhaustion, duplicate storage of retried reports, and input checks.
      Stack
      • FastAPI
      • Docker
      • AWS EC2
  4. 04Storage
    • What I did
      Stored the play reports in RDS MySQL. The public version compares song titles exactly as written, so songs that differ only in case or in hiragana vs katakana stay separate.
      Stack
      • MySQL
      • AWS RDS
ResultRan through update days with up to ~2,000 concurrent playersNo raw data such as server logs remains, so the figures come from the earliest write-up, a 2025 portfolio made after the server closed

Problems handled in the public version

The request the game client sends stays as it was; the server-side problems were pinned down one by one with tests.

  1. Requests failing when many players send at once

    Problem
    The first draft of the public code took its database connection too early, so in a test with 60 clients sending at once, nearly half the requests ended up waiting on each other and failed.
    Fix
    The connection is now taken, used and returned inside one worker thread, and there are as many connections as worker threads (40). CI runs the 60-client test and checks that every request is answered.
  2. Retried reports stored twice

    Problem
    When a connection drops and the same report arrives again, its play counts can be added twice.
    Fix
    A report that carries a number (a report id) is stored only once per number. Two copies arriving at the same moment are still stored once, and the same number with different contents is refused. The released game sends no number, though, so its retries are still stored as separate reports.
  3. Song titles merging

    Problem
    By default MySQL does not tell upper from lower case or hiragana from katakana, so it treats “Glory” and “GLORY”, or “ゆめ” and “ユメ”, as the same song.
    Fix
    Titles and ids are compared exactly as written, character for character, and CI checks it.
  4. Input anyone can send

    Problem
    The released game sends its reports without any login, so anyone who knows the server's address can send one.
    Fix
    The server checks the format before it reads the contents and turns away malformed input and requests over 1 MB right away; Cloudflare in front also helps hold off abuse. The README also states the limit: a report does not prove that a play actually happened.

GitHub Actions runs the tests on SQLite and on MySQL 8.0 and 8.4, and checks that the database definition (schema.sql) matches the code.

  • Python
  • FastAPI
  • Docker
  • AWS EC2
  • AWS RDS
  • MySQL
  • Cloudflare
  • GitHub Actions
Contact

For roles and collaboration, please write by email.

I am looking for roles in data engineering, backend development and vision data pipelines.

Finishing my master's in March 2027