Hi Daniel,

I tested benchmark of mod_mruby.

test case are: 

- test case 1 mod_mruby inline code into https.conf
    mod_mruby need not fopen()

- test case 2 run mod_mruby scripts file per requests
    mod_mruby need fopen() and fclose() per requests

- test environment
OS: Linux version 2.6.18-308.16.1.el5PAE
Apache: Apache 2.4.3
MPM: prefork
mod_mruby: Current version
CPU: Intel(R) Xeon(R) CPU   X5355  @ 2.66GHz
Mem: 8GB

-- MPM settings
<IfModule mpm_prefork_module>
    StartServers             5
    MinSpareServers          5
    MaxSpareServers         10
    MaxRequestWorkers      250
    MaxConnectionsPerChild   0
</IfModule>


-- mod_mruby settings
LoadModule mruby_module       modules/mod_mruby.so
Addhandler mruby-script .mrb
<Location /mruby>
    sethandler mruby-native-script
    mrubyHandlerCode "Apache.rputs 'hello mod_mruby world'"
</Location>


-- test case 1 (not open mruby file)
$ curl http://127.0.0.1/mruby
hello mod_mruby world

$ ab -c 100 -n 100000 http://127.0.0.1/mruby
This is ApacheBench, Version 2.0.40-dev <$Revision: 1.146 $> apache-2.0
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Copyright 2006 The Apache Software Foundation, http://www.apache.org/

Benchmarking 127.0.0.1 (be patient)
Completed 10000 requests
Completed 20000 requests
Completed 30000 requests
Completed 40000 requests
Completed 50000 requests
Completed 60000 requests
Completed 70000 requests
Completed 80000 requests
Completed 90000 requests
Finished 100000 requests


Server Software:        Apache/2.4.3
Server Hostname:        127.0.0.1
Server Port:            80

Document Path:          /mruby
Document Length:        21 bytes

