0

I'm using xinetd for Firebird Server.

Is there a way to start fb_inet_server process with negative nice? When I type "-20" in xinetd.conf it's skipped by xinetd. I looked in xinetd sourcecode and parameter "nice" is unsigned integer so I could not provide "-20" there. :/

Is there a workaround for it?

My config (Debian GNU/Linux 8):

    cps             = 1500 10
    instances       = UNLIMITED
    per_source      = UNLIMITED

    flags           = NODELAY KEEPALIVE NOLIBWRAP
    socket_type     = stream
    user            = firebird
    wait            = no

    disable         = no
    nice            = 1
    max_load        = 20
    rlimit_as       = UNLIMITED
    rlimit_files    = UNLIMITED
    rlimit_cpu      = UNLIMITED
    rlimit_data     = UNLIMITED
    rlimit_rss      = UNLIMITED
    rlimit_stack    = UNLIMITED

    server          = /opt/firebird/bin/fb_inet_server

2 Answers2

0

xinetd.conf states it's relying on nice(3) which in turn states:

A maximum nice value of 2*{NZERO}-1 and a minimum nice value of 0 shall be imposed by the system. Requests for values above or below these limits shall result in the nice value being set to the corresponding limit. Only a process with appropriate privileges can lower the nice value.

So regardless of whenever you will provide a negative value or not the result will always be positive. The effective nice value might be unsigned but the calculation to get it would support subtraction. You can perform a subtraction of unsigned values the results will just always be >= 0.

In addition lowering the nice value of a running application requires appropriate permissions.

Seth
  • 9,393
0

I got a workaround from a friend - could't find it on the Internet so I post this here.

To set nice -20 automatically on new fb_inet_server processes:

  1. Shutdown your database
  2. Stop xinetd
  3. Set nice = 0 in firebird xinetd config (/etc/xinetd.d/firebird)
  4. Perform renice -n -20 on xinetd process
  5. Make your database online

Every new fb_inet_server process is a subprocess of xinetd and it inherits xinetd's niceness.