【问题标题】:Gwan - Why gwan determine only 1 core?Gwan - 为什么 gwan 只确定 1 个核心?
【发布时间】:2023-04-06 08:48:01
【问题描述】:

我目前正在测试 gwan web 服务器,我对 gwan worker 的默认设置和 CPU 内核检测有疑问。

在 Xen 服务器(包含 4 核 Xeon CPU)上运行 gwan,gwan.log 文件报告仅检测到单个内核:

'./gwan -w 4' used to override 1 x 1-Core CPU(s)
[Wed May 22 06:54:29 2013 GMT]   using   1 workers 0[01]0
[Wed May 22 06:54:29 2013 GMT]   among   2 threads 0[11]1
[Wed May 22 06:54:29 2013 GMT]   (can't use more threads than CPU Cores)

[Wed May 22 06:54:29 2013 GMT] CPU: 1x Intel(R) Xeon(R) CPU E5506 @ 2.13GHz
[Wed May 22 06:54:29 2013 GMT]  0 id: 0     0
[Wed May 22 06:54:29 2013 GMT]  1 id: 1     1
[Wed May 22 06:54:29 2013 GMT]  2 id: 2     2
[Wed May 22 06:54:29 2013 GMT]  3 id: 3     3
[Wed May 22 06:54:29 2013 GMT] CPU(s):1, Core(s)/CPU:1, Thread(s)/Core:2

有什么想法吗?

谢谢!!

【问题讨论】:

    标签: multicore g-wan hypervisor


    【解决方案1】:

    gwan.log 文件报告说我只有一个核心:

    Xen 与许多其他管理程序一样,正在破坏CPUID 指令和/proc/cpuinfo Linux 内核结构(G-WAN 使用这两者来检测 CPU 内核)。

    如您所见,这对于设计为在多核上扩展的多线程应用程序来说是一个真正的问题。

    './gwan -w 4' 用于覆盖 1 x 1-Core CPU(s)

    为避免愚蠢的手动覆盖浪费内存和影响性能,G-WAN 会检查用户提供的线程数是否不大于实际 CPU 核心数。

    这就是您收到警告的原因:"(can't use more threads than CPU Cores)".

    要绕过此保护和警告,您可以使用-g(“上帝”)模式:

    ./gwan -g -w 4
    

    此命令行开关记录在 G-WAN 可执行文件帮助中:

    ./gwan -h
    
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Usage: gwan [-b -d -g -k -r -t -v -w] [argument]
    (grouped options '-bd' are ignored, use '-b -d')
    
      -b: use the TCP_DEFER_ACCEPT TCP option
          (this is disabling the DoS shield!)
    
      -d: daemon mode (uses an 'angel' process)
          -d:group:user dumps 'root' privileges
    
      -g: do not limit worker threads to Cores
          (using more threads than physical Cores
           will lower speed and waste resources)
    
      -k: (gracefully) kill local gwan processes
          using the pid files of the gwan folder
    
      -r: run the specified C script (and exit)
          for general-purpose code, not servlets
    
      -t: store client requests in 'trace' file
          (may be useful to debug/trace attacks)
    
      -v: return version number and build date
    
      -w: define the number of worker threads.
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Available network interfaces (2):
    127.0.0.1 192.168.0.11 
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2013-05-31
      • 1970-01-01
      • 1970-01-01
      • 2012-12-12
      • 2012-10-25
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多