# \[ANN\] AjpRails; Rails runner using AJP13

**URL:** <https://www.ruby-forum.com/t/ann-ajprails-rails-runner-using-ajp13/100229>\
**Category:** Rails\
**Created:** [February 2, 2006, 6:53am UTC](https://www.ruby-forum.com/t/ann-ajprails-rails-runner-using-ajp13/100229 "2006-02-02T06:53:56Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Yugui](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/y/ac91a4/32.png) [@Yugui](https://www.ruby-forum.com/u/Yugui)\
**Post date:** [February 2, 2006, 6:53am UTC](https://www.ruby-forum.com/t/ann-ajprails-rails-runner-using-ajp13/100229/1 "2006-02-02T06:53:56Z")

</div>

Hello, all.

I released AjpRails 0.1.0. AjpRails is a script for running Ruby on  
Rails. Rails this script runs uses AJP13(Apache JServ Protocol 1.3)  
instead of CGI or FastCGI, to cooperate with your HTTPd.

Its RubyForge project is:  
[http://rubyforge.org/projects/ruby-ajp/](http://rubyforge.org/projects/ruby-ajp/)  
Project home page is:  
[http://ruby-ajp.rubyforge.org/wiki/wiki.pl](http://ruby-ajp.rubyforge.org/wiki/wiki.pl)

Now, AjpRails is slower and much more unstable than dispatcher.fcgi or  
SCGI Rails Runner. But these weak points will be improved gradually.

Thanks.

–  
Yugui  
removed\_email\_address@domain.invalid

> **[IDM --I divide me](http://idm.s9.xrea.com)**
>
> àlTCgÁĂà́B«¯ꐫáQ¾Ƃ©ALXg³¾Ƃ©Aw¾Ƃ©A₨¢¬à¾Ƃ©AǗlɂƂÁĐg߂Ȃà̂ðW߂Ă݂܂µ½B

---

<div class="post-metadata">

**Author:** ![Yugui](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/y/ac91a4/32.png) [@Yugui](https://www.ruby-forum.com/u/Yugui)\
**Post date:** [February 2, 2006, 4:42pm UTC](https://www.ruby-forum.com/t/ann-ajprails-rails-runner-using-ajp13/100229/2 "2006-02-02T16:42:40Z")

</div>

Very interesting! So, would the idea be that one could use mod\_jk (or  
similar) to talk to a ruby process through a socket?

What’s the motivation for this project?

---

<div class="post-metadata">

**Author:** ![Yugui](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/y/ac91a4/32.png) [@Yugui](https://www.ruby-forum.com/u/Yugui)\
**Post date:** [February 2, 2006, 5:19pm UTC](https://www.ruby-forum.com/t/ann-ajprails-rails-runner-using-ajp13/100229/3 "2006-02-02T17:19:02Z")

</div>

i am curious about this as well. Does this work with mod\_jk ? Any  
performance numbers on this way vs FCGI ?

---

<div class="post-metadata">

**Author:** ![Yugui](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/y/ac91a4/32.png) [@Yugui](https://www.ruby-forum.com/u/Yugui)\
**Post date:** [February 4, 2006, 4:00pm UTC](https://www.ruby-forum.com/t/ann-ajprails-rails-runner-using-ajp13/100229/4 "2006-02-04T16:00:29Z")

</div>

2006/2/3, Jim N. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

> Very interesting! So, would the idea be that one could use mod\_jk (or  
> similar) to talk to a ruby process through a socket?

Yes, you can use mod\_jk on the HTTPd-side.

- The load balancing of mod\_jk is attractive.
- mod\_jk is familiar to Java programmers and even their pointy-haired  
bosses.  
So I think it is worth trying to implement AJP13 in Ruby.

I started implementing it just for fun. But now, I think Ruby’s AJP  
implementation can save some programmers from the pointy-haired.

---

<div class="post-metadata">

**Author:** ![Yugui](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/y/ac91a4/32.png) [@Yugui](https://www.ruby-forum.com/u/Yugui)\
**Post date:** [February 4, 2006, 4:33pm UTC](https://www.ruby-forum.com/t/ann-ajprails-rails-runner-using-ajp13/100229/5 "2006-02-04T16:33:59Z")

</div>

2006/2/3, Adam D. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

> i am curious about this as well. Does this work with mod\_jk ? Any  
> performance numbers on this way vs FCGI ?

I tested performance numbers using the depot application of “Agile Web  
Development with Rails” (“/store/index”).

== net/http ver.  
The following is the results of my casual tests using net/http.

=== AJP13:  
user system total real  
1 thread \* 1000 reqs: 0.870000 0.240000 1.110000 ( 52.369711)  
10 threads \* 100 reqs: 0.000000 0.010000 0.010000 ( 0.006555)  
100 threads \* 10 reqs: 0.040000 0.010000 0.050000 ( 0.134293)  
1000 threads \* 1 req: 1.670000 0.150000 1.820000 ( 6.378787)

=== FCGI(mod\_fcgid)  
user system total real  
1 thread \* 1000 reqs: 1.240000 0.170000 1.410000 ( 12.498863)  
10 threads \* 100 reqs: 0.000000 0.000000 0.000000 ( 0.005302)  
100 threads \* 10 reqs: 0.090000 0.020000 0.110000 ( 0.221380)  
1000 threads \* 1 req: 2.080000 0.170000 2.250000 ( 4.680722)

== Apache bench  
The following is by apache bench.

=== AJP13  
Concurrency Level: 100  
Time taken for tests: 130.928882 seconds  
Complete requests: 10000  
Failed requests: 0  
Write errors: 0  
Total transferred: 34950000 bytes  
HTML transferred: 31890000 bytes  
Requests per second: 76.38 [#/sec] (mean)  
Time per request: 1309.289 [ms] (mean)  
Time per request: 13.093 [ms] (mean, across all concurrent  
requests)  
Transfer rate: 260.68 [Kbytes/sec] received

Connection Times (ms)  
min mean[+/-sd] median max  
Connect: 0 0 0.4 0 5  
Processing: 278 1301 77.7 1297 1887  
Waiting: 277 1301 77.7 1297 1887  
Total: 283 1301 77.5 1297 1891

Percentage of the requests served within a certain time (ms)  
50% 1297  
66% 1319  
75% 1335  
80% 1345  
90% 1377  
95% 1410  
98% 1476  
99% 1516  
100% 1891 (longest request)

=== FCGI  
Concurrency Level: 100  
Time taken for tests: 29.289262 seconds  
Complete requests: 10000  
Failed requests: 1731  
(Connect: 0, Length: 1731, Exceptions: 0)  
Write errors: 0  
Non-2xx responses: 8303  
Total transferred: 11793228 bytes  
HTML transferred: 9194509 bytes  
Requests per second: 341.42 [#/sec] (mean)  
Time per request: 292.893 [ms] (mean)  
Time per request: 2.929 [ms] (mean, across all concurrent  
requests)  
Transfer rate: 393.18 [Kbytes/sec] received

Connection Times (ms)  
min mean[+/-sd] median max  
Connect: 0 0 0.9 0 6  
Processing: 46 291 607.2 192 13346  
Waiting: 45 283 555.3 192 9417  
Total: 47 291 607.4 192 13346

Percentage of the requests served within a certain time (ms)  
50% 192  
66% 215  
75% 231  
80% 239  
90% 277  
95% 807  
98% 1993  
99% 4199  
100% 13346 (longest request)

Hmm…, there is too many non-2xx response, is there?

–  
Yugui  
removed\_email\_address@domain.invalid

> **[IDM --I divide me](http://idm.s9.xrea.com)**
>
> àlTCgÁĂà́B«¯ꐫáQ¾Ƃ©ALXg³¾Ƃ©Aw¾Ƃ©A₨¢¬à¾Ƃ©AǗlɂƂÁĐg߂Ȃà̂ðW߂Ă݂܂µ½B
