Efficiently running once a week

Using (or providing) components based on the "Win32" framework

Efficiently running once a week

Postby MBaas on Tue Feb 16, 2016 7:43 pm

I have a client that wanted highly automated interfaces for his desktop-app.
So every monday we need to run some fns that process the various files from their ERP.

In the W2003-Environment I had set up a job in Task Scheduler which would run every Monday and do its stuff. Worked nicely, but stopped working after migration to W2012. I could not find out why :(
So then I setup an instance which continously runs (on a server) and waits for Monday, then checks for the presence of the various files, processes them and enters the waiting cycle again.
(Most of that was easily achievable with the tools I had developed before, so it was possible to implement this w/o much cost. Basically it all happens within the GUI of the standard desktop-client and in the waiting-cycle there are ⎕DLs and a seperate thread ⎕DQs an interrupt-button.)

Tested for several days on my desktop w/o noteable impact on performance I installed this on their W2012-Server over the wkend - and yesterday afternoon got the first complaints about poor performance of the server which they eplained was because of dyalog(rt).exe's utilization of 90%+. They claim that this is not a "taskmanager-only" utilization, but that the real performance of admin-interactions had been impacted. And also they do not like the idea that it all happens in the context of a user - IT-Guys want services! ;-)

So, dyalog can run as a service - but I wonder if that will resolve the CPU-Issue. Basically the thing will still ⎕DL for hours and then check if its Monday - it's only the ⎕DQ that we will get rid of. Or are there perhaps smarter ways to achieve this purpose in a more CPU-friendly way? Experiences...???
User avatar
MBaas
 
Posts: 156
Joined: Thu Oct 16, 2008 1:17 am
Location: Gründau / Germany

Re: Efficiently running once a week

Postby PGilbert on Tue Feb 16, 2016 8:15 pm

In our application we need to do some clean-up every Monday. So what we do is when the application start it will calculate how much time there is from now to the next Monday and setup an event that will time-out after that delay. Waiting on an event should not consume CPU time. After the function has run the first time it will setup the next event to wait on.

Hope this helps.
User avatar
PGilbert
 
Posts: 436
Joined: Sun Dec 13, 2009 8:46 pm
Location: Montréal, Québec, Canada

Re: Efficiently running once a week

Postby gil on Wed Feb 17, 2016 7:52 am

Dyalog's new service framework (A4S) works really well, we've tried it out and it was relatively easy to set up and install. At the same time it feels like overkill to install a service to perform a task on a regular basis.

In my experience, the occasions when the exe hogs all CPU available it has been related to a "bug" in the code that only makes an appearance in that special environment. Typically this is all related to access rights. Things to check:

When installing the task, do you set it up to run under a defined user account or do you use the Local system account or similar?
If you haven't tried yet, set it to run using a user account that you know it works in when you run the app in standard GUI mode.

Have you tried running the ws using the dyalogrt.exe (not using the task scheduler, just manually launching it)?

Does your code use .NET or OLE objects of any kind (Office automation for example)?
In some scenarios we had issues with these external libraries when running services, so it's something I keep in mind when debugging.
gil
 
Posts: 71
Joined: Mon Feb 15, 2010 12:42 am

Re: Efficiently running once a week

Postby MBaas on Wed Feb 17, 2016 8:41 am

Thanks for both of your replies which both give me stuff to chew on. I'll have telcon on Friday to discuss the "strategic political requirements", but meanwhile I'll check the external resources - there recently was a change which may impact that...
(And gil, yes, I ran it in std GUI mode for a local system user...)
User avatar
MBaas
 
Posts: 156
Joined: Thu Oct 16, 2008 1:17 am
Location: Gründau / Germany

Re: Efficiently running once a week

Postby AndyS|Dyalog on Wed Feb 17, 2016 4:20 pm

I wonder if using a Timer object might be a viable alternative .. the maximum value for Interval is ¯1+2*32 (49 days - who remembers the NT/95 uptime bug ?).

Setting the Interval to, say, 1 hour would allow you to have a callback that incorporated some form of heartbeat so that you could check that the process is still running ..
User avatar
AndyS|Dyalog
 
Posts: 257
Joined: Tue May 12, 2009 6:06 pm


Return to Windows: GUI, COM/OLE/ActiveX

Who is online

Users browsing this forum: No registered users and 1 guest