Class: Roma::Mkconfig::Calculate

Inherits:
Object
  • Object
show all
Defined in:
lib/roma/tools/mkconfig.rb

Class Method Summary collapse

Class Method Details

.connection_num(res) ⇒ Object



303
304
305
306
307
308
309
310
311
312
313
314
# File 'lib/roma/tools/mkconfig.rb', line 303

def self.connection_num(res)
  case res["language"].value
    when "Ruby"
      connection = RUBY_CONNECTION
    when "Java"
      connection = JAVA_CONNECTION
    when "PHP"
      connection = PHP_CONNECTION
  end

  return connection
end

.get_bnum(res) ⇒ Object



283
284
285
286
287
# File 'lib/roma/tools/mkconfig.rb', line 283

def self.get_bnum(res)
  res["server"] = res["fd_server"] if !res["server"]
  ans = res["data"].value.to_i * BNUM_COEFFICIENT * REDUNDANCY / res["server"].value.to_i / TC_FILE
  return ans
end

.get_fd(res) ⇒ Object



298
299
300
301
# File 'lib/roma/tools/mkconfig.rb', line 298

def self.get_fd(res)
  res["fd_server"] = res["server"] if !res["fd_server"]
  res["fd_server"].value.to_i * connection_num(res) + (res["fd_client"].value.to_i- 1) * DEFAULT_ROMA_CONNECTION * 2
end

.get_xmsize_max(res) ⇒ Object



289
290
291
292
293
294
295
296
# File 'lib/roma/tools/mkconfig.rb', line 289

def self.get_xmsize_max(res)
  ans = (res["memory"].value.to_f * GB - OS_MEMORY_SIZE) / res["process"].value.to_i / TC_FILE
  if ans <= 0
    ans = res["memory"].value.to_f * GB / 2 / res["process"].value.to_i / TC_FILE
  end
  ans = ans.to_i
  return ans
end