1. ## Scheduled task slow speed

I run a number of maintenance tasks overnight. This is the first time I have had a slow speed issue.

This job should run about 1 hour. If I start it from the database script or from a .bat file that runs the script, the run time is consistently about an hour. However, if the bat file is run as a scheduled task, then mostly it will take 3-8 hours. With no other users in the system I can run the bat file in 1 hour and then fire off the bat file from the scheduled task window and it takes 5 hours.

I have set the task to run
F:\Data\scheduled_sumtables.bat
and
C:\Windows\System32\cmd.exe /C F:\Data\scheduled_sumtables.bat

with similar long results.

Just today I noticed in Windows task manager that the scheduled task has allocated les RAM than when I run directly from the bat file. Of course the RAM allocated is dynamic so maybe I am just seeing it when it is low, but at 10 MB it is significantly below the ~ 70 MB when the bat is run directly.

The recent thread mentioning powershell gives me the idea to try that, but any other thoughts on what might make a scheduled task run slower?

Bill.

2. ## Re: Scheduled task slow speed

What OpSys version Bill?

3. ## Re: Scheduled task slow speed

If it's Win10, most likely the update process is hogging the resources.

4. ## Re: Scheduled task slow speed

The scheduled task is running on Server 2008 R2.

The slowness is in summarize operations, e.g. summarize.run_silent("my operation", vFilter) As each operation runs I can watch the file update time in Windows explorer. These operations are taking 30-60 minutes when it is more logical for them to be just a few minutes.

Bill.

5. ## Re: Scheduled task slow speed

Could then be a corrupt index, I presume you rebuild regularly.
Or a corrupt record.

6. ## Re: Scheduled task slow speed

Bill

Pretty strange.

Does task scheduler run as a different user?

Are some tables open by other processes when the scheduled task runs.

7. ## Re: Scheduled task slow speed

Ted,

Indexes rebuild just before this task. and in one test I ran it manually in an hour, then ran it again through the task - taking 5 hours.

Hi Al, same user is defined for the task. No other users should be active, and confirmed none were active during these tests. I am going to see some powershell guys this weekend, so I'll have me set that up. Meantime I will get better stats on RAM and cpu usage for tonight's run.

Bill.

8. ## Re: Scheduled task slow speed

If these are Alpha routines, can you run them from a script? I'm thinking that an OnDatabaseClose routine might help - then you could use the task scheduler to just close Alpha...and then Alpha would control the process.

9. ## Re: Scheduled task slow speed

Originally Posted by MoGrace
If these are Alpha routines, can you run them from a script? I'm thinking that an OnDatabaseClose routine might help - then you could use the task scheduler to just close Alpha...and then Alpha would control the process.
The way I prefer is to create an Alpha generated shortcut that you put in xbasic to run when task scheduler runs.
navigate - desktop control panel - tools - create shortcut
You get a <your-named>.startup file that contains the xbasic code that is run.

The command line and start in of the shortcut gives the startup that task scheduler needs.

I use all functions that call functions within this routine rather than scripts to get the tightest control possible.

the last call is to a5.close()

10. ## Re: Scheduled task slow speed

My method is similar to Al's, but I use the startup command's ability to close Alpha. So the bat file looks like this
Code:
"C:\Program Files (x86)\a5v11 Runtime\alpha5.exe" "F:\Data\Utilities\sumtables.adb" -INCLUDE="scheduled_sumtables.startup"
and the startup file looks like this
Code:
-TITLE="Windows scheduled task - Sumtables U1"
-NOSPLASH
-ExecuteAndExit
-COMMAND="script_play(\"rpt_sumtables\")"
The script just calls a function of the same name. Al, you are saying you do -COMMAND="rpt_sumtables()"? I would prefer that, but it sticks in my mind that was not possible in the early days and I have just stuck with the same pattern.

Bill.

11. ## Re: Scheduled task slow speed

Originally Posted by Bill Parker
The script just calls a function of the same name. Al, you are saying you do -COMMAND="rpt_sumtables()"?
Bill.
Yes

Is the -ExecuteAndExit option a newer one? I don't recall that one. Must be CRS.

12. ## Re: Scheduled task slow speed

Now that you ask... I "know" that I found it in the runtimedocumentation.pdf, but I don't see it there in recent versions. Maybe I saw it somewhere else. Don't you just love the serendipity of Alpha's documentation!

Bill.

13. ## Re: Scheduled task slow speed

Hi
Originally Posted by Bill Parker
Now that you ask... I "know" that I found it in the runtimedocumentation.pdf, but I don't see it there in recent versions. Maybe I saw it somewhere else. Don't you just love the serendipity of Alpha's documentation!

Bill.
No doubt.

14. ## Re: Scheduled task slow speed

Found it. Do a full text search in v11 help for "executeandexit".

15. ## Re: Scheduled task slow speed

I found it in the Wiki Starting Alpha Anywhere With Command Line Options

Another thought...
If your F: path is a mapped drive to the server, maybe using the fully qualified '\\servername\datapath\batchfile' format would work better?

16. ## Re: Scheduled task slow speed

I am running on the server, so I could have said D:\Alpha\Data\... But it is helpful to map a drive letter on the server the same as user workstations have. That way the context is always identical regardless of where something is run. For example, scheduled task could be run from a workstation or the server.

When looking at the command line options again, I am going to add NoDebug, and NoDBCheck to see if they make any difference.

Bill.

17. ## Re: Scheduled task slow speed

Solved. What worked is changing the priority of the scheduled tasks. That can't be done from the GUI, so export the task, modify the XML and re-import the task. Scheduled tasks default to "below normal" priority. I changed this to "normal" priority. Look at this article.

Bill.

18. ## Re: Scheduled task slow speed

Originally Posted by Bill Parker
Solved. What worked is changing the priority of the scheduled tasks. That can't be done from the GUI, so export the task, modify the XML and re-import the task. Scheduled tasks default to "below normal" priority. I changed this to "normal" priority. Look at this article.

Bill.
Good tip. Probably best not to run with the highest privileges. Too many OS conflicts.

19. ## Re: Scheduled task slow speed

Yes. If you are running with highest priority then your task is higher than the one that would allocate resources to you - catch 22. I tried 6, but ended up at 4. 4-6 is "normal".

Bill.

20. ## Re: Scheduled task slow speed

We run several scheduled tasks overnight using windows task scheduler, and in our experience, the speed is extremely fast. We don't run any sort of .bat files, we just run alpha5 with command line options to open up a database that has all the tables needed and an autoexec that runs all the appropriate posts, updates, packs, etc.

There really is NO Need to add another level of execution by creating a .bat file to run the alpha program.

We had been running server 8, but we recently upgraded servers and are now using server 12 r2.

Tom

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•