2016-03-03 95 views
0

我們的Rails 4.2應用程序正在運行254MB物理內存在ubuntu 14.04服務器上運行。 Ruby應用通常有很大的內存佔用。然而254MB仍然看起來很多。以下是該應用的Gemfile。所有與:path寶石都是我們自己開發的引擎。有更好的編碼實踐來減少物理內存佔用?非常感謝。Rails 4.2應用程序是否佔用太多內存?

source 'http://rubygems.org' 

gem 'rails', '4.2.0' 

# Bundle edge Rails instead: 
# gem 'rails', :git => 'git://github.com/rails/rails.git' 

gem 'sqlite3' 
gem 'sass-rails', '~> 5.0' 
# Use Uglifier as compressor for JavaScript assets 
gem 'uglifier', '>= 1.3.0' 
# Use CoffeeScript for .coffee assets and views 
gem 'coffee-rails', '~> 4.1.0' 
gem 'sdoc', '~> 0.4.0', group: :doc 

gem 'sprockets', '2.12.3' 
gem 'tilt', '~>1.4.1' 
#gem 'turbolinks' #cause datepicker stop working. removed from application.js. 
gem 'jquery-rails' #, '2.3.0' #may cause error with jquery-ui for version 3.0.0 for rails 3.2.12. 
gem 'jquery-ui-rails' 
gem 'database_cleaner' 
gem 'simple_form', '~>3.1.0' 
gem 'will_paginate' 
gem 'gon' 
#rails 4.2.0 
gem 'tzinfo-data' #, platforms: [:mingw_20, :mingw, :mswin] 
gem 'protected_attributes' 
# 
#gem 'coffee-script-source', '1.8.0' #ver reduced for windows platform 


gem 'authentify', :path => '../engines/authentify' # 
gem 'commonx', :path => '../engines/commonx' # 
gem 'purchase_orderx', :path => '../engines/purchase_orderx' 
gem 'kustomerx', :path => '../engines/kustomerx' # #for rspec test 
gem 'supplierx', :path => '../engines/supplierx' 
gem 'manufacturerx', :path => '../engines/manufacturerx' 
gem 'ext_construction_projectx', :path => '../engines/ext_construction_projectx' 
gem 'searchx', :path => '../engines/searchx' 
gem 'biz_workflowx', :path => '../engines/biz_workflowx' 
gem 'state_machine_logx', :path => '../engines/state_machine_logx' 
gem 'base_materialx', :path => '../engines/base_materialx' 
gem 'simple_contractx', :path => '../engines/simple_contractx' 
gem 'in_paymentx', :path => '../engines/in_paymentx' 
gem 'resource_allocx', :path => '../engines/resource_allocx' 
gem 'payment_requestx', :path => '../engines/payment_requestx' 
gem 'status_reportx', :path => '../engines/status_reportx' 
gem 'two_tier_definitionx', :path => '../engines/two_tier_definitionx' 
gem 'user_manualx', :path => '../engines/user_manualx' 
gem 'bill_of_base_materialx', :path => '../engines/bill_of_base_materialx' 
#gem 'file_uploaderx', :path => '../engines/file_uploaderx' 
gem 'bank_accountx', :path => '../engines/bank_accountx' 
+0

我建議更新到rails 4.2.5.2,修復了一些安全問題。 – Meier

回答

2

我們的獨角獸工作者平均擁有260MB的RSS,而我們的gemlist比你的要長。我不知道你在那裏擁有的所有寶石,但你可以嘗試用ObjectSpace.count_objects(需要圖書館之前和之後的措施)追蹤巨大的分配。

雖然保存的內存總是很好,但我認爲250 MB是可以的。 Rails在內存中保持很多獨立的請求。