PHP Classes

File: examples/case-studies/system/performance/thread_load_balancer-GR.md

Recommend this page to a friend!
  Packages of Christos Drogidis   Ascoos OS   examples/case-studies/system/performance/thread_load_balancer-GR.md   Download  
File: examples/case-studies/system/performance/thread_load_balancer-GR.md
Role: Auxiliary data
Content type: text/markdown
Description: Auxiliary data
Class: Ascoos OS
A PHP Web 5.0 Kernel for decentralized web and IoT
Author: By
Last change: Update of examples/case-studies/system/performance/thread_load_balancer-GR.md
Date: 8 months ago
Size: 3,106 bytes
 

Contents

Class file image Download

???????????? ?????? ?? ??????

???? ? ?????? ?????????? ??????????? ??? ?? Ascoos OS ?????? ?? ?????????? ???????? ???????? ?? ?????? ?? ???? ??? ???????? ????? CPU ??? ??????. ??????????? ???????? ??????? ?????????????? ?????? ???? ?? ????? ????? ??????????????.

??????

?? ?????????? ????????? ??? ???????? ??????? ??? Ascoos OS: - TThreadHandler: ????????????? ??? ??????? ?????? ??????????. - TCoreSystemHandler: ???????????? ?????? ?????????? ???? CPU ??? ?????.

????

? ?????? ??????????? ?? ??? ?????? PHP: - thread_load_balancer.php: ???????????? ?????? ????????? ????????? ???????? ????? ?????? ??????????.

??????????????

  1. ??????????? ??? Ascoos OS (????? repository).
  2. ?????????? ???????? ???? ?????? `$AOS_LOGS_PATH`.
  3. ? ?????????? phpBCL8 ????? ???????????????? ??? ?????????? ????????.

??????????

  1. ?????? ??? ???????? ??? ?? ???? ??????.
  2. ????????? ?? script ???? web server:
    https://localhost/aos/examples/case-studies/system/performance/thread_load_balancer.php
    

?????????? ??????

$cpuLoad = $systemHandler->get_cpu_load();
$memoryLoad = $systemHandler->get_memory_stats()['percent'];

if ($cpuLoad < 80 && $memoryLoad < 85) {
    $threadHandler->startThread("task_$index", $task);
}

??????????? ??????????

?? script ??????? ?????? ???? ???? ? ?????? ????? ?????????. ?????????? log:

Thread task_0 started (CPU: 42%, Memory: 61%)
Thread task_3 skipped due to high load (CPU: 87%, Memory: 90%)

?????

??????????

?????? ?? ???????????? ?? ???? ?? ?????? ??????????; ????? fork ?? ??????????, ???????????? ? ????????? ???? ??????????? ??? thread_load_balancer.php, ??? ????????? pull request. ????? ?? CONTRIBUTING.md ??? ???????.

????? ??????

???? ? ?????? ?????????? ?????????? ??? ??? Ascoos General License (AGL). ????? ?? LICENSE.