Heroku上的RoR [性能]:线程,工人,whacamole还是dynos?

时间:2018-05-16 02:44:35

标签: ruby-on-rails performance heroku puma

APP:Heroku standard-2x dyno上的Rails 4.2.9。

DB:Drift计划中的MySQL Heroku附加ClearDB

Puma:工人4,threads_count 1

每天不超过10人访问此应用。就他们的用途而言,它很好。没有关于速度或停机时间的投诉。

该应用有很多.sum.each { |n| total += n.value}类型的东西,我怀疑它们是耗费内存的东西。

问题是这个应用程序每天都会超过1 GB的内存使用量。

下一个dyno的价格差异对于这么小的操作来说是不合理的。此外,考虑到使用它的员工少于10人,付出5倍以上,而不是让应用程序运行得更好似乎很疯狂!

无论如何,正如我读到的那样,我似乎变得越来越不确定。问题是:

在这种情况下降低内存使用率的最佳方法是什么?我应该关注哪条路径?

  1. 将美洲狮线程更改为更多?
  2. 将puma工人变更为更多? (减?)
  3. 使用whacamole gem并且每天只重启几次dyno?
  4. 切换到2个标准-1x dynos而不是一个标准-2x?
  5. 别的什么?完全不同?
  6. 更新(开发环境中的某些PS输出)

       CPU    MEM    TIME       BOSS
     -
       0.0    0.1    0:19.32    cluster worker 1: 58165
       0.0    0.4    0:39.90    cluster worker 0: 58165
       0.0    0.4    0:11.17    3.11.4 (tcp://localhost:3000) [finan]
     -
       0.0    0.1    0:19.32    cluster worker 1: 58165
       0.0    0.2    0:39.90    cluster worker 0: 58165
       0.0    0.4    0:11.17    3.11.4 (tcp://localhost:3000) [finan]
     -
       3.3    0.3    0:19.38    cluster worker 1: 58165
       0.3    0.2    0:39.90    cluster worker 0: 58165
       0.0    0.4    0:11.17    3.11.4 (tcp://localhost:3000) [finan]
     -
       25.7    2.1    0:19.94    cluster worker 1: 58165
       0.0    0.2    0:39.90    cluster worker 0: 58165
       0.0    0.4    0:11.17    3.11.4 (tcp://localhost:3000) [finan]
     -
       96.3    2.3    0:21.02    cluster worker 1: 58165
       0.0    0.2    0:39.90    cluster worker 0: 58165
       0.0    0.4    0:11.17    3.11.4 (tcp://localhost:3000) [finan]
     -
       96.7    2.4    0:22.09    cluster worker 1: 58165
       0.0    0.2    0:39.90    cluster worker 0: 58165
       0.0    0.4    0:11.17    3.11.4 (tcp://localhost:3000) [finan]
     -
       96.9    2.5    0:23.09    cluster worker 1: 58165
       0.1    0.4    0:11.18    3.11.4 (tcp://localhost:3000) [finan]
       0.0    0.2    0:39.90    cluster worker 0: 58165
     -
       97.5    2.6    0:24.15    cluster worker 1: 58165
       0.0    0.2    0:39.90    cluster worker 0: 58165
       0.0    0.4    0:11.18    3.11.4 (tcp://localhost:3000) [finan]
     -
       98.5    2.7    0:25.23    cluster worker 1: 58165
       0.0    0.2    0:39.90    cluster worker 0: 58165
       0.0    0.4    0:11.18    3.11.4 (tcp://localhost:3000) [finan]
     -
       98.2    2.8    0:26.32    cluster worker 1: 58165
       0.0    0.2    0:39.90    cluster worker 0: 58165
       0.0    0.4    0:11.18    3.11.4 (tcp://localhost:3000) [finan]
     -
       90.1    2.8    0:27.35    cluster worker 1: 58165
       0.0    0.2    0:39.90    cluster worker 0: 58165
       0.0    0.4    0:11.18    3.11.4 (tcp://localhost:3000) [finan]
     -
       97.9    2.9    0:28.42    cluster worker 1: 58165
       0.0    0.2    0:39.90    cluster worker 0: 58165
       0.0    0.4    0:11.18    3.11.4 (tcp://localhost:3000) [finan]
     -
       85.4    3.2    0:29.43    cluster worker 1: 58165
       0.0    0.2    0:39.90    cluster worker 0: 58165
       0.0    0.4    0:11.18    3.11.4 (tcp://localhost:3000) [finan]
     -
       91.7    4.9    0:30.42    cluster worker 1: 58165
       0.0    0.2    0:39.90    cluster worker 0: 58165
       0.0    0.2    0:11.18    3.11.4 (tcp://localhost:3000) [finan]
     -
       18.4    4.1    0:31.06    cluster worker 1: 58165
       0.0    0.1    0:39.90    cluster worker 0: 58165
       0.0    0.2    0:11.18    3.11.4 (tcp://localhost:3000) [finan]
     -
       0.2    3.5    0:31.06    cluster worker 1: 58165
       0.0    0.1    0:39.90    cluster worker 0: 58165
       0.0    0.2    0:11.18    3.11.4 (tcp://localhost:3000) [finan]
     -
       11.7    3.7    0:31.20    cluster worker 1: 58165
       2.5    0.4    0:39.94    cluster worker 0: 58165
       0.0    0.2    0:11.18    3.11.4 (tcp://localhost:3000) [finan]
     -
       0.1    3.7    0:31.20    cluster worker 1: 58165
       0.0    0.4    0:39.94    cluster worker 0: 58165
       0.0    0.2    0:11.18    3.11.4 (tcp://localhost:3000) [finan]
     -
       0.0    3.5    0:31.20    cluster worker 1: 58165
       0.0    0.4    0:39.94    cluster worker 0: 58165
       0.0    0.2    0:11.18    3.11.4 (tcp://localhost:3000) [finan]
     -
       0.4    0.2    0:11.18    3.11.4 (tcp://localhost:3000) [finan]
       0.0    3.4    0:31.20    cluster worker 1: 58165
       0.0    0.4    0:39.94    cluster worker 0: 58165
    

0 个答案:

没有答案