5
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

SilexとScalatraのHelloWorld比較

Last updated at Posted at 2013-11-20

PHP: Silex

<?php

require_once __DIR__.'/vendor/autoload.php'; 

$app = new Silex\Application(); 

$app->get('/hello/{name}', function($name) use($app) { 
    return '<div>Hello ' . $app->escape($name) . '</div>'; 
}); 

$app->run(); 

Scala: Scalatra

package com.example.app

import org.scalatra._
import scalate.ScalateSupport

class MyScalatraServlet extends MyScalatraWebAppStack {
  get("/hello/:name")(<div>Hello { params("name") }</div>)
}

Silex abの結果

-n 1000 -c 100

Server Software:        Apache/2.2.24
Server Hostname:        localhost
Server Port:            80

Document Path:          /test.php/hello/suin
Document Length:        10 bytes

Concurrency Level:      100
Time taken for tests:   5.833 seconds
Complete requests:      1000
Failed requests:        0
Write errors:           0
Total transferred:      305700 bytes
HTML transferred:       10190 bytes
Requests per second:    171.43 [#/sec] (mean)
Time per request:       583.319 [ms] (mean)
Time per request:       5.833 [ms] (mean, across all concurrent requests)
Transfer rate:          51.18 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        3  510 155.1    558     844
Processing:     0   44 118.2      3     670
Waiting:        0   26 117.0      0     669
Total:         69  554 109.0    573     847

Scalatra abの結果

-n 1000 -c 100

Server Software:        Jetty(8.1.8.v20121106)
Server Hostname:        localhost
Server Port:            8888

Document Path:          /test/test
Document Length:        22 bytes

Concurrency Level:      100
Time taken for tests:   1.372 seconds
Complete requests:      1000
Failed requests:        0
Write errors:           0
Total transferred:      132000 bytes
HTML transferred:       22000 bytes
Requests per second:    728.82 [#/sec] (mean)
Time per request:       137.208 [ms] (mean)
Time per request:       1.372 [ms] (mean, across all concurrent requests)
Transfer rate:          93.95 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    1   1.0      0       9
Processing:     5  130  29.8    127     234
Waiting:        3  128  29.8    125     213
Total:          9  130  29.3    127     235
5
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?