Project

General

Profile

Tâche #30758

Scénario #30743: Lenteur d'affichage des réservations DHCP dans l'EAD3 sur Seth 2.7.2

Etude

Added by Emmanuel GARETTE 12 months ago. Updated 12 months ago.

Status:
Fermé
Priority:
Normal
Assigned To:
Start date:
09/28/2020
Due date:
% Done:

0%

Remaining (hours):
0.0

Description

J'ai testé :

#!/bin/bash

max=3000
maxcmd=100

i=0
idxcmd=0

machines=''

for digit3 in $(seq 2 200); do
    omac="00:16:0" 
    if [ $digit3 -gt 99 ]; then
        omac="${omac}${digit3:0:1}:${digit3:1:2}" 
    elif [ $digit3 -gt 9 ]; then
        omac="${omac}0:$digit3" 
    else
        omac="${omac}0:0$digit3" 
    fi

    for digit4 in $(seq 1 254); do
        i=$((i+1))
        idxcmd=$((idxcmd+1))
        if [ $digit4 -gt 99 ]; then
            mac="${omac}:0${digit4:0:1}:${digit4:1:2}" 
        elif [ $digit4 -gt 9 ]; then
            mac="${omac}:00:$digit4" 
        else
            mac="${omac}:00:0$digit4" 
        fi
        machines="$machines{\"hostname\": \"mach$i\", \"ip\": \"192.168.$digit3.$digit4\", \"macaddress\": \"$mac\"}, " 
        if [ $idxcmd = $maxcmd ]; then
            salt -c /etc/ead3/salt/ '*' ead.dhcp_upsert_reserved "[$machines]" 
            machines="" 
            idxcmd=0
        fi
        [ $i = $max ] && break
    done
    [ $i = $max ] && break
done

[ ! "$machines" = "" ]salt -c /etc/ead3/salt/ '*' ead.dhcp_upsert_reserved "[$machines]" 

Avec le config.eol suivant :

{"ip_haute_dhcp": {"owner": {"0": "gen_config"}, "val": {"0": "192.168.200.254"}}, "check_passwd": {"owner": "basique", "val": "non"}, "nom_domaine_local": {"owner": "basique", "val": "domscribe.ac-test.fr"}, "vm_swappiness": {"owner": "basique", "val": 0}, "bareos_sd_password": {"owner": "forced", "val": "73707fc2a90a490eb72bb3ffb54a1f79282504189c3aaa0f11a9a922"}, "bareos_db_mysql_password": {"owner": "gen_config", "val": "be5a9cbac630727e93f936fa17e9ba5086089c0637499a6f39bee091"}, "adresse_network_dhcp": {"owner": "gen_config", "val": ["192.168.0.0"]}, "nom_machine": {"owner": "basique", "val": "scribe"}, "bareos_dir_password": {"owner": "forced", "val": "1b0ec3f7246027d8e5cbfb17c7aac35bcc0f92f92921eb1d2b8dc4cc"}, "adresse_netmask_dhcp": {"owner": {"0": "gen_config"}, "val": {"0": "255.255.0.0"}}, "domaine_messagerie_etab": {"owner": "basique", "val": "ac-test.fr"}, "bash_tmout": {"owner": "basique", "val": 0}, "___version___": "2.7.2", "system_mail_from": {"owner": "basique", "val": "fromuser@ac-test.fr"}, "adresse_network_eth0": {"owner": "gen_config", "val": "192.168.0.0"}, "exim_relay_smtp": {"owner": "basique", "val": "smtp.in.ac-dijon.fr"}, "activer_dhcp": {"owner": "gen_config", "val": "oui"}, "bareos_dir_name": {"owner": "forced", "val": "scribe-dir"}, "adressage_statique": {"owner": {"0": "gen_config"}, "val": {"0": "oui"}}, "eolesso_port": {"owner": "gen_config", "val": 443}, "serveur_maj": {"owner": "basique", "val": ["test-eole.ac-dijon.fr"]}, "ead_support_multietab": {"owner": "gen_config", "val": "non"}, "nom_plage_dhcp": {"owner": {"0": "gen_config"}, "val": {"0": "test1"}}, "system_mail_to": {"owner": "basique", "val": "touser@ac-test.fr"}, "serveur_ntp": {"owner": "basique", "val": ["hestia.eole.lan"]}, "ip_basse_dhcp": {"owner": {"0": "gen_config"}, "val": {"0": "192.168.2.1"}}, "netmask_frontend_ead_distant_eth0": {"owner": {"0": "gen_config"}, "val": {"0": "0.0.0.0"}}, "ip_admin_eth0": {"owner": "basique", "val": ["0.0.0.0"]}, "numero_etab": {"owner": "basique", "val": "0000000A"}, "ad_local": {"owner": "forced", "val": "oui"}, "netmask_admin_eth0": {"owner": {"0": "basique"}, "val": {"0": "0.0.0.0"}}, "frontend_ead_distant_eth0": {"owner": "gen_config", "val": "oui"}, "check_for_username": {"owner": "creoleset", "val": "oui"}, "bareos_db_type": {"owner": "forced", "val": "mysql"}, "install_scribe_dmz": {"owner": "basique", "val": "oui"}, "activer_ead3": {"owner": "gen_config", "val": "oui"}, "ip_ssh_eth0": {"owner": "basique", "val": ["0.0.0.0"]}, "libelle_etab": {"owner": "basique", "val": "aca"}, "smb_workgroup": {"owner": "forced", "val": "domscribe"}, "smb_netbios_name": {"owner": "basique", "val": "scribe"}, "netmask_ssh_eth0": {"owner": {"0": "basique"}, "val": {"0": "0.0.0.0"}}, "omapi_secret": {"owner": "forced", "val": "bb4ee4a503027abe4ce1ad0ef1ce237cdb3dbb1c687c1e39894934fd"}, "adresse_ip_eth0": {"owner": "basique", "val": "192.168.0.26"}, "web_url": {"owner": "basique", "val": "scribe.ac-test.fr"}, "ad_public_address": {"owner": "gen_config", "val": "192.168.0.30"}, "ip_frontend_ead_distant_eth0": {"owner": "gen_config", "val": ["0.0.0.0"]}, "nom_academie": {"owner": "basique", "val": "ac-test"}, "adresse_ip_gw": {"owner": "basique", "val": "192.168.0.1"}, "adresse_ip_dns": {"owner": "basique", "val": ["192.168.0.1"]}}root@scribe:~# 
root@scribe:~# time salt-call -c /etc/ead3/salt ead.dhcp_get_reserved > /dev/null

