Forum: JRuby Jruby on Rails unicorn, nginx, cassandra

Posted by Jake Late (lelouch)
on 2012-07-19 00:49
Hello everybody i'm Lelouch and i'm fairly new to jruby. I started to
use ruby on rails but then I discovered jruby and decided to learn it.

I'm a mac os x user.

So these four last days I tried to set up my environment : a jruby on
rails application using unicorn, nginx and cassandra.

So far, I succeeded to create a jruby on rails application using default
setup (webrick).

My question is : is it possible to use cassandra nginx and unicorn with
jruby on rails ? if so could you give me some help ? I crawled the web
but nothing worked up till now...

I had some trouble with unicorn as it appears it's not fully supported
by jruby... Nginx is an issue too because i didn't find any tutorial on
mac os x.

If someone as some time to help.

Thanks.

Lelouch
Posted by Hassan Schroeder (Guest)
on 2012-07-19 01:44
(Received via mailing list)
On Wed, Jul 18, 2012 at 3:49 PM, Jake Late <lists@ruby-forum.com> wrote:

> So these four last days I tried to set up my environment : a jruby on
> rails application using unicorn, nginx and cassandra.
>
> So far, I succeeded to create a jruby on rails application using default
> setup (webrick).
>
> My question is : is it possible to use cassandra nginx and unicorn with
> jruby on rails ?

> I had some trouble with unicorn as it appears it's not fully supported
> by jruby... Nginx is an issue too because i didn't find any tutorial on
> mac os x.

I doubt you can run Unicorn under jruby, though I don't have time to
try it right now. Use the Trinidad (embedded Tomcat) gem instead.
(I do use Unicorn for my MRI/REE apps.)

Cassandra - I played briefly with this after attending a Netflix meetup
a couple months ago, but my impression was that the state of gems
for using it with Ruby in general was a bit of a mess.  That might have
changed, so let us know how it goes :-)

Nginx - what do you need to know? It installed fine on my Mac (10.7.4)
and as far as I can tell there aren't any OS-specific issues. What are
you having trouble with?

--
Hassan Schroeder ------------------------ hassan.schroeder@gmail.com
http://about.me/hassanschroeder
twitter: @hassan
Posted by Joe Kutner (Guest)
on 2012-07-19 02:03
(Received via mailing list)
I have heard of people getting Unicorn working with JRuby, but the 
bottom line is that you simply don't need it.  Unicorn (and Passenger) 
solve a problem that JRuby does not have: a lack of concurrency.

The job of Unicorn is to manage a bunch of processes, because that's the 
only way to parallelize request processing on MRI.  JRuby is 
multithreaded, so you can parallelize with a  single process.  For this 
reason, a new set of web servers has emerged.  The leaders are:
TorqueBox
Trinidad
Mizuno
Puma

All of these should work with Nginx (although TorqueBox and Trinidad 
have some really nice "plugins" that make them work better with Apache).

<Warning: shameless self promotion>
I wrote a book on this subject.  You might find useful.
http://pragprog.com/book/jkdepj/deploying-with-jruby

However, it is directed to folks who are already using Ruby and/or 
Rails, so I'm not sure exactly how well it will suit you.

-Joe
Posted by Lenny Marks (Guest)
on 2012-07-19 18:54
(Received via mailing list)
On Jul 18, 2012, at 8:02 PM, Joe Kutner wrote:

> I have heard of people getting Unicorn working with JRuby, but the bottom line 
is that you simply don't need it.  Unicorn (and Passenger) solve a problem that 
JRuby does not have: a lack of concurrency.

Another thing is zero-downtime redeploys. We deploy our Rails apps into 
Tomcat but we use a load balancer in front of multiple Tomcat servers, 
instead of attempting live hot deploys because we've found it 
burdensome/risky to prevent hot-deploy related memory leaks.

http://wiki.apache.org/tomcat/MemoryLeakProtection

Basically updates for us involve taking a server out of the loop, 
updating it, and putting it back in. We have to manage timing issues 
like not putting a Tomcat server back in the loop until it is fully 
started, which can take a while. Typically with Passenger or Unicorn, 
that stuff is already worked out.

I've been meaning to check out other options, but I suspect TorqueBox 
and Trinidad would have the same issues. It's probably more of an issue 
for us  than others since we integrate with a lot of legacy native java 
libraries.

-lenny
Posted by Jake Late (lelouch)
on 2012-07-19 23:13
Hassan Schroeder wrote in post #1069246:
> Nginx - what do you need to know? It installed fine on my Mac (10.7.4)
> and as far as I can tell there aren't any OS-specific issues. What are
> you having trouble with?


Well I installed it easily on my mac but I have some trouble to set a
virtual host working with a rails application. But i'll try again.

Thanks for your reply.



Joe Kutner wrote in post #1069247:
> I have heard of people getting Unicorn working with JRuby, but the
> bottom line is that you simply don't need it.  Unicorn (and Passenger)
> solve a problem that JRuby does not have: a lack of concurrency.

Well from that point of view ... I think you're right so i might try
Mizuno thanks !

> <Warning: shameless self promotion>
> I wrote a book on this subject.  You might find useful.
> http://pragprog.com/book/jkdepj/deploying-with-jruby

I shall give it a try ! Thanks for your help !


Lenny Marks wrote in post #1069358:
> On Jul 18, 2012, at 8:02 PM, Joe Kutner wrote:

> Basically updates for us involve taking a server out of the loop,
> updating it, and putting it back in. We have to manage timing issues
> like not putting a Tomcat server back in the loop until it is fully
> started, which can take a while. Typically with Passenger or Unicorn,
> that stuff is already worked out.

So for you unicorn is worth a shot when you have multiple servers ?

Thanks for all your replies, I learn a lot !
Posted by Lenny Marks (Guest)
on 2012-07-20 13:31
(Received via mailing list)
On Jul 19, 2012, at 5:13 PM, Jake Late wrote:

>
>> <Warning: shameless self promotion>
>> updating it, and putting it back in. We have to manage timing issues
>> like not putting a Tomcat server back in the loop until it is fully
>> started, which can take a while. Typically with Passenger or Unicorn,
>> that stuff is already worked out.
>
> So for you unicorn is worth a shot when you have multiple servers ?

Unicorn might be nice if it could prevent us from needing multiple 
servers. I guess if we had an extremely high traffic site that needed to 
be scaled out horizontally to multiple hosts, we would still need to be 
doing the same adding and removing of servers from the load balancer 
loop. However, a single Tomcat server would be more than enough for us 
if we trusted we could reliably hot-redeploy our WARs. The Unicorn 
forking model could conceivably eliminate our class loader related 
memory leak problems. Seems like a long shot though, due to Unicorns 
reliance on fork. Unless you're looking to break new ground, I'm sure 
one of the previously mentioned deployment options would come more 
naturally. Even for us with all our native java code, one of those 
solutions might work out. The hot redeploy problems* have just been a 
historical issue, especially with older versions of Tomcat going way 
back before we even introduced JRuby.

* http://wiki.apache.org/tomcat/MemoryLeakProtection

-lenny
Posted by Theo (Guest)
on 2012-07-21 18:12
(Received via mailing list)
For Cassandra, try Eurydice: http://github.com/iconara/eurydice

It's built on top of a Java library, and in my experience (I am also its 
author) very stable and performant. The cassandra gem doesn't work 
because the thrift gem that it depends on is broken in .

T#
Posted by Jake Late (lelouch)
on 2012-07-23 21:03
Ok thank you Lenny. I'll try Eurydice too Theo thanks !
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.