TIM-JYU / TIM

TIM (The Interactive Material) is an open-source cloud-based platform for creating interactive learning documents.
https://tim.education/view/about/en-US
MIT License
13 stars 4 forks source link

distribute_rights: Add relayed right distribution #3652

Closed dezhidki closed 1 month ago

dezhidki commented 2 months ago

(Aikatestit ja esimerkit alla)

Fixes #3423

Description

This commit adds support for distributing rights using all available machines to improve distribution times.

The commit adds a new configuration option DIST_RIGHTS_NETWORK that allows to specify right distribution hosts and network as follows:

{
    # All TIM instances that can send and receive rights
    "hosts": {
        "machine1": "https://machine1.tim.education",
        "machine2": "https://machine2.tim.education",
        "machine3": "https://machine3.tim.education",
        "machine4": "https://machine4.tim.education",
    },
    # Describes how machines are linked together. The machines in the same group
    # can relay right distribution requests between each other.
    # Ideally, each group contains machines in the same network.
    "distribute_groups": {
        # Machines 1 and 2 are in the same network, thus they can share
        # rights with each other.
        "group1": [
            "machine1",
            "machine2"
        ],
        # Machines 3 and 4 are in the same network, but in a
        # different network than group1's machines.
        "group2": [
            "machine3",
            "machine4",
        ],
    },
    # Defines the machines that will be the first to receive the rights
    # Different users can be assigned different targets to ensure that
    # the first rights will land to correct machines-
    "distribute_targets": {
        "target1": [
            # Send right to machine1 and ask it to relay the request to group1's machines
            { "target": "machine1", "distribute_group": "group1"},
            # Also send the right to machine 3 and ask it to relay the request to group2's machines
            { "target": "machine3", "distribute_group": "group2"},
        ],
    },
}

Further, UserSelect now supports two new options

# If set to false, actions are applied without locking
# This speeds up right setting, but it can cause consistency problems
# if actions are applied to the same user multiple times
synchronizedGroupActions: false
actions:
    distributeRight:
        # Defines the TIM field from which to check what distribute_target to send the request to
        distNetworkTargetField: "93.networkTarget"

Testit

Sisäänkirjaus on testattavissa: https://aalto10.tim.education/view/dist_right_test/skannaus/sisaan?paikka=JY&sali=maa212 (oma admin-tunnus). Sisäänkirjauksen oikeudet voi tarkistaa: https://aalto01.tim.education/view/dist_right_test/koe (sama dokumentti on koneissa aalto{01..09} ja korona{01..07} ). Testisivu on simulaatio viime vuoden tilanteesta.

Tein lisäksi simuloidun aikatestauksen käytten viime vuoden hakijamääriä sekä salijakoja. Testausmenetelmä:

Testattu kaksi kirjaustapaa:

Mittaus:

Tulokset

Piippauksen kesto histogrammina

Alla olevat histogrammit kuvaavat, kuinka kauan keskimäärin kesti yksittäiselle hakijalle saada oikeus kokeeseen.

histo_k23

histo_k24

Huomiot:

Levitettyjen oikeuksien lukumäärä sisäänkirjauksen aloittamiesta

Alla olevat kuvaajat esittävät, kuinka monella hakijalle on onnistuneesti annettu oikeus siitä hetkestä, kun sisäänkirjaus aloitetaan. Kuvaaja siis kertoo, kuinka kauan kestää kirjata kaikki hakijat sisään.

cumul_k23 cumul_k24

Huomiot:

Kaikkiaan siis päivitetty tapa vaikuttaa olevan varmempi ja nopeampi ylipäätään väliaikaisen eheyden hinnalla sekä suuremman piippausviiveen takia.