real    0m3,978s
user    0m2,829s
sys    0m0,281s

History

#1 Updated by Emmanuel GARETTE 12 months ago

  • Status changed from Nouveau to En cours

#2 Updated by Emmanuel GARETTE 12 months ago

  • Assigned To set to Emmanuel GARETTE

#3 Updated by Emmanuel GARETTE 12 months ago

Je viens de faire un second test :

1/ création de plage automatique (ici 2 plages sur 20 établissement) :

#!/usr/bin/python
# -*- coding: utf-8 -*-

# importation des bibliothèques
from creole.loader import creole_loader, config_save_values

nb_etab = 20
reseaux = [{'nom': 'plage-{}'.format(i), 'reseau_statique': i*2+2, 'reseau_dynamique': i*2+3} for i in range(0, nb_etab)]

config = creole_loader(rw=True)

# je vide les precedentes declaration de reseau DHCP
del config.creole.dhcp.adresse_network_dhcp.adresse_network_dhcp

# configure les plages
for reseau in reseaux:
    for statique, res in [('oui', reseau['reseau_statique']), ('non', reseau['reseau_dynamique'])]:
        nom_plage_dhcp = reseau['nom']
        if statique == 'oui':
            nom_plage_dhcp += '-statique'
        adresse_network_dhcp = '10.173.{}.0'.format(res)
        ip_basse_dhcp = '10.173.{}.1'.format(res)
        ip_haute_dhcp = '10.173.{}.250'.format(res)
        adresse_ip_gw_dhcp = '10.173.{}.27'.format(res)
        config.creole.dhcp.adresse_network_dhcp.adresse_network_dhcp.append(adresse_network_dhcp)
        config.creole.dhcp.adresse_network_dhcp.adresse_netmask_dhcp[-1] = '255.255.255.0'
        config.creole.dhcp.adresse_network_dhcp.nom_plage_dhcp[-1] = nom_plage_dhcp
        config.creole.dhcp.adresse_network_dhcp.ip_basse_dhcp[-1] = ip_basse_dhcp
        config.creole.dhcp.adresse_network_dhcp.ip_haute_dhcp[-1] = ip_haute_dhcp
        config.creole.dhcp.adresse_network_dhcp.adressage_statique[-1] = statique
        config.creole.dhcp.adresse_network_dhcp.adresse_ip_gw_dhcp[-1] = adresse_ip_gw_dhcp
        config.creole.dhcp.adresse_network_dhcp.adresse_ip_dns_secondaire_dhcp[-1] = '10.173.2.32'
        config.creole.dhcp.adresse_network_dhcp.adresse_ip_ntp_dhcp[-1] = '10.173.2.31'

