Consultor Eletrônico



Kbase 21977: New HP Setting, SCHED_NOAGE, Might Reduce CPU Bottlenecks
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   10/05/2002
SUMMARY:

SCHED_NOAGE is a new HP policy which can increase performance on machines where CPU bottlenecks are occurring.

It is recommended that all Progress processes, broker, servers, self-service clients, and pagewriters should have SCHED_NOAGE applied to them.

EXPLANATON:

Priority inversion is a situation in which a lower-priority process interrupts or blocks a higher-priority process from running. The HP policy SCHED_NOAGE prevents a process from having its priority degrade over time as the process is running. This policy has been successful in almost eliminating priority inversions against database applications, Java and multi-threaded programs that use mutexes or spinlocks.

Reduction or elimination of these priority inversions can increase performance.

SOLUTION:

A database experiencing one or both of these symptoms might benefit from setting 'SCHED_NOAGE'.

Symptoms:

-- TXE locks are being held by processes for more than a fraction of
a second.

-- Very high -spin settings are being required in order to reduce
latch timeouts.

To set the SCHED_NOAGE policy do the following:

1) Check your version. HP/UX 11.11 and higher already has
SCHED_NOAGE. Earlier versions of HP/UX might require additional
OS patches. Please check with your OS vendor for additional
assistance in determining if your OS requires a patch.

2) Compile the following source code.

Source Code
--------------------------------------------------------------------
#include <stdio.h>
#include <sched.h>
#include <unistd.h>

#define SCHED_NOAGE 8

main (argc, argv)
int argc;
char *argv[];
{

int thispid;
pid_t pid;
struct sched_param schedparam, verifyparam;
struct sched_param *paramptr;

if (argc < 2) usage();

while (--argc > 0)
{
thispid=atoi(*++argv);

pid = (pid_t) thispid;
schedparam.sched_priority = -154;

/*
* Set the scheduling parameter, then tweak the scheduler
*/

if ( (sched_setparam(pid, &schedparam)) < 0 )
{
printf("Error on setparam for pid %d skipping...\n", pid);
perror("sched_setparam");
continue;
}

if ( (sched_setscheduler(pid, SCHED_NOAGE, &schedparam)) < 0 )
{
printf("Error on setscheduler for pid %d skipping...\n", pid);
perror("sched_setscheduler");
continue;
}

/*
* Verify that the process's policy and prio have been set
*/

sched_getparam(pid, &verifyparam);
printf("For pid %d, policy is set to %d with priority %d\n", pid,
sched_getscheduler(pid), verifyparam.sched_priority);

} /* while */

} /* main */

usage()
{

printf("usage: setprocess_noage <pid>\n");
printf("setprocess_noage exiting without doing anything \n");
exit(1);

}
---------------------------------------------------------------------

3) Processes run within the SCHED_NOAGE shell will not have their
priority changed while the process is running. Example:

$ sched_noage $$
$ proserve...

NOTE: All Progress processes can be 'SCHED_NOAGE'd after they
start by periodically running the program on the output of
'ps ax | grep {progress executables}'.