Apc presentation
Upcoming SlideShare
Loading in...5
×
 

Apc presentation

on

  • 2,301 views

Apc php ext in romanian

Apc php ext in romanian

Statistics

Views

Total Views
2,301
Views on SlideShare
1,377
Embed Views
924

Actions

Likes
0
Downloads
12
Comments
0

11 Embeds 924

http://kingfff.blogspot.tw 496
http://kingfff.blogspot.com 285
http://www.clickla.com 61
http://kingfff.blogspot.hk 54
http://kingfff.blogspot.jp 10
http://www.slideshare.net 6
http://feeds.feedburner.com 4
http://kingfff.blogspot.sg 4
http://webcache.googleusercontent.com 2
http://kingfff.blogspot.mx 1
http://translate.googleusercontent.com 1
More...

Accessibility

Categories

Upload Details

Uploaded via as OpenOffice

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Apc presentation Apc presentation Presentation Transcript

    • Serban Nicolae [email_address]
      • Netbridge Development SRL
      APC - Alternative PHP Cache opcode cache
    • APC - Alternative PHP Cache
      • Anatomia unui request php
      • APC
        • Instalare
        • Facilitati oferite
        • Configurare
        • Teste
    • APC - Alternative PHP Cache
        Anatomia unui request php
      <?php $a = 1; $b = 2; $c = $a + $b; echo $c; ?> Exemplu: play.php
    • APC - Alternative PHP Cache Read Output Parse Compile Execute play.php
        Anatomia unui request php
    • APC - Alternative PHP Cache Output Parse Compile Execute play.php
        Anatomia unui request php
      Read Server API ( SAPI) - mod_php ( Apache 2) - FastCGI ( Lighttpd, Nginx ) - php-fpm ( Lighttpd, Nginx )
    • APC - Alternative PHP Cache Output Compile Execute
        Anatomia unui request php
      Read Parsarea - Se parcurge codul sursa si se genereaza o serie de token-uri pentru fiecare cuvant din codul sursa. - Se analizeaza token-urile si se determina structura lor gramaticala. - Se compara structura gramaticala cu cea definita in regulile de sintaxa ale limbajului. Parse Exemplu greseala de sintaxa: PHP Parse error: syntax error, unexpected T_VARIABLE in play.php on line 3
    • APC - Alternative PHP Cache
        Anatomia unui request php
      <?php $a = 1; $b = 2; $c = $a + $b; echo $c; ?> T_OPEN_TAG :: <?php T_WHITESPACE :: T_VARIABLE :: $a = T_LNUMBER :: 1 T_WHITESPACE :: T_VARIABLE :: $b = T_LNUMBER :: 2 ; T_WHITESPACE :: T_VARIABLE :: $c = T_VARIABLE :: $a + T_VARIABLE :: $b ; T_WHITESPACE :: T_ECHO :: echo T_WHITESPACE :: T_VARIABLE :: $c ; T_WHITESPACE :: T_CLOSE_TAG :: ?> Parsare * Cu ajutorul functiilor PHP token_get_all(<STRING>) si token_name(<INT>)
    • APC - Alternative PHP Cache Output Execute
        Anatomia unui request php
      Read Compilarea - Se face doar in cazul in care nu exista greseli de sintaxa. - Generarea de bytecode ( numit opcode ) pe baza codului sursa. - Codul opcode este generat de catre Zend Engine - Rularea lui se face tot de catre Zend Engine Exemple de instructiuni opcode intelese de Zend Engine: NOP, ADD, DIV, IS_EQUAL, ASSIGN_ADD, CAST .... Lista completa: http://www.php.net/manual/en/internals2.opcodes.list.php Parse Compile
    • APC - Alternative PHP Cache Output Execute
        Anatomia unui request php
      Read Parse Compile Finding entry points Branch analysis from position: 0 Return found filename: /media/projects/play/public/play.php function name: (null) number of ops: 6 compiled vars: !0 = $a, !1 = $b, !2 = $c line # * op fetch ext return operands --------------------------------------------------------------------------------- 2 0 > ASSIGN !0, 1 3 1 ASSIGN !1, 2 4 2 ADD ~2 !0, !1 3 ASSIGN !2, ~2 5 4 ECHO !2 7 5 > RETURN 1 branch: # 0; line: 2- 7; sop: 0; eop: 5 OPCODE play.php * Cu ajutorul extensiei PHP Vulcan Logic Disassembler (VLD)
    • APC - Alternative PHP Cache Output Execute
        Anatomia unui request php
      Read Parse Compile Pentru fiecare fisier cod sursa php dintr-un proiect web se efectueaza parsarea si compilarea lui la fiecare cerere catre serverul web. Pe masinile de productie codul sursa al fisierelor se modifica foarte rar . Cum se poate imbunatatii timpul de executie ...
    • APC - Alternative PHP Cache Read Output Parse Compile Execute play.php Cache opcode PHP
    • APC - Alternative PHP Cache A lternative P HP C ache ( APC ) Este o extensie pentru php care realizeaza cache pentru codul intern al lui Zend Engine si anume opcode . Cachul este tinut in RAM. Instalarea se face cu ajutorul PECL pecl install apc Se configureaza cu ajutorul fisierului php.ini Se doreste introducerea extensiei in Core incepand cu PHP 6. Extensia ofera un set de functii pentru manevrarea cache-ului. Este dezvoltata de comunitatea php.net
    • APC - Alternative PHP Cache Facilitati oferite - opcode cache ( prin incarcarea extensiei ) - optimizarea codului opcode ( prin incarcarea extensiei ) - cache pentru continut ( date din DB ) ( prin functiile apc_add(), apc_store(), apc_fetch(), apc_delete() ) - acces la date in momentul cand se efectueaza un upload ( prin variabila APC_UPLOAD_PROGRESS )
    • APC - Alternative PHP Cache Exemplu de configurare in php.ini apc.enabled = On apc.stat = Off apc.shm_size = 30 apc.shm_segments = 1 apc.ttl = 0 apc.optimization = 3
    • APC - Alternative PHP Cache Teste Web site: http://www.serbanalexandru.ro Nginx 0.8.36 | PHP 5.3.2 | WordPress 2.9.2 Tool pentru testare Apache Benchmark (ab) ab -n 500 -c 10 http://www.serbanalexandru.ro/ CU APC Concurrency Level: 10 Time taken for tests: 59.218 seconds Complete requests: 500 Failed requests: 0 Write errors: 0 Total transferred: 15562500 bytes HTML transferred: 15449000 bytes Requests per second: 8.44 [#/sec] (mean) Time per request: 1184.353 [ms] (mean) Time per request: 118.435 [ms] (mean, across all concurrent requests) Transfer rate: 256.64 [Kbytes/sec] received FARA APC Concurrency Level: 10 Time taken for tests: 138.903 seconds Complete requests: 500 Failed requests: 0 Write errors: 0 Total transferred: 15562500 bytes HTML transferred: 15449000 bytes Requests per second: 3.60 [#/sec] (mean) Time per request: 2778.058 [ms] (mean) Time per request: 277.806 [ms] (mean, across all concurrent requests) Transfer rate: 109.41 [Kbytes/sec] received
    • APC - Alternative PHP Cache Va multumesc