我目前正在测试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
任何想法?
谢谢! !
gwan.log文件报告我只有一个核心:
Xen
,像许多其他管理程序一样,正在破坏CPUID
指令和/proc/cpuinfo
Linux内核结构(两者都被G-WAN用于检测CPU内核)。
正如您所看到的,这对于设计用于多核扩展的多线程应用程序来说是一个真正的问题。
"。/gwan -w 4'用于覆盖1个1核CPU
为了避免愚蠢的手动覆盖浪费内存和影响性能,G-WAN检查用户提供的线程数不大于实际的CPU核心数。
这就是为什么你有警告:"(不能使用比CPU内核更多的线程)"。
要绕过此保护和警告,您可以使用-g
("God")模式:
./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