Blake Senftner Posted April 23, 2012 Report Share Posted April 23, 2012 Background: I'm tuning a UniServer hosted WebApp and WebAPI, running on Windows Server 2008 R2. Via the Task Manager, I experimented with setting the process priority for apache, mysql & php-cgi to "Above Normal" and saw complex processing task execution times reduce by 30%. This is quite significant. I have successfully rewritten php logic in my WebApp where it launches separate "worker" executables to launch it's WebApp processes at high priority:pclose(popen('start /B /HIGH '.$cmd, 'r' )); // $cmd is the command line to launch my worker exeAdditionally, I've tried the following "Windows PowerShell" script to modify the running apache, mysql & php-cgi processes:get-process -processname httpd1 | foreach { $_.PriorityClass = "AboveNormal" }get-process -processname mysqld1 | foreach { $_.PriorityClass = "AboveNormal" }get-process -processname php-cgi | foreach { $_.PriorityClass = "AboveNormal" }This Windows PowerShell script works, but only when executed interactively. I tried executing this from within the WebApp, but it silently does nothing. I took a brief look at the UniServer's "start_as_service.exe" -> "About", and that seems to indicate the "start_as_service.exe" is written in VBA. So, perhaps a variant of this logic could be inserted or added to enable the UniServer's key executables to run with enhanced priority? /* only an example, uniServer version would be affect apache, mysql & php-cgi, with uniServer-admin specified priorities */ Private Sub ProcessIdle() Dim psList() As Process If Process.GetProcessesByName("hl").Length = 0 Then Me.Text = "Waiting for hl.exe" Else Try psList = Process.GetProcesses() For Each p As Process In psList If p.ProcessName = "hl.exe" Then p.PriorityClass = ProcessPriorityClass.Idle End If Next p Catch End Try End If End Sub Thanks for any attention to this you can provide. And double thanks for the UniServer's existence! Quote Link to comment Share on other sites More sharing options...
Yoni Posted April 23, 2012 Report Share Posted April 23, 2012 It could be a welcome extra... Alternatively, I use ProcessExplorer to change processes priority. Of course it could be a hassle for development since changing process priority every time your you restart a service is not really practical. In a production environment I don't see it as a big deal though. Quote <p class="bbc_center"><span style="font-size:12px;"><strong>Yoni</strong></span></p> Link to comment Share on other sites More sharing options...
traxxus Posted April 24, 2012 Report Share Posted April 24, 2012 I have tested this too. The effort is not measurable imo. You can use the freeware "Prio - Process Priority Saver"It saves the priority you choose in the windows taskmanager. http://www.prnwatch.com/prio.html Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.