简体   繁体   English

Phusion乘客生成器导轨应用导致CPU使用率高

[英]Phusion passenger spawner rails app causing high cpu usage

I have Asterisk and Rails app running on the same server. 我在同一服务器上运行了Asterisk和Rails应用程序。 All inbound calls via Asterisk triggers a "curl" to the rails app's controller to initiate a juggernaut publish, enabling real-time push of inbound calls to the individual logged in user (Pop-up dialog showing caller profile details). 所有通过Asterisk进行的入站呼叫都会触发Rails应用程序控制器的“卷曲”,以启动巨大的发布,从而可以将入站呼叫实时推送到已登录的个人(显示呼叫者个人资料详细信息的弹出对话框)。

The problem is, the Passenger Spawner of the rails app is running at almost 100% CPU usage when ever calls starts coming in. Each inbound phone call will run: 问题是,当有电话开始打入时,rails应用程序的乘客Spanner几乎以100%的CPU使用率运行。每个入站电话将运行:

/usr/bin/curl http://parlo.local/asterisk/inbound_call?exten=8405&src_num=921187888&recordingfilename=q70001-20 / usr / bin / curl http://parlo.local/asterisk/inbound_call?exten = 8405&src_num = 921187888&recordingfilename = q70001-20

In asterisk controller: 在星号控制器中:

def inbound_call
  if params[:src_num].length > 6
    extension = AsteriskUserextension.find_by_extension(params[:exten])
    if extension.present? && extension.user.present?
      @user = extension.user
      customer = Customer.first_match(params[:src_num]).first
      customer_name = customer.present? ? customer.full_name : "Unknown Caller"
      queue = AsteriskQueue.find_by_name(params[:queue])
      @result = Asterisk::Action.response_factory("asterisk_inbound","#{queue.try(:title)}","OK",customer.try(:id))
      publish
    end
  end
  render :nothing => true, :status => :created
end

I believe the high inbound call rate is causing the high CPU usage. 我相信较高的入站呼叫率会导致较高的CPU使用率。 What is the best way to remedy this situation? 解决这种情况的最佳方法是什么? Will pushing all the work to RESQUE help? 将所有工作推向RESQUE会有所帮助吗?

Thanks for any guidance! 感谢您的指导!

You need use FastCGI technology. 您需要使用FastCGI技术。

Also you need in asterisk use CURL function instead of System application. 您还需要在星号中使用CURL函数而不是系统应用程序。

Every call to System create shell and fork new proccess. 每次对System的调用都会创建shell并派生新进程。

Also it can be nice idea check asterisk events via AMI instead of dooign CURL. 同样,通过AMI而不是双重CURL检查星号事件也可能是个好主意。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM