On Thu, Dec 4, 2008 at 1:10 PM, Lionel Bouton <
[EMAIL PROTECTED]> wrote:

>
> Mahmoud Said a écrit, le 12/04/2008 10:44 AM :
> > [...]
> > that's was a bit expected due to the fact that thin uses EventMachine
> > instead of spawning threads for handling requests like mongrel... the
> > more concurrency level u have.. the more context switching between
> > threads...
>
> Ruby threads are green threads : there's no context switching. And IIRC
> they are built around select internally so they basically use the same
> underlying system code EventMachine uses.
>

I'm not sure about how ruby green threads or implemented. but I guessed they
have some scheduling mechanism (within the user space) that is different
from the EventMachine approach. Thus scheduling and switching overhead.
Maybe I'm wrong... and there is some other reason that makes thins quite
faster for small requests.

I tried comparing them again for a very small request that does  nothing but

*render :text=>'1234567890'*

thin is 79% faster than mongrel

*Mongrel*

Server Software:        Mongrel
Server Hostname:        localhost
Server Port:            3001

Document Path:          /
Document Length:        10 bytes

Concurrency Level:      500
Time taken for tests:   60.121 seconds
Complete requests:      1000
Failed requests:        0
Write errors:           0
Total transferred:      468000 bytes
HTML transferred:       10000 bytes
Requests per second:    16.63 [#/sec] (mean)
Time per request:       30060.399 [ms] (mean)
Time per request:       60.121 [ms] (mean, across all concurrent requests)
Transfer rate:          7.60 [Kbytes/sec] received


Thin

Server Software:        thin
Server Hostname:        localhost
Server Port:            3000

Document Path:          /
Document Length:        10 bytes

Concurrency Level:      500
Time taken for tests:   33.922 seconds
Complete requests:      1000
Failed requests:        0
Write errors:           0
Total transferred:      444652 bytes
HTML transferred:       10060 bytes
Requests per second:    29.48 [#/sec] (mean)
Time per request:       16961.071 [ms] (mean)
Time per request:       33.922 [ms] (mean, across all concurrent requests)
Transfer rate:          12.80 [Kbytes/sec] received


For larger requests (requests that needs db queries and a lot of processing)
they're nearly the same







>
> Lionel
>
>


-- 
Mahmoud Said
Software Developer
blog.modsaid.com
www.eSpace.com.eg

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to