{"action":"created","issue":{"url":"https://api.github.com/repos/ruby-amqp/bunny/issues/306","labels_url":"https://api.github.com/repos/ruby-amqp/bunny/issues/306/labels{/name}","comments_url":"https://api.github.com/repos/ruby-amqp/bunny/issues/306/comments","events_url":"https://api.github.com/repos/ruby-amqp/bunny/issues/306/events","html_url":"https://github.com/ruby-amqp/bunny/issues/306","id":78911429,"number":306,"title":"require 'bunny' uses more memory than require 'rails/all'","user":{"login":"salimane","id":403938,"avatar_url":"https://avatars.githubusercontent.com/u/403938?v=3","gravatar_id":"","url":"https://api.github.com/users/salimane","html_url":"https://github.com/salimane","followers_url":"https://api.github.com/users/salimane/followers","following_url":"https://api.github.com/users/salimane/following{/other_user}","gists_url":"https://api.github.com/users/salimane/gists{/gist_id}","starred_url":"https://api.github.com/users/salimane/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/salimane/subscriptions","organizations_url":"https://api.github.com/users/salimane/orgs","repos_url":"https://api.github.com/users/salimane/repos","events_url":"https://api.github.com/users/salimane/events{/privacy}","received_events_url":"https://api.github.com/users/salimane/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-05-21T09:31:06Z","updated_at":"2015-05-21T15:59:35Z","closed_at":"2015-05-21T15:58:13Z","body":"Requiring the gem ``bunny`` uses more memory than require ``rails/all``. It uses ``23MB`` while in comparison ``rails/all`` uses ``17MB``.\r\n\r\n```shell\r\nbunny: 23.9688 MiB\r\nrails/all: 17.6445 MiB\r\nelasticsearch/model: 2.0195 MiB\r\nmysql2: 0.6011 MiB\r\n```\r\n\r\nTo reproduce this :\r\n- Put this in your gemfile:\r\n```ruby\r\ngem 'rails', '3.2.21'\r\ngem 'bunny', '~> 1.7.0'\r\ngem 'elasticsearch-rails', '~> 0.1.7', require: ['elasticsearch/model']\r\ngem 'elasticsearch-model', '~> 0.1.7'\r\ngem 'elasticsearch', '~> 1.0.8'\r\ngem 'mysql2', '~> 0.3.18'\r\ngem 'derailed', group: :development\r\ngem \"stackprof\", group: :development\r\n```\r\n- Then run \r\n```shell\r\nbundle install\r\nRAILS_ENV=production rails console # to check if you can run your app with prod env\r\nRAILS_ENV=production rails server # to run your app with prod env\r\nRAILS_ENV=production rake assets:precompile # sometimes this is needed\r\ntail -f logs/production.log # to check errors in logs...\r\nderailed exec perf:mem # check memory usage by gems\r\n```\r\n\r\nMay be we could check how we could reduce the memory usage.\r\nThanks"},"comment":{"url":"https://api.github.com/repos/ruby-amqp/bunny/issues/comments/104331301","html_url":"https://github.com/ruby-amqp/bunny/issues/306#issuecomment-104331301","issue_url":"https://api.github.com/repos/ruby-amqp/bunny/issues/306","id":104331301,"user":{"login":"michaelklishin","id":1090,"avatar_url":"https://avatars.githubusercontent.com/u/1090?v=3","gravatar_id":"","url":"https://api.github.com/users/michaelklishin","html_url":"https://github.com/michaelklishin","followers_url":"https://api.github.com/users/michaelklishin/followers","following_url":"https://api.github.com/users/michaelklishin/following{/other_user}","gists_url":"https://api.github.com/users/michaelklishin/gists{/gist_id}","starred_url":"https://api.github.com/users/michaelklishin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/michaelklishin/subscriptions","organizations_url":"https://api.github.com/users/michaelklishin/orgs","repos_url":"https://api.github.com/users/michaelklishin/repos","events_url":"https://api.github.com/users/michaelklishin/events{/privacy}","received_events_url":"https://api.github.com/users/michaelklishin/received_events","type":"User","site_admin":false},"created_at":"2015-05-21T15:59:34Z","updated_at":"2015-05-21T15:59:34Z","body":"I doubt we can significantly reduce memory usage in Bunny: it is a pretty small library that relies on another small library, all eagerly loaded. Try eagerly load Rails to compare."}}