-
Notifications
You must be signed in to change notification settings - Fork 276
Scaling and load testing
DOMjudge has been used in (very) large contests and can handle 1000+ teams and large sets of problems. Of course enough resources are needed.
The domserver can be scaled horizontally if wanted when the instances use the same database and there's a shared storage of PHP sessions (e.g. the same database, or redis or any of the other ways to create shared PHP sessions). See https://symfony.com/doc/current/session/database.html for general instructions on how to set up shared sessions in Symfony, the framework DOMjudge uses.
For DOMjudge load testing with gatling, see: https://github.com/ubergeek42/domjudge-gatling
-
https://github.com/DOMjudge/domjudge/blob/master/etc/domjudge-fpm.conf.in#L15 - Adjust the
max_children
value in the fpm configuration. This value is based on the amount of memory your server has, divided by the memory usage of the domjudge php process. The guidelines in the file indicate 40 per GiB of memory(which is ~25MiB/process), but I think this should be closer to ~125MiB per process(~10/GiB).- You need at least one worker per concurrent connection you expect to handle. Remember that requests from judgehosts count, as well as all requests from team machines/spectators/etc. Most DOMjudge webpages automatically refresh every 30s(Scoreboard, team page, etc)
-
In the
server
block of nginx, you may want to enable caching file descriptors/metadata. Something like the following has been used in the past:# Cache file descriptors and metadata, which greatly speeds up file access. # However, it means that the server won't react immediately to changes on disk, # but this is not an issue for DOMjudge as the filesystem is static open_file_cache max=1000 inactive=20s; open_file_cache_valid 30s; open_file_cache_min_uses 2; open_file_cache_errors on;
* Enable caching of static content(If using nginx). In the `location` block, you may want to turn on caching for static files. This will help reduce the number of hits to nginx; and allow offloading static content to a CDN if you're using one.
```
# enable caching for static files
location ~* \.(jpg|jpeg|png|css|js)\$ {
access_log off;
log_not_found off;
expires 6h; # adjust as needed
}