1

我目前正在测试 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

任何想法?

谢谢!!

4

1 回答 1

1

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

Xen与许多其他管理程序一样,它正在破坏CPUID指令和/proc/cpuinfoLinux 内核结构(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 
于 2013-05-22T09:57:11.323 回答