Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> PHP pthreads spadek wydajności w przeglądarce względem konsoli WINDOWS, wielowątkowość
Bargor
post
Post #1





Grupa: Zarejestrowani
Postów: 1
Pomógł: 0
Dołączył: 30.06.2015

Ostrzeżenie: (0%)
-----


Witam.

Zainstalowałem bibliotekę pthreads według instrukcji znalezionej tutaj
http://php.net/manual/en/pthreads.installation.php
Zainstalowała się poprawnie.

Ale

Uruchomiłem kilka razy skrypt Benchmark.php pobrany z stąd
https://github.com/krakjoe/pthreads/blob/ma...s/Benchmark.php


  1. class T extends Thread {
  2. public function run() {}
  3. }
  4.  
  5. $max = @$argv[1] ? $argv[1] : 100;
  6. $sample = @$argv[2] ? $argv[2] : 5;
  7.  
  8. printf("Start(%d) ...", $max);
  9. $it = 0;
  10. do {
  11. $s = microtime(true);
  12. /* begin test */
  13. $ts = [];
  14. while (count($ts)<$max) {
  15. $t = new T();
  16. $t->start();
  17. $ts[]=$t;
  18. }
  19. $ts = [];
  20. /* end test */
  21.  
  22. $ti [] = $max/(microtime(true)-$s);
  23. printf(".");
  24. } while ($it++ < $sample);
  25.  
  26. printf(" %.3f tps\n", array_sum($ti) / count($ti));



#Windows console:

Działa prawidłowo i tak samo:
#First run 1102 Thread per s


#Second run 974 Thread per s


RAM used ~600MB

Kiedy skrypt zakończy działanie proces php.exe zostaje zakończony a pamięć zwolniona

#Przeglądarka(FF i Chrome ten sam błąd)

#First run 1175 Thread per s and 161 RAM


#Second run 565 Thread per s and 534 RAM

#Third run 235 Thread per s and 977 RAM


Po wykonaniu skryptu proces httpd.exe ZOSTAJE A PAMIĘĆ NIE ZOSTAJE UWOLNIONA.

W najgorszej sytuacji wydajność spadła do 20 t/ps a httpd.exe zjadł prawie 6GB RAM


Konfiguracja:

> Windows 7 64 bit
>
> WampServer64
> PHP Version :5.5.12
> (php info)
> Compiler MSVC11 (Visual C++ 2012)
> Architecture x64
> Zend Extension Build API220121212,TS,VC11
> PHP Extension Build API20121212,TS,VC11
>Thread Safety enabled
>
> Apache Version :2.4.9
>
> Procesor: i7-4790k

Bardzo mi zależy na uruchomieniu skryptów używających pthreads przez przeglądarkę. Czy ktoś wie dlaczego tak się dzieje?
Bardzo proszę o pomoc.

Ten post edytował Bargor 30.06.2015, 14:45:32
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi (1 - 1)
CuteOne
post
Post #2





Grupa: Zarejestrowani
Postów: 2 958
Pomógł: 574
Dołączył: 23.09.2008
Skąd: wiesz, że tu jestem?

Ostrzeżenie: (0%)
-----


http://stackoverflow.com/questions/2334126...bage-collection
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 19.08.2025 - 18:06