Страница 1 из 2
Хостинг. Ограничение кол-ва процессов для юзера
Добавлено: 2011-02-10 22:39:14
andryu
Имеется хостинг. Панель ISPmanager, apeche1.3 php-cgi
В панели есть ограничения на CPU,MEM и кол-во процессов для пользователя. Всё ограничивается через задание переменных в конфиге apache для каждого виртуалхоста
У меня ограничение на кол-во процессов не работает, ну думаю провлема в том, что php как cgi а не mod_php. Обратился на форум ispsystem с проблемой, там меня послали читать что такое RLimitCPU RLimitMEM RLimitNPROC. Других вариантов решения проблемы естественно не предложили

На тестовый сервер установил заново всю систему, поменял apache1.3 на apache-itk, включил для сайта mod_php.
И всё равно не работает. Решил обратиться к ним в поддержку. Там говорят нужен доступ - посмотрим. Посмотрели
И смешно и плакать хочется

ну ладно cgi - значит cgi. Поставил для сайта php-cgi,отписал им об изменениях, а они даже смотреть отказались
Это уже к работе apache относится. Не к панели. Панель выполняет свою функцию - добавляет в VirtualHost соответствующую директиву.
Люди добрые подскажите в чём фишка этого RLimitNPROC, с каким apache он работает и какой php ему нужен. Очень уж хочеться ограничения включить. Может кто-то другие варианты ограничений использует? Поделитесь опытом
Re: Хостинг. Ограничение кол-ва процессов для юзера
Добавлено: 2011-02-11 9:17:14
FiL
a ты уверен, что оно не работает?

Re: Хостинг. Ограничение кол-ва процессов для юзера
Добавлено: 2011-02-11 11:30:46
andryu
Вручную выставил RLimitNPROC number|max, например, RLimitNPROC 2 3, и без проблем могу от эзера штук 20 просессов php-cgi запустить через apache. Либо оно ограничивает что-то другое, либо я не понимаю совсем как оно работает
Process limits control the number of processes per user. - вроде ничего заумного не написано

про особенности работы тоже ничего нет - выходит, что оно тупо не работает
P.S.: для начинающих, так для начинающих
Re: Хостинг. Ограничение кол-ва процессов для юзера
Добавлено: 2011-02-11 16:12:08
andryu
Занялся вплотную этим вопросом. Не работают ограничания даже из login.conf. Даже если установить apache22 и выбрать
Код: Выделить всё
[Х] SUEXEC Enable mod_suexec
[Х] SUEXEC_RSRCLIMIT SuEXEC rlimits based on login class
всё равно можно запустить кучу php-cgi или httpd от пользователя.
Re: Хостинг. Ограничение кол-ва процессов для юзера
Добавлено: 2011-02-11 17:55:24
Alex Keda
юзайте комбинацию login.conf + mpm-itk
первый сам ограничит, кк написано, у второго есть параметр
Re: Хостинг. Ограничение кол-ва процессов для юзера
Добавлено: 2011-02-11 18:39:52
andryu
юзайте комбинацию login.conf + mpm-itk
А другие ограничения в этой связке будут работать или тоже использовать альтернативные параметры? Интересует RLimitCPU b RLimitMEM.
P.S.: Первый дельный совет за неделю

Re: Хостинг. Ограничение кол-ва процессов для юзера
Добавлено: 2011-02-12 18:02:46
ADRE
andryu писал(а):юзайте комбинацию login.conf + mpm-itk
А другие ограничения в этой связке будут работать или тоже использовать альтернативные параметры? Интересует RLimitCPU b RLimitMEM.
P.S.: Первый дельный совет за неделю

