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