Ruby Basic teaching Rails performance optimization

Source: Internet
Author: User
Tags ruby on rails

In Ruby on Rails(http://www.maiziedu.com/course/ruby-px/) , many rails Programmers often forget to consider performance issues, which can lead to slow website speeds, a spike in memory usage,and frequent reboots ofApache , so you'll need to optimize rails performance. The specific optimization content is as follows:

1, Replace the default Webrickwith Unicorn or Thin server.

2, static resource compression merged, put on the cloud storage.

3, you can use the turbolinksof Railsand use js to replace title and the Body , but also brought a JS changes in logic.

4,Active Record associations pre-load,includes or preload, avoid n+1 problems

5, Cache. Page caching, method caching, and Russian sets of dolls.

One, front-end optimization

1,Asset pipeline: Merging compressed static files

2,turbolinks: Using the browser's pushstate and Ajax, Replace the body and title element when getting a response . This does not require reloading the execution of CSS files and js files, but also increases the complexity of the page.

3, static file mirroring storage: Storage of static files in third parties, such as seven of cattle, such as cloud storage, the use of third-party speed advantage, but also reduce the pressure on their own servers.

4, increase the number of concurrent requests: Multi-domain accelerated access, and reduce the need to carry unnecessary cookies.

Two, server optimization.

1, replace the default webrick.

Ruby Basic teaching Rails performance optimization

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.