-
-
Save dshafik/2d4b2b7fe87486c2314f to your computer and use it in GitHub Desktop.
PHP Performance I: Everything You Need to Know About OpCode Caches, examples
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[zendopcache] | |
zend_extension=/full/path/to/opcache.so ; May be added by pecl | |
opcache.memory_consumption=128 | |
opcache.interned_strings_buffer=8 | |
opcache.max_accelerated_files=4000 | |
opcache.revalidate_freq=60 | |
opcache.fast_shutdown=1 | |
opcache.enable_cli=1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[apcu] | |
extension=apcu.so ; May be added by pecl | |
apc.serializer=php ; See bug report for more info: http://ey.io/1aJhcOY |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[apc] | |
extension=apc.so ; May be added by pecl | |
apc.enabled=1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"repositories": [ | |
{ | |
"type": "vcs", | |
"url": "http://github.com/engineyard/ey-php-performance-tools" | |
} | |
], | |
"require": { | |
"php": ">=5.3.3", | |
"engineyard/php-performance-tools": "dev-master" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
return [ | |
/* URLs to cache */ | |
'urls' => [ | |
'http://ephernote.com/', | |
'http://ephernote.com/user/login', | |
'http://ephernote.com/user/register', | |
'http://ephernote.com/privary', // Note: this is a typo | |
], | |
/* How many concurrent HTTP requests to make (requires the pecl_http extension) */ | |
'threads' => 3 | |
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
=== Cache Primer === | |
Attempting to cache 4 URLs: | |
Running in parallel with 3 concurrent requests | |
...! | |
Cached 3 URLs in 0.6162059307098 seconds | |
Encountered 1 errors |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
=== Cache Primer === | |
Attempting to cache 104 URLs: | |
Running in parallel with 10 concurrent requests | |
............................................................................!........................... | |
Cached 103 URLs in 4.6162059307098 seconds | |
Encountered 1 errors |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if (!defined('DS')) { | |
define('DS', DIRECTORY_SEPARATOR); | |
} | |
return [ | |
/* Authentication */ | |
'auth' => [ | |
'enabled' => true, | |
'username' => 'admin', | |
'password' => 'changeme', | |
], | |
/* Paths to cache (recursively) */ | |
'paths' => [ | |
__DIR__ .DS. '..' .DS. '..' .DS. '..' .DS. 'config', | |
__DIR__ .DS. '..' .DS. '..' .DS. '..' .DS. 'module', | |
__DIR__ .DS. '..' .DS. '..' .DS. '..' .DS. 'vendor', | |
__DIR__ .DS. '..' .DS. '..' .DS. '..' .DS. 'public', | |
] | |
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// public/admin/apc-cache-primer.php | |
require '../../vendor/engineyard/php-performance-tools/apc-primer/apc-primer.php'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Greeting { | |
public function sayHello($to) | |
{ | |
echo "Hello $to"; | |
} | |
} | |
$greeter = new Greeting(); | |
$greeter->sayHello("World"); | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension=vld.so |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Class Greeting: | |
Function sayhello: | |
filename: ./Greeting.php | |
function name: sayHello |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
number of ops: 8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
compiled vars: !0 = $to |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
line # * op fetch ext return operands | |
------------------------------------------------------------------------ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Class Greeting: | |
Function sayhello: | |
number of ops: 8 | |
compiled vars: !0 = $to | |
line # * op fetch ext return operands | |
---------------------------------------------------------------------------- | |
3 0 > EXT_NOP | |
1 RECV !0 | |
5 2 EXT_STMT | |
3 ADD_STRING ~0 'Hello+' | |
4 ADD_VAR ~0 ~0, !0 | |
5 ECHO ~0 | |
6 6 EXT_STMT | |
7 > RETURN null |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function name: (null) | |
number of ops: 17 | |
compiled vars: !0 = $greeter | |
line # * op fetch ext return operands | |
---------------------------------------------------------------------------- | |
2 0 > EXT_STMT | |
1 NOP | |
9 2 EXT_STMT | |
3 FETCH_CLASS 4 :1 'Greeting' | |
4 EXT_FCALL_BEGIN | |
5 NEW $2 :1 | |
6 DO_FCALL_BY_NAME 0 | |
7 EXT_FCALL_END | |
8 ASSIGN !0, $2 | |
10 9 EXT_STMT | |
10 INIT_METHOD_CALL !0, 'sayHello' | |
11 EXT_FCALL_BEGIN | |
12 SEND_VAL 'World' | |
13 DO_FCALL_BY_NAME 1 | |
14 EXT_FCALL_END | |
12 15 EXT_STMT | |
16 > RETURN 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment