I run into a case where I had User.search method and I wanted the GroupMember model be searchable by the user’s attributes. The most DRY way to accomplish this in Rails 3 is to merge scopes. In the User model:
Later I tried to test UWSGI server too as it now boasts built-in RACK module, but dropped it for two reasons: (1) it required tweaking OS to raise kern.ipc.somaxconn above 128 (which none other server needed) and later Nginx’s worker_connections above 1024 too and (2) it still lagged far behind at ~ 130 req/s, so after successful concurrency of 1000 requests, I got tired of waiting for the tests to complete and gave up seeking it’s break point. Still, UWSGI is very interesting project that I will keep my eye on, mostly because of it’s Emperor and Zerg modes and ease of deployment for dynamic mass-hosting Rack apps.
As UWSGI was originally developed for Python, I wasted a bit of time trying to get it working with some simple Python framework for comparison, but probably lack of knowledge on my part was the failure of it.
To set up a basic testcase, I wrote a simple Rack app that responds every request with the request IP address. I dediced to output IP because this involves some Ruby code in the app, but should be rather simple still.
Tweaking the concurrency number N (see below) with resolution of 100, I found out the break point of each of the servers (when they started giving errors) and recorded the previous throughput (the one that didn’t give any errors).
The results are as follows:
Unicorn – 2451 req/s @ 1500 concurrent request
Thin – 2102 req/s @ 900 concurrent requests
Passenger – 1549 req/s @ 400 concurrent requests
The following are screenshots from JMeter results:
None of these throughputs are bad, but still Unicorn and Thin beat the crap out of Passenger.
The JMeter testcase
ramp up to N requests concurrently
send request to the server
assert that response contains IP address
loop all of this 10 times
As is only logical, having processes match the number of cores (dual HT = 4 cores) gave best results for both Thin and Unicorn (thouch the variations were small).
Passenger requires no additional configuration and Thin was configured from command line to use 4 servers and Unix sockets, but Unicorn required a separate file (I modified Unicorn example config for my purpose):
I admit that this is extremely basic test and with better configuration much can be squeezed out from all of these servers, but this simple test surved my purpose and hopefully is of help to others too.
For those who have a unix mailserver with procmail-based vacation scripts AND users who do not feel comfortable editing .procmailrc AND you do not use any webmail software (that comes with a vacation plugin) this might solve your problem.
This is Ruby on Rails app that uses SFTP to set up/edit/remove vacation messages to/from mailserver and is backed by (My)SQL database where users are authenticated from. Auth is done by RESTful authentication and the database should be compliant.
This app is localized to English and Estonian, but translation is easy and (extremely) short, so new languages can be added easily.