0

Is there a way to set a limit on the RAM usage (virtual and resident) that a daemon can be granted in Debian? I understand that ulimit doesn't apply here, but something the right settings in /etc/security/limits.conf may be the answer.

I'm preferably looking for a concrete example. Say, limit virtual to 30MB and resident to 10MB for BIND (whether this is actually a bad idea or not). This setting should be enforced on the RAM used by all processes spawned by that daemon.

kubanczyk
  • 13,812
  • 5
  • 41
  • 55
ezequiel-garzon
  • 577
  • 2
  • 7
  • 16

2 Answers2

2

You can limit the maximum memory used by a program, but if the program want more memory, most of them just abort/crash/whatever.

So you have to configure bind to limit its memory usage.
The main option is max-cache-size (look at bind's configuration file, generaly into /etc/bind/named.conf). For example max-cache-size 10M
Don't use datasize if you don't really know what you do.

Gregory MOUSSAT
  • 1,673
  • 2
  • 25
  • 50
1

You wouldn't want to. Virtual memory isn't a scarce resource, so limiting it makes no sense. And limiting a program's resident memory just slows the whole system to a crawl because it makes it need more I/O.

David Schwartz
  • 31,449
  • 2
  • 55
  • 84