http://httpd.apache.org/docs/1.3/mod/co ... #rlimitcpu - работает, а в чём проблема?
Re: Хостинг. Ограничение кол-ва процессов для юзера
Добавлено: 2011-02-12 18:36:55
andryu
у меня не работает, или я не могу это проверить правильно. Выставил например пользователю RLimitCPU 1 1, т.е. Php-cgi пользователя должны работать 1 сек. На практике такого не случилось. top(TIME) вроде правильные секунды показывает, так вот процессы работают по 2сек и не убиваются. Один раз удалось запустить ресурсоёмкий скрипт, так он 7 сек проработал.. Или rlimit на Php-cgi не влияет совсем?
Re: Хостинг. Ограничение кол-ва процессов для юзера
Добавлено: 2011-02-12 20:02:53
ADRE
andryu писал(а): у меня не работает, или я не могу это проверить правильно. Выставил например пользователю RLimitCPU 1 1, т.е. Php-cgi пользователя должны работать 1 сек. На практике такого не случилось. top(TIME) вроде правильные секунды показывает, так вот процессы работают по 2сек и не убиваются. Один раз удалось запустить ресурсоёмкий скрипт, так он 7 сек проработал.. Или rlimit на Php-cgi не влияет совсем?
хз должно работать,
Реконфиг апача?
запуск от cgi от другого пользователя попробовать.
Re: Хостинг. Ограничение кол-ва процессов для юзера
Добавлено: 2011-02-12 20:06:32
andryu
а нету ни у кого таких тормознутых сайтов, один только - на нём и проверяю..
Re: Хостинг. Ограничение кол-ва процессов для юзера
Добавлено: 2011-02-12 20:08:50
ADRE
как выше написано login.conf + mpm-itk - комбинация рулит... т.е. php модулем.
--
имеетеся в виду нагрузка меньше будет - реально... а на счет не ограничивания - странно...
Re: Хостинг. Ограничение кол-ва процессов для юзера
Добавлено: 2011-02-12 22:39:21
andryu
Кстати login.conf + mpm-itk
не дружат вместе
А если ещё rlimit-ы не будут работать, то совсем плохо дело с ограничением ресурсов обстоит..
Re: Хостинг. Ограничение кол-ва процессов для юзера
Добавлено: 2011-02-12 22:53:05
Alex Keda
Alex Keda писал(а):юзайте комбинацию login.conf + mpm-itk
первый сам ограничит, кк написано, у второго есть параметр
что именно вас не устроило?
Re: Хостинг. Ограничение кол-ва процессов для юзера
Добавлено: 2011-02-12 22:58:16
andryu
С этим всё хорошо, спасибо за совет. Я про остальные ограничения, память и процессор. Тут rlimit не работает тоже
Re: Хостинг. Ограничение кол-ва процессов для юзера
Добавлено: 2011-02-13 11:51:04
Alex Keda
забить?
Re: Хостинг. Ограничение кол-ва процессов для юзера
Добавлено: 2011-02-13 15:49:38
andryu
Re: Хостинг. Ограничение кол-ва процессов для юзера
Добавлено: 2011-02-14 12:00:52
ADRE
andryu писал(а):
??
Re: Хостинг. Ограничение кол-ва процессов для юзера
Добавлено: 2011-02-14 13:42:38
andryu
Сейчас не могу проверить на apache-itk, для apache1.3 данные команды не подойдут походу.. Отпишусь о результатах в четверг-пятницу
Re: Хостинг. Ограничение кол-ва процессов для юзера
Добавлено: 2011-02-15 10:43:12
ADRE
andryu писал(а):Сейчас не могу проверить на apache-itk, для apache1.3 данные команды не подойдут походу.. Отпишусь о результатах в четверг-пятницу
да ладно........ всегда подходили
man apachectl
Re: Хостинг. Ограничение кол-ва процессов для юзера
Добавлено: 2011-02-18 15:49:40
andryu
Для 1.3
Код: Выделить всё
usage: /usr/local/sbin/apachectl (start|stop|restart|fullstatus|status|graceful|configtest|help)
start - start httpd
startssl - start httpd with SSL enabled
stop - stop httpd
restart - restart httpd if running by sending a SIGHUP or start if
not running
fullstatus - dump a full status screen; requires lynx and mod_status enabled
status - dump a short status screen; requires lynx and mod_status enabled
graceful - do a graceful restart by sending a SIGUSR1 or start if not running
configtest - do a configuration syntax test
help - this screen
Для apache-itk у меня выдало
Код: Выделить всё
apachectl -t -D DUMP_MODULES
Loaded Modules:
core_module (static)
mpm_itk_module (static)
http_module (static)
so_module (static)
authn_file_module (shared)
authn_dbm_module (shared)
authn_anon_module (shared)
authn_default_module (shared)
authn_alias_module (shared)
authz_host_module (shared)
authz_groupfile_module (shared)
authz_user_module (shared)
authz_dbm_module (shared)
authz_owner_module (shared)
authz_default_module (shared)
auth_basic_module (shared)
auth_digest_module (shared)
file_cache_module (shared)
cache_module (shared)
disk_cache_module (shared)
dumpio_module (shared)
reqtimeout_module (shared)
include_module (shared)
filter_module (shared)
charset_lite_module (shared)
deflate_module (shared)
log_config_module (shared)
logio_module (shared)
env_module (shared)
mime_magic_module (shared)
cern_meta_module (shared)
expires_module (shared)
headers_module (shared)
usertrack_module (shared)
setenvif_module (shared)
version_module (shared)
ssl_module (shared)
mime_module (shared)
dav_module (shared)
status_module (shared)
autoindex_module (shared)
asis_module (shared)
info_module (shared)
suexec_module (shared)
cgi_module (shared)
dav_fs_module (shared)
vhost_alias_module (shared)
negotiation_module (shared)
dir_module (shared)
imagemap_module (shared)
actions_module (shared)
speling_module (shared)
userdir_module (shared)
alias_module (shared)
rewrite_module (shared)
php5_module (shared)
rpaf_module (shared)
ispmgr_module (shared)
Syntax OK
Код: Выделить всё
apachectl -L
<Directory (core.c)
Container for directives affecting resources located in the specified directories
Allowed in *.conf only outside <Directory>, <Files> or <Location>
<Location (core.c)
Container for directives affecting resources accessed through the specified URL paths
Allowed in *.conf only outside <Directory>, <Files> or <Location>
<VirtualHost (core.c)
Container to map directives to a particular virtual host, takes one or more host addresses
Allowed in *.conf only outside <Directory>, <Files> or <Location>
<Files (core.c)
Container for directives affecting files matching specified patterns
Allowed in *.conf anywhere and in .htaccess
when AllowOverride isn't None
<Limit (core.c)
Container for authentication directives when accessed using specified HTTP methods
Allowed in *.conf anywhere and in .htaccess
when AllowOverride isn't None
<LimitExcept (core.c)
Container for authentication directives to be applied when any HTTP method other than those specified is used to access the resource
Allowed in *.conf anywhere and in .htaccess
when AllowOverride isn't None
<IfModule (core.c)
Container for directives based on existance of specified modules
Allowed in *.conf anywhere and in .htaccess
when AllowOverride isn't None
<IfDefine (core.c)
Container for directives based on existance of command line defines
Allowed in *.conf anywhere and in .htaccess
when AllowOverride isn't None
<DirectoryMatch (core.c)
Container for directives affecting resources located in the specified directories
Allowed in *.conf only outside <Directory>, <Files> or <Location>
<LocationMatch (core.c)
Container for directives affecting resources accessed through the specified URL paths
Allowed in *.conf only outside <Directory>, <Files> or <Location>
<FilesMatch (core.c)
Container for directives affecting files matching specified patterns
Allowed in *.conf anywhere and in .htaccess
when AllowOverride isn't None
AuthType (core.c)
An HTTP authorization type (e.g., "Basic")
Allowed in *.conf only inside <Directory>, <Files> or <Location> and in .htaccess
when AllowOverride includes AuthConfig
AuthName (core.c)
The authentication realm (e.g. "Members Only")
Allowed in *.conf only inside <Directory>, <Files> or <Location> and in .htaccess
when AllowOverride includes AuthConfig
Require (core.c)
Selects which authenticated users or groups may access a protected space
Allowed in *.conf only inside <Directory>, <Files> or <Location> and in .htaccess
when AllowOverride includes AuthConfig
Satisfy (core.c)
access policy if both allow and require used ('all' or 'any')
Allowed in *.conf only inside <Directory>, <Files> or <Location> and in .htaccess
when AllowOverride includes AuthConfig
AddDefaultCharset (core.c)
The name of the default charset to add to any Content-Type without one or 'Off' to disable
Allowed in *.conf anywhere and in .htaccess
when AllowOverride includes FileInfo
AcceptPathInfo (core.c)
Set to on or off for PATH_INFO to be accepted by handlers, or default for the per-handler preference
Allowed in *.conf anywhere and in .htaccess
when AllowOverride includes FileInfo
AccessFileName (core.c)
Name(s) of per-directory config files (default: .htaccess)
Allowed in *.conf only outside <Directory>, <Files> or <Location>
DocumentRoot (core.c)
Root directory of the document tree
Allowed in *.conf only outside <Directory>, <Files> or <Location>
ErrorDocument (core.c)
Change responses for HTTP errors
Allowed in *.conf anywhere and in .htaccess
when AllowOverride includes FileInfo
AllowOverride (core.c)
Controls what groups of directives can be configured by per-directory config files
Allowed in *.conf only inside <Directory>, <Files> or <Location>
Options (core.c)
Set a number of attributes for a given directory
Allowed in *.conf anywhere and in .htaccess
when AllowOverride includes Options
DefaultType (core.c)
the default MIME type for untypable files
Allowed in *.conf anywhere and in .htaccess
when AllowOverride includes FileInfo
FileETag (core.c)
Specify components used to construct a file's ETag
Allowed in *.conf anywhere and in .htaccess
when AllowOverride includes FileInfo
EnableMMAP (core.c)
Controls whether memory-mapping may be used to read files
Allowed in *.conf anywhere and in .htaccess
when AllowOverride includes FileInfo
EnableSendfile (core.c)
Controls whether sendfile may be used to transmit files
Allowed in *.conf anywhere and in .htaccess
when AllowOverride includes FileInfo
Protocol (core.c)
Set the Protocol for httpd to use.
Allowed in *.conf only outside <Directory>, <Files> or <Location>
AcceptFilter (core.c)
Set the Accept Filter to use for a protocol
Allowed in *.conf only outside <Directory>, <Files> or <Location>
Port (core.c)
Port was replaced with Listen in Apache 2.0
Allowed in *.conf only outside <Directory>, <Files> or <Location>
HostnameLookups (core.c)
"on" to enable, "off" to disable reverse DNS lookups, or "double" to enable double-reverse DNS lookups
Allowed in *.conf anywhere
ServerAdmin (core.c)
The email address of the server administrator
Allowed in *.conf only outside <Directory>, <Files> or <Location>
ServerName (core.c)
The hostname and port of the server
Allowed in *.conf only outside <Directory>, <Files> or <Location>
ServerSignature (core.c)
En-/disable server signature (on|off|email)
Allowed in *.conf anywhere and in .htaccess
when AllowOverride isn't None
ServerRoot (core.c)
Common directory of server-related files (logs, confs, etc.)
Allowed in *.conf only outside <Directory>, <Files> or <Location>
ErrorLog (core.c)
The filename of the error log
Allowed in *.conf only outside <Directory>, <Files> or <Location>
ServerAlias (core.c)
A name or names alternately used to access the server
Allowed in *.conf only outside <Directory>, <Files> or <Location>
ServerPath (core.c)
The pathname the server can be reached at
Allowed in *.conf only outside <Directory>, <Files> or <Location>
Timeout (core.c)
Timeout duration (sec)
Allowed in *.conf only outside <Directory>, <Files> or <Location>
ContentDigest (core.c)
whether or not to send a Content-MD5 header with each request
Allowed in *.conf anywhere and in .htaccess
when AllowOverride includes Options
UseCanonicalName (core.c)
How to work out the ServerName : Port when constructing URLs
Allowed in *.conf anywhere
UseCanonicalPhysicalPort (core.c)
Whether to use the physical Port when constructing URLs
Allowed in *.conf anywhere
Include (core.c)
Name of the config file to be included
Allowed in *.conf anywhere
LogLevel (core.c)
Level of verbosity in error logging
Allowed in *.conf only outside <Directory>, <Files> or <Location>
NameVirtualHost (core.c)
A numeric IP address:port, or the name of a host
Allowed in *.conf only outside <Directory>, <Files> or <Location>
ServerTokens (core.c)
Determine tokens displayed in the Server: header - Min(imal), OS or Full
Allowed in *.conf only outside <Directory>, <Files> or <Location>
LimitRequestLine (core.c)
Limit on maximum size of an HTTP request line
Allowed in *.conf only outside <Directory>, <Files> or <Location>
LimitRequestFieldsize (core.c)
Limit on maximum size of an HTTP request header field
Allowed in *.conf only outside <Directory>, <Files> or <Location>
LimitRequestFields (core.c)
Limit (0 = unlimited) on max number of header fields in a request message
Allowed in *.conf only outside <Directory>, <Files> or <Location>
LimitRequestBody (core.c)
Limit (in bytes) on maximum size of request message body
Allowed in *.conf anywhere and in .htaccess
when AllowOverride isn't None
LimitXMLRequestBody (core.c)
Limit (in bytes) on maximum size of an XML-based request body
Allowed in *.conf anywhere and in .htaccess
when AllowOverride isn't None
RLimitCPU (core.c)
Soft/hard limits for max CPU usage in seconds
Allowed in *.conf anywhere and in .htaccess
when AllowOverride isn't None
RLimitMEM (core.c)
Soft/hard limits for max memory usage per process
Allowed in *.conf anywhere and in .htaccess
when AllowOverride isn't None
RLimitNPROC (core.c)
soft/hard limits for max number of processes per uid
Allowed in *.conf anywhere and in .htaccess
when AllowOverride isn't None
LimitInternalRecursion (core.c)
maximum recursion depth of internal redirects and subrequests
Allowed in *.conf only outside <Directory>, <Files> or <Location>
ForceType (core.c)
a mime type that overrides other configured type
Allowed in *.conf anywhere and in .htaccess
when AllowOverride includes FileInfo
SetHandler (core.c)
a handler name that overrides any other configured handler
Allowed in *.conf anywhere and in .htaccess
when AllowOverride includes FileInfo
SetOutputFilter (core.c)
filter (or ; delimited list of filters) to be run on the request content
Allowed in *.conf anywhere and in .htaccess
when AllowOverride includes FileInfo
SetInputFilter (core.c)
filter (or ; delimited list of filters) to be run on the request body
Allowed in *.conf anywhere and in .htaccess
when AllowOverride includes FileInfo
AddOutputFilterByType (core.c)
output filter name followed by one or more content-types
Allowed in *.conf anywhere and in .htaccess
when AllowOverride includes FileInfo
AllowEncodedSlashes (core.c)
Allow URLs containing '/' encoded as '%2F'
Allowed in *.conf only outside <Directory>, <Files> or <Location>
PidFile (core.c)
A file for logging the server process ID
Allowed in *.conf only outside <Directory>, <Files> or <Location>
ScoreBoardFile (core.c)
A file for Apache to maintain runtime process management information
Allowed in *.conf only outside <Directory>, <Files> or <Location>
LockFile (core.c)
The lockfile used when Apache needs to lock the accept() call
Allowed in *.conf only outside <Directory>, <Files> or <Location>
MaxRequestsPerChild (core.c)
Maximum number of requests a particular child serves before dying.
Allowed in *.conf only outside <Directory>, <Files> or <Location>
CoreDumpDirectory (core.c)
The location of the directory Apache changes to before dumping core
Allowed in *.conf only outside <Directory>, <Files> or <Location>
AcceptMutex (core.c)
Valid accept mutexes for this platform and MPM are: default, flock, fcntl, sysvsem, posixsem.
Allowed in *.conf only outside <Directory>, <Files> or <Location>
MaxMemFree (core.c)
Maximum number of 1k blocks a particular childs allocator may hold.
Allowed in *.conf only outside <Directory>, <Files> or <Location>
TraceEnable (core.c)
'on' (default), 'off' or 'extended' to trace request body content
Allowed in *.conf only outside <Directory>, <Files> or <Location>
User (itk.c)
Effective user id for this server
Allowed in *.conf only outside <Directory>, <Files> or <Location>
Group (itk.c)
Effective group id for this server
Allowed in *.conf only outside <Directory>, <Files> or <Location>
ChrootDir (itk.c)
The directory to chroot(2) into
Allowed in *.conf only outside <Directory>, <Files> or <Location>
ListenBacklog (itk.c)
Maximum length of the queue of pending connections, as used by listen(2)
Allowed in *.conf only outside <Directory>, <Files> or <Location>
Listen (itk.c)
A port number or a numeric IP address and a port number, and an optional protocol
Allowed in *.conf only outside <Directory>, <Files> or <Location>
SendBufferSize (itk.c)
Send buffer size in bytes
Allowed in *.conf only outside <Directory>, <Files> or <Location>
ReceiveBufferSize (itk.c)
Receive buffer size in bytes
Allowed in *.conf only outside <Directory>, <Files> or <Location>
StartServers (itk.c)
Number of child processes launched at server startup
Allowed in *.conf only outside <Directory>, <Files> or <Location>
MinSpareServers (itk.c)
Minimum number of idle children, to handle request spikes
Allowed in *.conf only outside <Directory>, <Files> or <Location>
MaxSpareServers (itk.c)
Maximum number of idle children
Allowed in *.conf only outside <Directory>, <Files> or <Location>
MaxClients (itk.c)
Maximum number of children alive at the same time
Allowed in *.conf only outside <Directory>, <Files> or <Location>
ServerLimit (itk.c)
Maximum value of MaxClients for this run of Apache
Allowed in *.conf only outside <Directory>, <Files> or <Location>
AssignUserID (itk.c)
Tie a virtual host to a specific child process.
Allowed in *.conf anywhere
MaxClientsVHost (itk.c)
Maximum number of children alive at the same time for this virtual host.
Allowed in *.conf only outside <Directory>, <Files> or <Location>
NiceValue (itk.c)
Set nice value for the given vhost, from -20 (highest priority) to 19 (lowest priority).
Allowed in *.conf anywhere
GracefulShutdownTimeout (itk.c)
Maximum time in seconds to wait for child processes to complete transactions during shutdown
Allowed in *.conf only outside <Directory>, <Files> or <Location>
KeepAliveTimeout (http_core.c)
Keep-Alive timeout duration (sec)
Allowed in *.conf only outside <Directory>, <Files> or <Location>
MaxKeepAliveRequests (http_core.c)
Maximum number of Keep-Alive requests per connection, or 0 for infinite
Allowed in *.conf only outside <Directory>, <Files> or <Location>
KeepAlive (http_core.c)
Whether persistent connections should be On or Off
Allowed in *.conf only outside <Directory>, <Files> or <Location>
LoadModule (mod_so.c)
a module name and the name of a shared object file to load it from
Allowed in *.conf only outside <Directory>, <Files> or <Location>
LoadFile (mod_so.c)
shared object file or library to load into the server at runtime
Allowed in *.conf only outside <Directory>, <Files> or <Location>
Re: Хостинг. Ограничение кол-ва процессов для юзера
Добавлено: 2011-02-18 19:59:21
ADRE
Код: Выделить всё
RLimitCPU (core.c)
Soft/hard limits for max CPU usage in seconds
Allowed in *.conf anywhere and in .htaccess
when AllowOverride isn't None
RLimitMEM (core.c)
Soft/hard limits for max memory usage per process
Allowed in *.conf anywhere and in .htaccess
when AllowOverride isn't None
RLimitNPROC (core.c)
soft/hard limits for max number of processes per uid
Allowed in *.conf anywhere and in .htaccess
when AllowOverride isn't None
LimitInternalRecursion (core.c)
maximum recursion depth of internal redirects and subrequests
Allowed in *.conf only outside <Directory>, <Files> or <Location>
Re: Хостинг. Ограничение кол-ва процессов для юзера
Добавлено: 2011-02-18 20:09:40
andryu
Ну то что эти модули включены я не сомневался, иначе ошибки выскакивали бы при ключении лимитов для виртуалхостов. Но лимиты не работают, как я себе это представлял. Думаю это не победить, придётся воспользоваться последним советом Alex Keda

Re: Хостинг. Ограничение кол-ва процессов для юзера
Добавлено: 2011-02-19 18:22:27
ADRE
Может глубже капнуть? найти зависимость и пересобрать.
Re: Хостинг. Ограничение кол-ва процессов для юзера
Добавлено: 2011-03-21 20:03:54
Виктор
ADRE писал(а):Может глубже капнуть? найти зависимость и пересобрать.
Может хотя бы подскажите в какую сторону копать?
P.S. При этом, чтобы ограничения работали на mod_php
Re: Хостинг. Ограничение кол-ва процессов для юзера
Добавлено: 2011-04-05 17:43:26
ADRE
Виктор писал(а):ADRE писал(а):Может глубже капнуть? найти зависимость и пересобрать.
Может хотя бы подскажите в какую сторону копать?
P.S. При этом, чтобы ограничения работали на mod_php
стоп, так вы определитесь чем пользуетесь.
и соответственно уже рассматривать настройки от того что используете.