# enregistre les modifications
config_save_values(config, 'creole')

Je met 250 réservations sur ces établissements :

#!/bin/bash

nb_etab=19
nb_machin_per_etab=250

i=0
idxcmd=0
maxcmd=100

machines=''

for etab in $(seq 1 $nb_etab); do
    omac="00:16:0" 
    digit3=$((etab*2+2))
    if [ $digit3 -gt 99 ]; then
        omac="${omac}${digit3:0:1}:${digit3:1:2}" 
    elif [ $digit3 -gt 9 ]; then
        omac="${omac}0:$digit3" 
    else
        omac="${omac}0:0$digit3" 
    fi

    for digit4 in $(seq 1 $nb_machin_per_etab); do
        i=$((i+1))
        idxcmd=$((idxcmd+1))
        if [ $digit4 -gt 99 ]; then
            mac="${omac}:0${digit4:0:1}:${digit4:1:2}" 
        elif [ $digit4 -gt 9 ]; then
            mac="${omac}:00:$digit4" 
        else
            mac="${omac}:00:0$digit4" 
        fi
        machines="$machines{\"hostname\": \"mach$i\", \"ip\": \"10.173.$digit3.$digit4\", \"macaddress\": \"$mac\"}, " 
        if [ $idxcmd = $maxcmd ]; then
            salt -c /etc/ead3/salt/ '*' ead.dhcp_upsert_reserved "[$machines]" 
            machines="" 
            idxcmd=0
        fi
    done
done

[ ! "$machines" = "" ] && salt -c /etc/ead3/salt/ '*' ead.dhcp_upsert_reserved "[$machines]" 

Le temps de chargement est correct :

root@scribe:~# time salt-call -c /etc/ead3/salt ead.dhcp_get_reserved > /dev/null

real    0m5,006s
user    0m3,522s
sys    0m0,267s

#4 Updated by Emmanuel GARETTE 12 months ago

  • Status changed from En cours to Résolu

OK j'ai reproduit.

Il faut démarrer un machine : aca.scribe-2.7.2-instance-default

Remplacer le config.eol par :

{"ip_haute_dhcp": {"owner": {"0": "gen_config"}, "val": {"0": "192.168.200.254"}}, "check_passwd": {"owner": "basique", "val": "non"}, "nom_domaine_local": {"owner": "basique", "val": "domscribe.ac-test.fr"}, "vm_swappiness": {"owner": "basique", "val": 0}, "bareos_sd_password": {"owner": "forced", "val": "73707fc2a90a490eb72bb3ffb54a1f79282504189c3aaa0f11a9a922"}, "bareos_db_mysql_password": {"owner": "gen_config", "val": "be5a9cbac630727e93f936fa17e9ba5086089c0637499a6f39bee091"}, "adresse_network_dhcp": {"owner": "gen_config", "val": ["192.168.0.0"]}, "nom_machine": {"owner": "basique", "val": "scribe"}, "bareos_dir_password": {"owner": "forced", "val": "1b0ec3f7246027d8e5cbfb17c7aac35bcc0f92f92921eb1d2b8dc4cc"}, "adresse_netmask_dhcp": {"owner": {"0": "gen_config"}, "val": {"0": "255.255.0.0"}}, "domaine_messagerie_etab": {"owner": "basique", "val": "ac-test.fr"}, "bash_tmout": {"owner": "basique", "val": 0}, "___version___": "2.7.2", "system_mail_from": {"owner": "basique", "val": "fromuser@ac-test.fr"}, "adresse_network_eth0": {"owner": "gen_config", "val": "192.168.0.0"}, "exim_relay_smtp": {"owner": "basique", "val": "smtp.in.ac-dijon.fr"}, "activer_dhcp": {"owner": "gen_config", "val": "oui"}, "bareos_dir_name": {"owner": "forced", "val": "scribe-dir"}, "adressage_statique": {"owner": {"0": "gen_config"}, "val": {"0": "oui"}}, "eolesso_port": {"owner": "gen_config", "val": 443}, "serveur_maj": {"owner": "basique", "val": ["test-eole.ac-dijon.fr"]}, "ead_support_multietab": {"owner": "gen_config", "val": "non"}, "nom_plage_dhcp": {"owner": {"0": "gen_config"}, "val": {"0": "test1"}}, "system_mail_to": {"owner": "basique", "val": "touser@ac-test.fr"}, "serveur_ntp": {"owner": "basique", "val": ["hestia.eole.lan"]}, "ip_basse_dhcp": {"owner": {"0": "gen_config"}, "val": {"0": "192.168.2.1"}}, "netmask_frontend_ead_distant_eth0": {"owner": {"0": "gen_config"}, "val": {"0": "0.0.0.0"}}, "ip_admin_eth0": {"owner": "basique", "val": ["0.0.0.0"]}, "numero_etab": {"owner": "basique", "val": "0000000A"}, "ad_local": {"owner": "forced", "val": "oui"}, "netmask_admin_eth0": {"owner": {"0": "basique"}, "val": {"0": "0.0.0.0"}}, "frontend_ead_distant_eth0": {"owner": "gen_config", "val": "oui"}, "check_for_username": {"owner": "creoleset", "val": "oui"}, "bareos_db_type": {"owner": "forced", "val": "mysql"}, "install_scribe_dmz": {"owner": "basique", "val": "oui"}, "activer_ead3": {"owner": "gen_config", "val": "oui"}, "ip_ssh_eth0": {"owner": "basique", "val": ["0.0.0.0"]}, "libelle_etab": {"owner": "basique", "val": "aca"}, "smb_workgroup": {"owner": "forced", "val": "domscribe"}, "smb_netbios_name": {"owner": "basique", "val": "scribe"}, "netmask_ssh_eth0": {"owner": {"0": "basique"}, "val": {"0": "0.0.0.0"}}, "omapi_secret": {"owner": "forced", "val": "bb4ee4a503027abe4ce1ad0ef1ce237cdb3dbb1c687c1e39894934fd"}, "adresse_ip_eth0": {"owner": "basique", "val": "192.168.0.26"}, "web_url": {"owner": "basique", "val": "scribe.ac-test.fr"}, "ad_public_address": {"owner": "gen_config", "val": "192.168.0.30"}, "ip_frontend_ead_distant_eth0": {"owner": "gen_config", "val": ["0.0.0.0"]}, "nom_academie": {"owner": "basique", "val": "ac-test"}, "adresse_ip_gw": {"owner": "basique", "val": "192.168.0.1"}, "adresse_ip_dns": {"owner": "basique", "val": ["192.168.0.1"]}}

