[lang_en]Looking For Optimal Solution: Ruby On Rails and Mongrel[/lang_en][lang_ru]В поисках оптимального решения: Ruby On Rails и Mongrel[/lang_ru]
30 Aug2006

[lang_en]

This article is part of “Looking For Optimal Solution” series, devoted to testing various Ruby On Rails deployment schemes and doing some simple benchmarks on these schemes. General idea of testing is to find subset of most optimal RoR deployment schemes for different situations.

This small article is about Rails+Mongrel setup and its performance. List of other tested deployment schemes, description of testing methodology and, of course, all benchmark results you can find on “Ruby On Rails Benchmark Summary and Findings” page.

[/lang_en]

[lang_ru]

Эта статья является частью серии “В поисках оптимального решения“, посвященной тестированию производительности различных схем развертывания приложений на Ruby On Rails. Основной идеей тестирования является поиск подмножества самых оптимальных с точки зрения производительности решений по установке RoR-приложений в различных ситуациях.

Эта небольшая статья посвящена установке связки Rails+Mongrel и ее производительности. Список всех протестированных схем развертывания, описание методики тестирования и результаты всех тестов вы можете найти на странице “Результатов и Выводов“.

[/lang_ru]

[lang_en]

First of all, let me give you some information about what is Mongrel:

Mongrel is a fast HTTP library and server for Ruby that is intended for hosting Ruby web applications of any kind using plain HTTP rather than FastCGI or SCGI. It is framework agnostic and already supports Ruby On Rails, Og+Nitro, and Camping frameworks.

The easiest way to get started with Mongrel is to install it via RubyGems and then run a Ruby on Rails application. You can do this easily (commands are for *nix-based systems):

  $ sudo gem install mongrel
  $ cd your_rails_app
  $ mongrel_rails start -d

Which runs Mongrel in the background. You can stop it with:

  $ mongrel_rails stop

And you’re all set. There’s quite a few options you can set for the start command. Use the mongrel_rails start -h to see them all.

My Mongrel test was performed for single mongrel process started with simple:

  $ mongrel_rails start -d -e production --port 8080

Test results are following:

  • Web Server: Mongrel 0.3.13.3 (single process)
  • Time taken for tests: 124,53 sec
  • Time per request (mean): 1245,34 ms
  • Time per request (mean, across all concurrent requests): 12,45 ms
  • Requests per second (mean): 80,30
  • Transfer rate (Kbytes/sec): 26,81
  • Performance Growth Comparing To WEBrick(%): 37,43

List of other tested deployment schemes, description of testing methodology and, of course, all benchmark results you can find on “Ruby On Rails Benchmark Summary and Findings” page.

[/lang_en]

[lang_ru]

Для начала я хотел бы рассказать, что такое Mongrel:

Mongrel – это быстрая HTTP-библиотека и веб-сервер для Ruby, предназначенные для хостинга веб-приложений на Ruby используя HTTP вместо FastCGI или SCGI. На данный момент он поддерживает фреймворки Ruby On Rails, Og+Nitro и Camping.

Самый простой метод начать использование Mongrel – это установить его с помощью RubyGems и затем запускать с его помощью приложения Ruby on Rails. Вы можете сделать это просто (команды для *nix-based систем):

  $ sudo gem install mongrel
  $ cd your_rails_app
  $ mongrel_rails start -d

Этот набор команд запустит Mongrel в фоне. Вы можете остановить его:

  $ mongrel_rails stop

Вот и все, что необходимо. Есть еще несколько опций, которые могут быть установлены у команды start. Используйте mongrel_rails start -h для просмотра возможных опций и их описания.

Мои тесты с Mongrel были произведены на одном процессе, запущенном следующим образом:

  $ mongrel_rails start -d -e production --port 8080

Результаты оказались следующими:

  • Web Server: Mongrel 0.3.13.3 (single process)
  • Время, затраченное на тесты: 124,53 sec
  • Средняя продолжительность запроса: 1245,34 ms
  • Время, затраченное на запрос (среднее по всем параллельным запросам): 12,45 ms
  • Количество запросов в секунду (среднее): 80,30
  • Transfer rate (Kbytes/sec): 26,81
  • Прирост производительности по сравнению с WEBrick (%): 37,43

Список всех протестированных схем развертывания, описание методики тестирования и результаты всех тестов вы можете найти на странице “Результатов и Выводов

[/lang_ru]