This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
This is private-isu, a practice environment for ISUCON (Japanese web performance competition). It's a social media-like web application with multiple language implementations designed for learning web performance optimization.
Before working with any implementation, initialize the project:
make init # Downloads initial data (dump.sql.bz2 and image files)The webapp has 5 different language implementations of the same application:
- Ruby (default): Sinatra + Unicorn
- Go: chi router + sqlx + gomemcache
- PHP: Slim framework + PHP-FPM
- Python: Flask + gunicorn
- Node.js/TypeScript: Hono framework + @hono/node-server
Go implementation:
cd webapp/golang
make # builds to ./appNode.js implementation:
cd webapp/node
npm install
npm start # or npm run dev for developmentBenchmarker:
cd benchmarker
make # builds to ./bin/benchmarkerDocker Compose (recommended for development):
cd webapp
docker compose upLocal Ruby development:
cd webapp/ruby
bundle install --path=vendor/bundle
bundle exec unicorn -c unicorn_config.rbRunning benchmarker:
cd benchmarker
./bin/benchmarker -t "http://localhost:8080" -u ./userdataExpected output format:
{"pass":true,"score":1710,"success":1434,"fail":0,"messages":[]}- Database: MySQL 8.4 with users, posts, comments tables
- Cache: Memcached for session storage
- Web Server: Nginx as reverse proxy
- Images: Stored as BLOB in database (performance optimization target)
The application is intentionally designed with performance issues:
- Images stored in database as BLOBs
- N+1 query problems in timeline generation
- No database indexing optimization
- Session data stored in database instead of cache
Main tables:
users: User accounts and authenticationposts: Image posts with binary datacomments: User comments on posts
- User registration and authentication
- Image upload and display
- Timeline feed with posts and comments
- User profile pages
- Admin functionality
- Docker Compose: Full stack with all services
- Vagrant: VM-based development with Ansible provisioning
- Local development: Direct installation of dependencies
- Cloud deployment: AWS AMI or cloud-init scripts
├── benchmarker/ # Go-based load testing tool
├── webapp/ # Multi-language implementations
│ ├── golang/ # Go implementation
│ ├── ruby/ # Ruby implementation (default)
│ ├── php/ # PHP implementation
│ ├── python/ # Python implementation
│ ├── node/ # Node.js/TypeScript implementation
│ └── sql/ # Database initialization
├── provisioning/ # Ansible playbooks
└── manual.md # Competition manual
Common optimization targets:
- Move image storage from database to filesystem/object storage
- Add database indexes for timeline queries
- Implement proper caching strategies
- Optimize N+1 queries with JOIN operations
- Use CDN for static assets
- Implement connection pooling
- Uses
chirouter,sqlxfor database,gomemcachefor caching - Binary:
./app - Database connection via environment variables
- Uses
Sinatraframework withUnicornserver - Session management via
Rack::Session::Memcache - Start with:
bundle exec unicorn -c unicorn_config.rb
- Uses
Slimframework withPHP-FPM - Requires nginx configuration change for routing
- Database access via
PDO
- Uses
Flaskframework withgunicorn - Dependencies managed via
uv(pyproject.toml) - Memcached integration via
python-memcached
- Uses
Honoframework with@hono/node-server - TypeScript-based implementation
- Dependencies:
mysql2,multer,ejs - Start with:
npm startornpm run dev
Key environment variables for applications:
ISUCONP_DB_HOST: Database hostnameISUCONP_DB_PORT: Database port (3306)ISUCONP_DB_USER: Database userISUCONP_DB_PASSWORD: Database passwordISUCONP_DB_NAME: Database name (isuconp)ISUCONP_MEMCACHED_ADDRESS: Memcached server address