Puis reconfigure.

Créer 100 leases ou plus (valeur max du script) :

#!/bin/bash

FILE=/var/lib/dhcp/dhcpd.leases
[ ! -e /root/dhcpd.leases ] && cp /var/lib/dhcp/dhcpd.leases /root/dhcpd.leases

cp -a /root/dhcpd.leases /var/lib/dhcp/dhcpd.leases

max=100

i=0

for digit3 in $(seq 2 200); do
    omac="00:16:0" 
    if [ $digit3 -gt 99 ]; then
        omac="${omac}${digit3:0:1}:${digit3:1:2}" 
    elif [ $digit3 -gt 9 ]; then
        omac="${omac}0:$digit3" 
    else
        omac="${omac}0:0$digit3" 
    fi

    for digit4 in $(seq 1 254); do
        i=$((i+1))
        if [ $digit4 -gt 99 ]; then
            mac="${omac}:0${digit4:0:1}:${digit4:1:2}" 
        elif [ $digit4 -gt 9 ]; then
            mac="${omac}:00:$digit4" 
        else
            mac="${omac}:00:0$digit4" 
        fi
        echo """ 
lease 192.168.$digit3.$digit4 {
  starts 2 2020/09/29 12:18:12;
  ends 2 2020/09/29 22:18:12;
  cltt 2 2020/09/29 12:18:12;
  binding state active;
  next binding state free;
  rewind binding state free;
  hardware ethernet $mac;
  client-hostname "mach$i";
}
""" >> /var/lib/dhcp/dhcpd.leases
        [ $i = $max ] && break
    done
    [ $i = $max ] && break
done

Dans https://scribe.ac-test.fr/ead/#/elements/dhcpactivation (action DHCP : Compatibilité EAD2/EAD3) mettre "oui" et "valider".

L'action problématique est 'Paramétrer le DHCP' : https://scribe.ac-test.fr/ead/#/elements/dhcp

L'onglet Baux est lent.

#5 Updated by Matthieu Lamalle 12 months ago

La lenteur ne viens pas du backend, mais plutôt du frontend.
Il y a beaucoup de traitement javascript superflu.

Il faudrait alléger un maximum les traitements à l'affichage et en profiter pour revoir l'ergonomie.

#6 Updated by Fabrice Barconnière 12 months ago

  • Status changed from Résolu to Fermé
  • Remaining (hours) set to 0.0

Also available in: Atom PDF