[Asterisk-Users] Changing NICE value for * will it help?

Colin Anderson ColinA at landmarkmasterbuilder.com
Thu Dec 9 12:41:38 MST 2004


>How to start asterisk with priority let say -5? 
>If I start the main process with higher priority will subprocesses
>receive the same NICE value?

Short answer, which I have learned, is don't NICE it. Use asterisk -p
instead

Long answer:

Reposting the well-reasoned answers to my related question 2 weeks ago,
thanks Peter S, Gilad Ben-Yossef, Joe Greco, and yes, even Mr. Critchfield:

On Thu, 25 Nov 2004, Colin Anderson wrote:

> I have 4 gig in my * box. I'm tuning for performance and I'd like to ask
> opinions:
> 
> 1. asterisk -p == renice -20 ?? 

[Peter S]

The -p option sets asterisk to realtime priority if possible. This is 
different from the traditional unix nice levels. A program with realtime 
priorities will _never_ be preempted by a normal program. A program with 
the traditional unix nicelevel of -20 will give up some time slots to 
lower priority programs.

This has advantages (scheduling of packets are much better e.g.) and 
disadvantages (a broken asterisk server will leave the system impossible 
to log in to). The disadvantage can be soften by keeping a shell open with 
realtime priority (higher) around.

Running with -p does help a lot for VoIP stuff.

Note that this is user-space (pseudo) realtime stuff. Lowlatency patches 
for the kernel can give better response time for the zaptel drivers as 
well. This is orthogonal.

[Gilad Ben-Yossef]

Colin Anderson wrote:
> I have 4 gig in my * box. I'm tuning for performance and I'd like to ask
> opinions:
> 
> 1. asterisk -p == renice -20 ?? 

What asterisk -p does is mark the aterisk process as a POSIX real time 
priority process. Unless you have other process marked in the same way, 
the scheduling algorithm will prefer this process to others at all 
times. which means that if is not blocking, it will be the running process.

I've been running like this with Asterisk for a couple of month with no 
ill effects except that some error conditions cal cause asterisk to go 
into a loop which will effectively freeze all user space activity on the 
machine. I keep a shell set to a higher real time priority then asterisk 
on the machine for these cases.

You can use the following tool to get a real time priority shell:

http://projects.codefidence.com/realtime.html

[Joe Greco]

> I have 4 gig in my * box. I'm tuning for performance and I'd like to ask
> opinions:
> 1. asterisk -p == renice -20 ?? 

Why?  If you have other things running on the machine, get a dedicated box
for Asterisk.  It might make sense to give it a mildly elevated priority,
but running it at -20 might cause problems if you needed to get in and
administer a runaway server.

[Peter Critchfield]

> 1. asterisk -p == renice -20 ?? 

Unless you have done something not very smart like putting a DB on your
asterisk machine, reniceing asterisk isn't going to give you more clock
cycles. 



More information about the asterisk-users mailing list