Stuart Henderson <s...@spacehopper.org> writes:

Hello again,

after a bit of searching, I am not sure that the datasize limits imposed
in login.conf for the default class override the datasize for the daemon
class in case of named.
There is an extra restriction for cache size in BIND itself. From the
BIND sources in base I see

bin/named/server.c
   ...
   1137         result = ns_config_get(maps, "max-cache-size", &obj);
   1138         INSIST(result == ISC_R_SUCCESS);
   1139         if (cfg_obj_isstring(obj)) {
   1140                 str = cfg_obj_asstring(obj);
   1141                 INSIST(strcasecmp(str, "unlimited") == 0);
   1142                 max_cache_size = ISC_UINT32_MAX;
   1143         } else {
   1144                 isc_resourcevalue_t value;
   1145                 value = cfg_obj_asuint64(obj);
   1146                 if (value > ISC_UINT32_MAX) {
   1147                         cfg_obj_log(obj, ns_g_lctx, ISC_LOG_ERROR,
   1148                                     "'max-cache-size "
   1149                                     "%" ISC_PRINT_QUADFORMAT "d' is too 
large",
   1150                                     value);
   1151                         result = ISC_R_RANGE;
   1152                         goto cleanup;
   1153                 }
   1154                 max_cache_size = (isc_uint32_t)value;
   1155         }
   1156         dns_cache_setcachesize(cache, max_cache_size);
   ...

lib/isc/unix/include/isc/int.h:#define ISC_UINT32_MAX   4294967295U

So, unless I am mistaken there is a 4GB upper limit in BIND cache size
(which is something I also see in more recent versions of BIND eg 9.7.3
that comes with CentOS 6).

I use the following in login.conf:

# by kzorba for named limits
named:\
        :ignorenologin:\
        :datasize=infinity:\
        :maxproc=infinity:\
        :stacksize-cur=8M:\
        :localcipher=blowfish,8:\
        :vmemoryuse=infinity:\
        :openfiles-cur=512:

and restarted BIND through /etc/rc.d/named script. However, I still have
not managed to push the memory usage of named beyond 600M on OpenBSD (the
equivalent tests under Linux used 4.9g RSS size and ~5.5g VM size). The
default max-cache-size value in BIND is 'unlimited' which means 4GB from
what I saw in the sources (unless mistaken). If anyone has seen BIND 
under OpenBSD utilize memory in the order of GBs I would like to know.

The next steps will be to measure reqs/sec and also unbound in 5.1 since
it is now part of base. If you know of any stress test tool for DNS
queries feel free to share.

Regards,

Kostas      
  
>> >>
>> >> Does named has such a limit by default?
>> >
>> > OpenBSD has a limit by default, see login.conf(5). Daemons started
>> > when the system is booted or using /etc/rc.d scripts typically use
>> > the class 'daemon'.
>> >
>> 
>> I gathered that. However in login.conf:
>> 
>> daemon:\
>>         :ignorenologin:\
>>         :datasize=infinity:\
>>         ^^^^^^^^^^^^^^^^^^^^
>>         :maxproc=infinity:\
>>         :openfiles-cur=128:\
>>         :stacksize-cur=8M:\
>>         :localcipher=blowfish,8:\
>>         :tc=default:
>> 
>> Also ps(1) output seems to confirm that named process limit is the
>> entire memory of the machine.
>> 
>> root@openbsd: /var/named/tmp # ps -ax -v | head
>>   PID STAT       TIME  SL  RE PAGEIN   VSZ   RSS   LIM TSIZ %CPU %MEM COMMAND
>> 31077 S     277:43.57   0 127     15 608272 610340 8145988 1292 10.6  7.3 
>> /usr/sbin/named
>
> lim is "memory" not "datasize".
>
> Considering the amount of memory this process is actually using, it
> looks to me more like it's being run with a 512MB datasize limit,
> so perhaps it's not running under the expected 'daemon' class.
>
> BTW, under OpenBSD/amd64 the most the datasize for a single process
> can be without modifying the kernel is 8GB.
>

-- 
Kostas Zorbadelos               
twitter:@kzorbadelos            http://gr.linkedin.com/in/kzorba 
----------------------------------------------------------------------------
()  www.asciiribbon.org - against HTML e-mail & proprietary attachments
/\  

Reply via email to