Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

So I have an Amazon EC2 small instance setup on Ubuntu with Ruby Enterprise Edition running on Passenger + Nginx. I set 25 Passenger instances and performance is dropping very quickly relative to the number of concurrent connections.

For example, at 1 concurrent connection from JMeter, the response time is less than 1 second. Then at 5 concurrent connections, the response time jumps over 1 second. By the time I'm trying 10 concurrent connections the response time is averaging between 3-7 seconds!!

I imagined since I have 25 instances running, it should at least be able to handle 25 concurrent connections without much performance degradation? Obviously I'm a newbie to Web servers and all... Can someone explain to me the cause of this performance degradation?

Is it... that CPU is too slow? I feel like 1.7GB of memory should be plenty... Considering each instance apparently is running only about 30MB of memory.

Any further insights into how to configure Passenger + Nginx correctly would be greatly appreciated!!

Thanks!

share|improve this question
    
EC2 small instances have the CPU power of a 1Ghz processor from about 2007. –  Cromulent Sep 9 '10 at 7:22

1 Answer 1

You should take a look at the CPU and memory usage while doing your tests.

From your description (and without knowing anything about the code) it sounds like the CPU is bogged, or perhaps it's waiting for some locked resource (database?) somewhere.

share|improve this answer
    
So I guess the CPU can't handle it... the % idle drops to 0 as soon as there's like 3-4 connections. I didn't realize RoR was so resource intensive! So does this mean I need to upgrade the instance if I expect to have just a couple concurrent users? What type of server/CPU should I be looking at to be able to take advantage of the 25 instances? Is it usually wise/recommended to get a faster server, or to get more servers (I guess, "upward or outward"?) –  Steven Ou Sep 9 '10 at 21:21
    
Steven, either you make your program faster or get more hardware. Only experimentation will tell, but if you saturate 1.7Ghz with 3 threads, I'd be looking at the high cpu instance. I'd keep it simple with a single machine, unless your benchmarks show it's a lot better value using many cheap instances. –  Joris Sep 10 '10 at 5:46
    
Thanks for your help! I booted up a high CPU instance and ran the same setup on it and I could do 30 concurrent connections with the average response at a borderline acceptable 2 seconds. So I guess I'm concluding it makes sense to get the high CPU instance instead of many small ones, like you said :) –  Steven Ou Sep 10 '10 at 9:50

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.