Setting memory consumption limits with Upstart

前端 未结 2 590
栀梦
栀梦 2021-02-01 06:31

I\'ve recently become quite fond of Upstart. Previously I\'ve been using God, Monit and Bluepill but I don\'t really like these solutions so I\'m giving Upstart a try.

I

2条回答
  •  不思量自难忘°
    2021-02-01 06:58

    From the Upstart docs, the limits come from the rlimit system call options. (http://upstart.ubuntu.com/cookbook/#limit)

    Since Linux 2.4+ setting the rss (Resident Set Size) has no effect.

    An alternative already suggested in other answers is as which sets the virtual memory Address Space size limits. This will have a very different effect of setting 'real' memory limits.

    limit as  
    

    Excerpt from man pages for setrlimit:

    RLIMIT_AS The maximum size of the process's virtual memory (address space) in bytes. This limit affects calls to brk(2), mmap(2), and mremap(2), which fail with the error ENOMEM upon exceeding this limit. Also automatic stack expansion will fail (and generate a SIGSEGV that kills the process if no alternate stack has been made available via sigaltstack(2)). Since the value is a long, on machines with a 32-bit long either this limit is at most 2 GiB, or this resource is unlimited.

提交回复
热议问题