Browse Source

add new benchmark_config files

gjerokrsteski 11 years ago
parent
commit
d386faf885

+ 2 - 2
php-pimf/README.md

@@ -38,7 +38,7 @@ http://localhost/db
 
 ### Variable Query Test
     
-http://localhost/db?queries=2
+http://localhost/queries?queries=10
 
 ### Templating Test
 
@@ -46,7 +46,7 @@ http://localhost/fortunes
 
 ### Database Updates Test
 
-http://localhost/updates
+http://localhost/updates?queries=10
 
 ### Plaintext Test
 

+ 10 - 14
php-pimf/app/Vanilla/Controller/Hello.php

@@ -1,7 +1,7 @@
 <?php
 namespace Vanilla\Controller;
 
-use Pimf\Controller\Base, Pimf\View, Pimf\Registry;
+use Pimf\Controller\Base, Pimf\View, Pimf\Registry, Pimf\Param;
 
 class Hello extends Base
 {
@@ -42,7 +42,7 @@ class Hello extends Base
    */
   public function dbAction()
   {
-    $worlds = Registry::get('em')->world->find(1);
+    $worlds = Registry::get('em')->world->find(mt_rand(1, 10000));
 
     $this->response->asJSON()->send($worlds);
   }
@@ -52,19 +52,16 @@ class Hello extends Base
    */
   public function fortunesAction()
   {
-    $templates = array();
     $fortunes = Registry::get('em')->fortune->getAll();
-    $fortunes[] = 'Additional fortune added at request time.';
 
-    asort($fortunes);
+    $fortunes[] = array(
+      'id' => count($fortunes) + 1,
+      'message' => 'Additional fortune added at request time.'
+    );
 
-    foreach ($fortunes as $i => $fortune) {
-        $templates[$i] = '<tr><td>'.$i.'</td><td>'.$fortune.'</td></tr>';
-    }
+    $view = new View('table.phtml', array('fortunes' => $fortunes));
 
-    $this->response->asHTML()->send(
-      '<!DOCTYPE html><html><head><title>Fortunes</title></head><body><table><tr><th>id</th><th>message</th></tr>'.implode('', $templates).'</table></body></html>'
-    );
+    $this->response->asHTML()->send($view);
   }
 
   /**
@@ -85,15 +82,14 @@ class Hello extends Base
       $worlds[] = $em->world->find(mt_rand(1, 10000));
     }
 
-    foreach ($worlds as $i => $row) {
-      $row[$i]['randomNumber'] = rand(1, 10000);
+    foreach ($worlds as $row) {
+      $row['randomNumber'] = rand(1, 10000);
       $em->world->update($row);
     }
 
     $em->commitTransaction();
 
     $this->response->asJSON()->send($worlds);
-
   }
 
   /**

+ 1 - 1
php-pimf/app/Vanilla/DataMapper/Fortune.php

@@ -13,7 +13,7 @@ class Fortune extends Base
     $sth = $this->pdo->prepare('SELECT * FROM Fortune');
     $sth->execute();
 
-    return $sth->fetchAll();
+    return $sth->fetchAll(\PDO::FETCH_ASSOC);
   }
 }
  

+ 1 - 1
php-pimf/app/Vanilla/DataMapper/World.php

@@ -17,7 +17,7 @@ class World extends Base
     $sth->bindValue(':id', $id, \PDO::PARAM_INT);
     $sth->execute();
 
-    return (array) $sth->fetch();
+    return (array) $sth->fetch(\PDO::FETCH_ASSOC);
   }
 
   /**

+ 7 - 7
php-pimf/app/Vanilla/routes.php

@@ -1,10 +1,10 @@
 <?php
 return array(
-  new \Pimf\Route('/', array('controller' =>'hello', 'action' => 'index')),
-  new \Pimf\Route('/json', array('controller' =>'hello', 'action' => 'json')),
-  new \Pimf\Route('/queries', array('controller' =>'hello', 'action' => 'queries')),
-  new \Pimf\Route('/db', array('controller' =>'hello', 'action' => 'db')),
-  new \Pimf\Route('/fortunes', array('controller' =>'hello', 'action' => 'fortunes')),
-  new \Pimf\Route('/updates', array('controller' =>'hello', 'action' => 'updates')),
-  new \Pimf\Route('/plaintext', array('controller' =>'hello', 'action' => 'plaintext')),
+  new \Pimf\Route('/', array('controller' => 'hello', 'action' => 'index')),
+  new \Pimf\Route('/json', array('controller' => 'hello', 'action' => 'json')),
+  new \Pimf\Route('/queries', array('controller' => 'hello', 'action' => 'queries')),
+  new \Pimf\Route('/db', array('controller' => 'hello', 'action' => 'db')),
+  new \Pimf\Route('/fortunes', array('controller' => 'hello', 'action' => 'fortunes')),
+  new \Pimf\Route('/updates', array('controller' => 'hello', 'action' => 'updates')),
+  new \Pimf\Route('/plaintext', array('controller' => 'hello', 'action' => 'plaintext')),
 );

+ 57 - 57
php-pimf/app/config.app.php

@@ -24,29 +24,29 @@ return array(
   | The default character encoding used by your application.
   |------------------------------------------------------------------------
   */
-  'encoding' => 'UTF-8',
-  
+  'encoding'    => 'UTF-8',
+
   /*
   |------------------------------------------------------------------------
   | The default timezone of your application.
   | Supported timezones list: http://www.php.net/manual/en/timezones.php
   |------------------------------------------------------------------------
   */
-  'timezone' => 'UTC',
+  'timezone'    => 'UTC',
 
   /*
   |--------------------------------------------------------------------------
   | Is it regular HTTP or secure HTTPS
   |--------------------------------------------------------------------------
   */
-  'ssl' => false,
-  
+  'ssl'         => false,
+
   /*
   |------------------------------------------------------------------------
   | Application meta
   |------------------------------------------------------------------------
   */
-  'app' => array(
+  'app'         => array(
     'name'               => 'Vanilla',
     'key'                => 'some5secret5key5here', // application key
     'default_controller' => 'hello', // the name of the fallback controller
@@ -61,15 +61,15 @@ return array(
   | Production environment settings
   |------------------------------------------------------------------------
   */
-  'production' => array(
+  'production'  => array(
     'db' => array(
-      'driver' => 'mysql',
-      'host' => '192.168.100.102',
+      'driver'   => 'mysql',
+      'host'     => '127.0.0.1',
       'database' => 'hello_world',
       'username' => 'benchmarkdbuser',
       'password' => 'benchmarkdbpass',
-      'charset' => 'utf8',
-      'port' => '3306',
+      'charset'  => 'utf8',
+      'port'     => '3306',
       // 'unix_socket' => '',
     ),
   ),
@@ -79,7 +79,7 @@ return array(
   | Bootstrapping and dependencies to php-version and extensions
   |------------------------------------------------------------------------
   */
-  'bootstrap' => array(
+  'bootstrap'   => array(
     'local_temp_directory' => '/tmp/'
   ),
 
@@ -88,10 +88,10 @@ return array(
   | Settings for the error handling behavior
   |------------------------------------------------------------------------
   */
-  'error' => array(
+  'error'       => array(
     'ignore_levels' => array(E_USER_DEPRECATED),
-    'debug_info' => false, // true = if developing - false = if production
-    'log' => true,
+    'debug_info'    => false, // true = if developing - false = if production
+    'log'           => true,
   ),
 
   /*
@@ -99,41 +99,41 @@ return array(
   | Session settings
   |--------------------------------------------------------------------------
   */
-  'session' => array(
+  'session'     => array(
 
-      // Session storage 'cookie', 'file', 'pdo', 'memcached', 'apc', 'redis', 'dba', 'wincache', 'memory'
-      'storage' => null,
+    // Session storage 'cookie', 'file', 'pdo', 'memcached', 'apc', 'redis', 'dba', 'wincache', 'memory'
+    'storage'            => '',
 
-      // If using file storage - default is null
-      'storage_path' => 'app/Vanilla/_session/',
+    // If using file storage - default is null
+    'storage_path'       => 'app/Vanilla/_session/',
 
-      // If using the PDO (database) session storage
-      'database' => array(
-        //'driver' => 'sqlite',
-        //'database' => 'app/Vanilla/_session/session.db',
-      ),
+    // If using the PDO (database) session storage
+    'database'           => array(
+      //'driver' => 'sqlite',
+      //'database' => 'app/Vanilla/_session/session.db',
+    ),
 
-      // Garbage collection has a 2% chance of occurring for any given request to
-      // the application. Feel free to tune this to your requirements.
-      'garbage_collection' => array(2, 100),
+    // Garbage collection has a 2% chance of occurring for any given request to
+    // the application. Feel free to tune this to your requirements.
+    'garbage_collection' => array(2, 100),
 
-      // Session lifetime number of minutes
-      'lifetime' => 60,
+    // Session lifetime number of minutes
+    'lifetime'           => 60,
 
-      // Session expiration on web browser close
-      'expire_on_close' => false,
+    // Session expiration on web browser close
+    'expire_on_close'    => false,
 
-      // Session cookie name
-      'cookie' => 'pimf_session',
+    // Session cookie name
+    'cookie'             => 'pimf_session',
 
-      // Session cookie path
-      'path' => '/',
+    // Session cookie path
+    'path'               => '/',
 
-      // Domain for which the session cookie is available.
-      'domain' => null,
+    // Domain for which the session cookie is available.
+    'domain'             => null,
 
-      // If the cookie should only be sent over HTTPS.
-      'secure' => false,
+    // If the cookie should only be sent over HTTPS.
+    'secure'             => false,
   ),
 
   /*
@@ -141,27 +141,27 @@ return array(
   | Cache settings
   |--------------------------------------------------------------------------
   */
-  'cache' => array(
+  'cache'       => array(
 
-      // Cache storage 'pdo', 'file', 'memcached', 'apc', 'redis', 'dba', 'wincache', 'memory'
-      'storage' => null,
+    // Cache storage 'pdo', 'file', 'memcached', 'apc', 'redis', 'dba', 'wincache', 'memory'
+    'storage'      => '',
 
-      // If using file storage - default is null
-      'storage_path' => 'app/Vanilla/_cache/',
+    // If using file storage - default is null
+    'storage_path' => 'app/Vanilla/_cache/',
 
-      // If using the PDO (database) cache storage
-      'database' => array(
-        //'driver' => 'sqlite',
-        //'database' => 'app/Vanilla/_cache/cache.db',
-      ),
+    // If using the PDO (database) cache storage
+    'database'     => array(
+      //'driver' => 'sqlite',
+      //'database' => 'app/Vanilla/_cache/cache.db',
+    ),
 
-      // If using Memcached and APC to prevent collisions with other applications on the server.
-      'key' => 'pimfmaster',
+    // If using Memcached and APC to prevent collisions with other applications on the server.
+    'key'          => 'pimfmaster',
 
-      // Memcached servers - for more check out: http://memcached.org
-      'memcached' => array(
-        'servers' => array('host' => '127.0.0.1', 'port' => 11211, 'weight' => 100),
-      ),
-   ),
+    // Memcached servers - for more check out: http://memcached.org
+    'memcached'    => array(
+      'servers' => array('host' => '127.0.0.1', 'port' => 11211, 'weight' => 100),
+    ),
+  ),
 
 );

+ 5 - 5
php-pimf/benchmark_config

@@ -4,14 +4,14 @@
     "default": {
       "setup_file": "setup",
       "db_url": "/db",
-      "query_url": "/db?queries=",
+      "query_url": "/queries?queries=",
       "port": 8080,
       "approach": "Realistic",
-      "classification": "Micro",
+      "classification": "Platform",
       "database": "MySQL",
       "framework": "pimf",
       "language": "PHP",
-      "orm": "Raw",
+      "orm": "Micro",
       "platform": "PHP-FPM",
       "webserver": "nginx",
       "os": "Linux",
@@ -30,11 +30,11 @@
       "plaintext_url": "/plaintext",
       "port": 8080,
       "approach": "Realistic",
-      "classification": "Micro",
+      "classification": "Platform",
       "database": "MySQL",
       "framework": "pimf",
       "language": "PHP",
-      "orm": "Raw",
+      "orm": "Micro",
       "platform": "PHP-FPM",
       "webserver": "nginx",
       "os": "Linux",

+ 1 - 1
php-pimf/pimf-framework/core/Pimf/Util/Header.php

@@ -59,7 +59,7 @@ class Header extends Header\ContentType
 
     $conf    = Registry::get('conf');
     $appTpl  = str_replace('/', DS, BASE_PATH . 'app/' . $conf['app']['name'] . '/_error/' . $code . '.php');
-    $coreTpl = str_replace('/', DS, BASE_PATH . 'core/Pimf/_error/' . $code . '.php');
+    $coreTpl = str_replace('/', DS, BASE_PATH . 'pimf-framework/core/Pimf/_error/' . $code . '.php');
 
     if (file_exists($appTpl) && is_readable($appTpl)) {
       include $appTpl;

+ 1 - 1
php-pimf/setup.py

@@ -6,7 +6,7 @@ from os.path import expanduser
 home = expanduser("~")
 
 def start(args):
-  setup_util.replace_text("php-pimf/app/config.app.php", "192.168.100.102", "" + args.database_host + "")
+  setup_util.replace_text("php-pimf/app/config.app.php", "127.0.0.1", "" + args.database_host + "")
   setup_util.replace_text("php-pimf/deploy/php-pimf", "\".*\/FrameworkBenchmarks", "\"" + home + "/FrameworkBenchmarks")
   setup_util.replace_text("php-pimf/deploy/php-pimf", "Directory .*\/FrameworkBenchmarks", "Directory " + home + "/FrameworkBenchmarks")
   setup_util.replace_text("php-pimf/deploy/nginx.conf", "root .*\/FrameworkBenchmarks", "root " + home + "/FrameworkBenchmarks")

+ 1 - 1
php-pimf/setup_raw.py

@@ -6,7 +6,7 @@ from os.path import expanduser
 home = expanduser("~")
 
 def start(args):
-  setup_util.replace_text("php-pimf/app/config.app.php", "192.168.100.102", "" + args.database_host + "")
+  setup_util.replace_text("php-pimf/app/config.app.php", "127.0.0.1", "" + args.database_host + "")
   setup_util.replace_text("php-pimf/deploy/php-pimf", "\".*\/FrameworkBenchmarks", "\"" + home + "/FrameworkBenchmarks")
   setup_util.replace_text("php-pimf/deploy/php-pimf", "Directory .*\/FrameworkBenchmarks", "Directory " + home + "/FrameworkBenchmarks")
   setup_util.replace_text("php-pimf/deploy/nginx_raw.conf", "root .*\/FrameworkBenchmarks", "root " + home + "/FrameworkBenchmarks")