Re: lower cpu priority to perl scripts

This is a discussion on Re: lower cpu priority to perl scripts within the Apache forums in Application Servers & Tools category; If you are running on unix, the easiest way to probably do this is by calling the "setpriority" from within your perl script like this: setpriority(WHICH,WHO,PRIORITY); To set your current running perlscript to the lowestpriority, you would call setpriority(0, $$, 20); $$ is your script's process ID, and "20" denotes the priority. (as you know, -20 is highest priority and 20 the lowest priority). Cheers, ** R. ----- Original Message ---- From: Audio Phile <da_audiophile @ yahoo.com> To: users@httpd.apache.org Sent: Wednesday, August 27, 2008 2:18:53 PM Subject: Re: [users @ httpd] lower cpu priority to perl scripts Tamer, Thank you ...

Go Back   Application Development Forum > Application Servers & Tools > Apache

Object Mix

Register FAQ Calendar Search Today's Posts Mark Forums Read
  #1  
Old 08-27-2008, 06:12 PM
Richard de Vries
Guest
 
Default Re: lower cpu priority to perl scripts

If you are running on unix, the easiest way to probably do this is by calling the "setpriority" from within your perl script like this:
setpriority(WHICH,WHO,PRIORITY);
To set your current running perlscript to the lowestpriority, you would call setpriority(0, $$, 20);
$$ is your script's process ID, and "20" denotes the priority. (as you know, -20 is highest priority and 20 the lowest priority).
Cheers,
** R.

----- Original Message ----
From: Audio Phile <da_audiophile@yahoo.com>
To: users@httpd.apache.org
Sent: Wednesday, August 27, 2008 2:18:53 PM
Subject: Re: [users@httpd] lower cpu priority to perl scripts

Tamer,

Thank you very much for the reply.* I googled around for the proper syntax of your suggestion as well as which config file I need to edit with it, but I came up with a big fat 0.* Can you provide a few more details for me?* Apologies in advance, I am a newbie with apache2

Tamer Embaby wrote:
Audio,

You can always start your scripts with [re]nice() syscall to lower
your process (perl script in this case) priority.

Regards,
Tamer

-----Original Message-----
From: Audio Phile [mailto:da_audiophile@yahoo.com]
Sent: Tuesday, August 26, 2008 8:57 PM
To: users@httpd.apache.org
Subject: [users@httpd] lower cpu priority to perl scripts

I'd like to adjust the priority of /usr/bin/perl such that it will always runwith very low priority.* The PC that I'm using isn't very powerful.* I'm running rrdweather on it and when a user hits the weather.cgi about 10 processes of perl scripts run,
which totally throttles foreground applications until they finish.

How can I assign /usr/bin/perl to always run with a really low CPU priority (a really high nice value) for any script it executes? Is this an apache2 setting or...?


* * *

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe,e-mail: users-unsubscribe@httpd.apache.org
* "* from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org




---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Reply With Quote
  #2  
Old 08-27-2008, 06:31 PM
david
Guest
 
Default Re: lower cpu priority to perl scripts

Audio Phile:

Do you have a comparable example for ActiveState Perl on Windows?


At 03:12 PM 8/27/2008, you wrote:
>If you are running on unix, the easiest way to probably do this is
>by calling the "setpriority" from within your perl script like this:
>setpriority(WHICH,WHO,PRIORITY);
>To set your current running perlscript to the lowest priority, you
>would call setpriority(0, $$, 20);
>$$ is your script's process ID, and "20" denotes the priority. (as
>you know, -20 is highest priority and 20 the lowest priority).
>Cheers,
> R.
>
>----- Original Message ----
>From: Audio Phile <da_audiophile@yahoo.com>
>To: users@httpd.apache.org
>Sent: Wednesday, August 27, 2008 2:18:53 PM
>Subject: Re: [users@httpd] lower cpu priority to perl scripts
>
>Tamer,
>
>Thank you very much for the reply. I googled around for the proper
>syntax of your suggestion as well as which config file I need to
>edit with it, but I came up with a big fat 0. Can you provide a few
>more details for me? Apologies in advance, I am a newbie with apache2
>
>Tamer Embaby wrote:
>Audio,
>
>You can always start your scripts with [re]nice() syscall to lower
>your process (perl script in this case) priority.
>
>Regards,
>Tamer
>
>-----Original Message-----
>From: Audio Phile [mailto:da_audiophile@yahoo.com]
>Sent: Tuesday, August 26, 2008 8:57 PM
>To: users@httpd.apache.org
>Subject: [users@httpd] lower cpu priority to perl scripts
>
>I'd like to adjust the priority of /usr/bin/perl such that it will
>always run with very low priority. The PC that I'm using isn't very
>powerful. I'm running rrdweather on it and when a user hits the
>weather.cgi about 10 processes of perl scripts run,
>which totally throttles foreground applications until they finish.
>
>How can I assign /usr/bin/perl to always run with a really low CPU
>priority (a really high nice value) for any script it executes? Is
>this an apache2 setting or...?
>
>
>
>
>---------------------------------------------------------------------
>The official User-To-User support forum of the Apache HTTP Server Project.
>See <URL:http://httpd.apache.org/userslist.html> for more info.
>To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> " from the digest: users-digest-unsubscribe@httpd.apache.org
>For additional commands, e-mail: users-help@httpd.apache.org
>
>
>
>
>---------------------------------------------------------------------
>The official User-To-User support forum of the Apache HTTP Server Project.
>See <URL:http://httpd.apache.org/userslist.html> for more info.
>To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> " from the digest: users-digest-unsubscribe@httpd.apache.org
>For additional commands, e-mail: users-help@httpd.apache.org



---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Reply With Quote
Reply


Thread Tools
Display Modes


All times are GMT -5. The time now is 08:20 PM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
vB Ad Management by =RedTyger=

In an effort to better serve ads to our visitors, cookies are used on objectmix.com. For more information, check out our Privacy Policy.