add rate setting

This commit is contained in:
邱博亞 2023-04-23 17:27:04 +08:00
parent 6b84921f59
commit f0df2fac26
3 changed files with 11 additions and 2 deletions

View File

@ -33,12 +33,13 @@ class Admin::PlowController < OrbitAdminController
host = uri.host
ip = @setting.ip
concurrent = @setting.concurrent
rate = @setting.rate
scheme = uri.scheme
Thread.new do
if !ip.blank?
`ulimit -n 100000 && #{Binary} #{scheme}://#{ip}#{uri.request_uri} --host=#{host} --listen=#{SocketFile} -c#{concurrent} --summary > #{LogFile}`
`ulimit -n 100000 && #{Binary} #{scheme}://#{ip}#{uri.request_uri} --host=#{host} --listen=#{SocketFile} -c#{concurrent} --rate #{rate} --summary > #{LogFile}`
else
`ulimit -n 100000 && #{Binary} #{@setting.url} --listen=#{SocketFile} -c#{concurrent} --summary > #{LogFile}`
`ulimit -n 100000 && #{Binary} #{@setting.url} --listen=#{SocketFile} -c#{concurrent} --rate #{rate} --summary > #{LogFile}`
end
end
max_wait = 10

View File

@ -5,4 +5,5 @@ class PlowSetting
field :concurrent, type: Integer, :default => 1
field :ip, type: String
field :url, type: String
field :rate, type: Integer, :default => 5000
end

View File

@ -25,6 +25,13 @@
</div>
</div>
<div class="control-group">
<label class="control-label muted" for="rate">Request Rate(Requests/seconds)</label>
<div class="controls">
<%= f.number_field :rate, :class => 'input-large' %>
</div>
</div>
<% if !@logContent.blank? %>
<div class="control-group">
<label class="control-label muted">Summary</label>