DOMjudge / domjudge-packaging

DOMjudge packaging for (Linux) distributions and live image
31 stars 37 forks source link

Scalable domserver #130

Open arasHi87 opened 2 years ago

arasHi87 commented 2 years ago

Cause I deploy domserver in k8s, so I need to let domserver to be scaleable, but I can't find relevant information on the Internet, so I leave my solution here for someone who need this (all we need just to modify the official Dockerfile).

Install dependency

# Install required packages for running of domserver
RUN apt update \
    && apt install --no-install-recommends --no-install-suggests -y \
    acl curl zip unzip supervisor mariadb-client apache2-utils \
    nginx php-cli php-fpm php-zip \
    php-gd php-curl php-mysql php-json php-intl \
    php-gmp php-xml php-mbstring php-ldap php-pear php-dev \
    enscript lpr make libzstd-dev \
    ca-certificates python3-yaml \
    && rm -rf /var/lib/apt/lists/*

Install php-ext

RUN yes | pecl install zstd igbinary redis

Set php-ini

RUN sed -i 's/;session.save_path/session.save_path/g' /etc/php/7.4/fpm/php.ini && \
    sed -i 's/\/var\/lib\/php\/sessions/tcp:\/\/domjudge-redis:6379/g' /etc/php/7.4/fpm/php.ini && \ 
    sed -i 's/= files/= redis/g' /etc/php/7.4/fpm/php.ini && \
    sed -i '938i\extension=zsdt.so' /etc/php/7.4/fpm/php.ini && \
    sed -i '938i\extension=igbinary.so' /etc/php/7.4/fpm/php.ini && \
    sed -i '938i\extension=redis.so' /etc/php/7.4/fpm/php.ini && \
    service php7.4-fpm restart

Done

And remember to change the redis host to yourself, hope this can helps guy!

nickygerritsen commented 2 years ago

In the past we have used the database to store sessions to achieve the same. I remember talking about making this the default. @ubergeek42 do you remember why we didn’t do this? It would help these kinds of cases (and even help us at the world finals to actually have two active nodes)

arasHi87 commented 2 years ago

In the past we have used the database to store sessions to achieve the same. I remember talking about making this the default. @ubergeek42 do you remember why we didn’t do this? It would help these kinds of cases (and even help us at the world finals to actually have two active nodes)

Is domjudge still support this feature? If so, is there any document? thx

ubergeek42 commented 2 years ago

I'm not sure why we didn't do it by default, I guess performance is probably better if you're on a single node and don't need to hit the database for sessions too. But that's probably a tiny impact.

We have a small wiki page which briefly discusses using the session based storage: https://github.com/DOMjudge/domjudge/wiki/Scaling-and-load-testing

But it's basically just follow the symfony docs: https://symfony.com/doc/current/session/database.html

nickygerritsen commented 2 years ago

I'm not sure why we didn't do it by default, I guess performance is probably better if you're on a single node and don't need to hit the database for sessions too. But that's probably a tiny impact.

Can we somehow measure this? If the impact is near-zero, I would propose to make it the default.