Rails Apply Performance Tuning

Source: Internet
Author: User
Tags tomcat ruby on rails

The previous section uses Ruby on Rails to complete an application and put it on a server in an education network. In-school testing feel speed can also, but from Netcom (part of the school dormitory is Netcom network) access has been very slow, so began the journey of debugging speed. At the beginning of the application run on the Webbrick server, I also know that Webbrick is a development test server, Ruby wrote, at one time can only respond to a request, the other requests are sidelined, but think of the application of the user is not much, do not achieve high concurrency, So I used it all the time. The speed of access from the campus basically did not feel, but the speed of access from the Netcom is extremely slow, but the same machine on Tomcat on the application access is relatively fast. The feeling may be that Ruby explains the speed of execution is really slow [not the problem of multiple pages, but access to a page for a longer period of time, but it may be a larger page size problem, doubtful].

So began to toss, rummaged cnrails on the server performance of the posts, began to the performance of each server has a general understanding. In general, the following illustration shows:

Very faint, lighttpd, Nginx is not designed for the Windows platform, so the configuration is cumbersome, and it is said to run more easily crashes, while the server is installed Windows 2003 server, and it is said that apache+ FastCGI also easy to collapse, so chose to use mongrel. Fortunately, the InstantRails1.4 has its own mongrel, and the configuration is quite simple. The main thing is to put some of the modules in the Apache 2.2.3, and then write in httpd.conf inside such a paragraph (the specific configuration may be different, anyway on my machine proxypreservehost bad):

<virtualhost *:80>

ServerName myapp.com

Serveralias www.myapp.com

Proxypass/http://www.myapp.com:8000/

proxypassreverse/http://www.myapp.com:8000

Proxypreservehost on

</VirtualHost>

That is, access to the Apache 80 ports are forwarded to the 8000 mongrel up, as for the port to map how to look at their own.

The next test with JMeter, is really a great tool, although I still used not familiar.

Do not use Apache forwarding, only with mongrel response, the throughput is 300/sec about, not up to the speed of the above picture.

The above figure is set to 10 concurrent (do not know if this test is correct: P), you can see that the average connection time of about 2000.

Configuration for Apache forwarding, the performance is not much improved, throughput or that look, it seems that in a mongrel, with Apache forwarding is not a silver bullet, but the speed of access from the Netcom seems faster.

When I turn the concurrency into 20, the average response time is doubled, and the performance is intolerable by 50. It seems that mongrel himself and Webbrick are not too far off. But it might be better if you use a cluster.

And in the same server Tomcat, in 200 concurrent time to reach about 2000, throughput of about 3000, performance can not be compared ...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.