Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Huge memory usage in bundle #4583

Closed
nazarhussain opened this issue Aug 17, 2016 · 5 comments
Closed

Huge memory usage in bundle #4583

nazarhussain opened this issue Aug 17, 2016 · 5 comments

Comments

@nazarhussain
Copy link

Hello Team,

I was benchmarking my application performance and came to know a point that activeadmin is taking more memory then even complete rails framework.

I am using library https://github.com/schneems/derailed_benchmarks and when I run bundle exec derailed bundle:mem I have following results;

TOP: 54.1992 MiB
 rails/all: 6.4922 MiB
 activeadmin: 11.0078 MiB
    active_admin: 11.0 MiB
      bourbon: 4.7617 MiB
        sass: 4.6289 MiB (Also required by: active_admin, active_admin/sass/helpers)
          sass/engine: 4.082 MiB
            sass/script: 1.3203 MiB (Also required by: sass/script/css_parser)
              sass/script/operation: 0.4922 MiB
                sass/script/string: 0.3516 MiB (Also required by: sass/script/literal)
                  sass/script/literal: 0.3242 MiB (Also required by: sass/script/number, sass/script/color, and 3 others)
              sass/script/parser: 0.4883 MiB
                sass/script/lexer: 0.3242 MiB
            sass/scss: 0.4844 MiB
              sass/scss/parser: 0.3867 MiB
            sass/selector: 0.4023 MiB
          sass/version: 0.4141 MiB
            sass/util: 0.3164 MiB (Also required by: sass)
      active_admin/comments: 2.1875 MiB
        active_admin/comments/views: 1.4141 MiB
          active_admin/views: 1.3438 MiB (Also required by: active_admin/comments/views/active_admin_comments)
            /Users/nazar/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/activeadmin-0.6.6/lib/active_admin/views/components/paginated_collection.rb: 0.3047 MiB
        active_admin/application: 0.4375 MiB
      meta_search: 1.6563 MiB
        meta_search/searches/active_record: 1.5 MiB
          meta_search/builder: 1.4219 MiB
            meta_search/where: 1.1797 MiB
      arbre: 0.9063 MiB
        arbre/html/html5_elements: 0.4648 MiB
      active_admin/filters: 0.4961 MiB
      active_admin/sass/helpers: 0.4648 MiB
        sass-rails: 0.4336 MiB
          sass/rails: 0.4297 MiB
            sass/rails/railtie: 0.3281 MiB

As you can see complete rails framework is taking up 6.4 MB whereas activeadmin is taking 11MB almost double.

Can you guys figure out what's the issue and how can we sort this out?

@timoschilling
Copy link
Member

First you benchmark ActiveAdmin 0.6.x.
Second the benchmark smells at one point, sass is listed as pure ActiveAdmin dependency, but in the most cases it use used from the host app too. That's results in 6.4 MB (11 MB - 4.6 MB Sass).

During the fact that your test loads the ActiveAdmin Comments, you load the ActiveAdmin View Stack too. But I think you don't load the Rails View Stack (which happens during the first request).
That means you compare 60% of Rails with 95% of ActiveAdmin.

But I will keep this open and take a deeper look on it later.

@nazarhussain
Copy link
Author

Yes I was also not sure on it that's why posted my question here. SaaS as dependency of active_admin was also seems misleading, but you can check it deeply with https://github.com/schneems/derailed_benchmarks

I am using ActiveAdmin in many projects and I always love it. Recently I added it to a project few weeks back and I was facing memory issues afterwards, that's triggered me to do benchmarking. Still I am not sure its activeadmin or something else. I am using Rails 3.2.22.2 and Ruby 2.3.0

@javierjulio
Copy link
Member

Closing out as stale. We no longer support Rails 3.2, only 4.2 and up as of now. We can reopen though if you are able to provide updated info and test case against AA v1.

@paniko0
Copy link

paniko0 commented Feb 20, 2018

I noticed the same thing. Even though v1.2 is slightly better than v1.1, it still consumes a lot of bootup memory.

screen shot 2018-02-20 at 12 24 06 pm

I'm using Rails 4.2 and Ruby 2.3.1

Do you guys know anything I can do in order to decrease memory consumption? Or should I consider it normal?

@javierjulio
Copy link
Member

@paniko0 no but there is a discussion going on in #5113

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants