Jump to content
The Uniform Server Community

Feature Request: enable apache, mysql & php-cgi to be executed with enhanced process priority


 Share

Recommended Posts

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 exe

Additionally, 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!

Link to comment
Share on other sites

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.

<p class="bbc_center"><span style="font-size:12px;"><strong>Yoni</strong></span></p>

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...