Solaris Resource Manager 1.3 系统管理指南

多个虚拟 Web 服务器的资源管理

单台计算机经常用于以多个合并方式处理多台虚拟 Web 服务器。在这种情形中,存在有多个 httpd Web 服务器进程,通过 Solaris Resource Manager 可以更好的控制资源。

通过设置 Web 服务器配置文件中的参数,有可能将每个 Web 服务器作为不同的 UNIX UID 运行。这将把每个 Web 服务器有效地与 Solaris Resource Manager 层次结构中的不同 lnode 连接起来。

例如,Sun WebServerTM 在配置文件 /etc/http/httpd.conf 中拥有以下参数:


# Server parameters
 server  {
   server_root                   "/var/http/"
   server_user                   "webserver1"
   mime_file                     "/etc/http/mime.types"
   mime_default_type             text/nlain
   acl_enable                    "yes"
   acl_file                      "/etc/http/access.acl"
   acl_delegate_depth            3
   cache_enable                  "yes"
   cache_small_file_cache_size   8                       # megabytes
   cache_large_file_cache_size   256                     # megabytes
   cache_max_file_size           1                       # megabytes
   cache_verification_time       10                      # seconds
   comment                       "Sun WebServer Default Configuration"

   # The following are the server wide aliases

   map   /cgi-bin/               /var/http/cgi-bin/              cgi
   map   /sws-icons/             /var/http/demo/sws-icons/
   map   /admin/                 /usr/http/admin/

 # To enable viewing of server stats via command line,
 # uncomment the following line
   map   /sws-stats              dummy                           stats
 }

通过配置要作为不同 UNIX UID 运行的 Web 服务器,您可以在每个 Web 服务器上设置不同的限制。这对在一台运行多个 Web 服务器的计算机上进行资源使用的控制和计费特别有用。

在这种情形,您可以利用多个或所有的 Solaris Resource Manager 资源控制和限制:

Shares [cpu.shares]

cpu.shares 可用于按比例地给不同的 Web 服务器分配资源。

Mem limit [memory.limit]

memory.limit 可用于限制 Web 服务器可以使用的虚拟内存量,它将防止任何一个 Web 服务器因内存分配而导致另一个失败。

Proc mem limit [memory.plimit]

每个过程内存限制可用于限制单个 cgi-bin 过程可使用的虚拟内存量,它将防止任何 cgi-bin 过程导致其相应的 Web 服务器停止运行。

Process limit [process.limit]

允许连接到一台 Web 服务器最大的过程总数可以有效地限制 cgi-bin 过程的并行数。