Concurrency Level:      100
Time taken for tests:   6.859518 seconds
Complete requests:      100000
Failed requests:        0
Write errors:           0
Total transferred:      17103420 bytes
HTML transferred:       2100420 bytes
Requests per second:    14578.28 [#/sec] (mean)
Time per request:       6.860 [ms] (mean)
Time per request:       0.069 [ms] (mean, across all concurrent requests)
Transfer rate:          2434.86 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    0   0.5      0       5
Processing:     1    6   1.0      6      10
Waiting:        0    4   1.8      5       8
Total:          1    6   1.1      6      12

Percentage of the requests served within a certain time (ms)
  50%      6
  66%      7
  75%      7
  80%      7
  90%      8
  95%      8
  98%      8
  99%      9
 100%     12 (longest request)

-- test case 2 (open mruby file)
$ curl http://127.0.0.1/hello.mrb
hello mruby world!!

$ ab -c 100 -n 100000 http://127.0.0.1/hello.mrb
This is ApacheBench, Version 2.0.40-dev <$Revision: 1.146 $> apache-2.0
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Copyright 2006 The Apache Software Foundation, http://www.apache.org/

Benchmarking 127.0.0.1 (be patient)
Completed 10000 requests
Completed 20000 requests
Completed 30000 requests
Completed 40000 requests
Completed 50000 requests
Completed 60000 requests
Completed 70000 requests
Completed 80000 requests
Completed 90000 requests
Finished 100000 requests


Server Software:        Apache/2.4.3
Server Hostname:        127.0.0.1
Server Port:            80

Document Path:          /hello.mrb
Document Length:        19 bytes

Concurrency Level:      100
Time taken for tests:   8.106790 seconds
Complete requests:      100000
Failed requests:        0
Write errors:           0
Total transferred:      16900676 bytes
HTML transferred:       1900076 bytes
Requests per second:    12335.34 [#/sec] (mean)
Time per request:       8.107 [ms] (mean)
Time per request:       0.081 [ms] (mean, across all concurrent requests)
Transfer rate:          2035.82 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    0   0.7      0       7
Processing:     1    7   5.8      7     389
Waiting:        0    5   6.0      6     388
Total:          1    7   5.9      7     391

Percentage of the requests served within a certain time (ms)
  50%      7
  66%      8
  75%      8
  80%      8
  90%      9
  95%      9
  98%     10
  99%     10
 100%    391 (longest request)


-- refs (ab to static contens like index.html)
$ curl http://127.0.0.1/index.html
<html><body><h1>It works!</h1></body></html>

$ ab -c 100 -n 100000 http://127.0.0.1/index.html
This is ApacheBench, Version 2.0.40-dev <$Revision: 1.146 $> apache-2.0
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Copyright 2006 The Apache Software Foundation, http://www.apache.org/

Benchmarking 127.0.0.1 (be patient)
Completed 10000 requests
Completed 20000 requests
Completed 30000 requests
Completed 40000 requests
Completed 50000 requests
Completed 60000 requests
Completed 70000 requests
Completed 80000 requests
Completed 90000 requests
Finished 100000 requests


Server Software:        Apache/2.4.3
Server Hostname:        127.0.0.1
Server Port:            80

Document Path:          /index.html
Document Length:        45 bytes

Concurrency Level:      100
Time taken for tests:   7.855019 seconds
Complete requests:      100000
Failed requests:        0
Write errors:           0
Total transferred:      31400000 bytes
HTML transferred:       4500000 bytes
Requests per second:    12730.71 [#/sec] (mean)
Time per request:       7.855 [ms] (mean)
Time per request:       0.079 [ms] (mean, across all concurrent requests)
Transfer rate:          3903.75 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    0   0.7      0       7
Processing:     2    6   5.2      7     307
Waiting:        0    5   5.2      5     306
Total:          2    7   5.1      7     308

Percentage of the requests served within a certain time (ms)
  50%      7
  66%      8
  75%      8
  80%      8
  90%      8
  95%      9
  98%      9
  99%     10
 100%    308 (longest request)

----
MATSUMOTO Ryosuke < matsu1229 at gmail.com >
http://blog.matsumoto-r.jp/

On 2013/01/21, at 19:29, 松本 亮介 <matsu1...@gmail.com> wrote:

> On 2013/01/21, at 19:03, Daniel Gruno <rum...@cord.dk> wrote:
> 
>> On 01/21/2013 07:32 AM, 松本 亮介 wrote:
>>> Hi Daniel.
>>> 
>>> Thank you for your comment. 
>>> 
>>>> I have tried to compile and install mod_mruby on my own machine to test
>>>> it, but there are too many compiler errors for it to work :( In
>>>> particular, you have a lot of declarations after statements in your
>>>> code, which is not C90 compliant, and needs fixing. There are also some
>>> 
>>> Did you built mruby? If you don't build murky,  you try to build by bellow 
>>> commands.
>>> 
>>> - mruby and mod_mruby build
>>> git clone git://github.com/matsumoto-r/mod_mruby.git
>>> cd mod_mruby
>>> git submodule init
>>> git submodule update
>>> cd murby
>>> rake
>>> cd ..
>>> ./configure --with-apxs=/usr/local/apache2222/bin/apxs 
>>> --with-apachectl=/usr/local/apache2222/bin/apachectl
>>> make
>>> make install
>>> 
>>> - mod_mruby settings
>>> cp -p test/test.mrb /usr/local/apache2222/htdocs/.
>>> vi /usr/local/apache2222/conf/httpd.con
>>> (snip)
>>> LoadModule mruby_module       modules/mod_mruby.so
>>> AddHandler mruby-script .mrb
>>> (snip)
>>> /usr/local/apache2222/bin/apachectl start
>>> 
>>> - mod_mruby test
>>> http://youraddress/test.mrb
>>> <snip>
>> 
>> Hi again,
>> 
>> I did manage to finally get mod_mruby running on my test server, after a
>> lot of tweaking of your source code. In general, you should always
>> compile your development modules using _maintainer mode_. This can be
>> achieved when you configure the httpd source by running ./configure
>> --enable-maintainer-mode. This should also make apxs run using
>> maintainer mode, which will alert you to anything about the code which
>> doesn't sit right with httpd and the standards we have laid out.
> 
> Thank you for your idea. I try to implement it.
> 
>> 
>> As for how the module runs, I'll include mod_mruby in my talk a bit,
>> showing how mod_lua compares to it as well as mod_php and mod_perl on
>> httpd 2.4 (yes, mod_perl can be built for 2.4 ;) ).
>> 
>> While it shows a good performance - considering Ruby is generally a slow
>> language - it does have serious performance issues once you start upping
>> the concurrency on 2.4. At only 30 concurrent clients, I am getting a
>> lot of disconnects and segmentation faults from mod_mruby, making it
>> plummet down to 150 requests per second for a simple hello world script,
>> and at 500 concurrent clients, it's as low as 50 requests per second,
>> possibly because it crashes the server, which then has to re-spawn new
>> workers all the time. I've uploaded a log of GDB at
>> http://apaste.info/dsFz which you can possibly use to figure out why
>> it's behaving like it does. There also seems to be a lot of other
>> exceptions raised when just calling it with 1 client (mrb_exc_raise).
> 
> Sorry about that. Your apache mpm is worker, but now mod_mruby work properly
> on prefork mpm. In my future plans, mod_mruby will support thread model like 
> event or worker mpm. I'm studying thread models to support event_mpm. 
> Thank you for GDB log and I refer to it.
> 
> I have checked mod_mruby which work stable on Apache 2.4.2 preform mpm.
> 
>> 
>> I hope you figure these things out, as mod_mruby is a welcome addition
>> to the http server :). If you can get it to run stable on 2.4/2.5 before
>> ApacheCon, I'd love to try it out again and get some proper performance
>> tests going.
>> 
>> With regards,
>> Daniel.
> 
> I'ts awesome! 
> 
> With regards,
> Ryosuke.
> 
> 
> ----
> MATSUMOTO Ryosuke < matsu1229 at gmail.com >
> http://blog.matsumoto-r.jp/
> 

Reply via email to