1.7 5708 docload uses a lot of cpu to start

Here is command line output from docload running

 C:\TestRes>docload-r
C:\TestRes>echo 13:44:27.62
C:\OpenVPMS\Current-release\bin>call docload -v --byid --type act.patientInvesti
gation --source c:\TestRes\Results --dest c:\TestRes\Loaded
Starting load at: Tue Jan 14 13:44:47 CST 2014
Ending load at: Tue Jan 14 13:44:47 CST 2014
Loaded: 0
Errors: 0
Total:  0
Processed 0 files in 0.00 seconds (0.00 files/sec)
13:44:47.46
C:\OpenVPMS\Current-release\bin> 

Here is a snippet of CPU use.  The two blocks circled are docload running using some 30% of the CPU. The other two spikes on the first block are other people doing transactions. You can see from the log that the total run time is 13:44:27 to 13:44:47 = 20 seconds, but you can see from docloads 'Starting/Ending load' times that it used no time to do the load - unsurprising as the input folder is empty. However it took from 13:44:27 to 13:44:47 (when it printed the 'Starting' message) to initialise itself.

I knew about this problem when I set up the sheduled running of docload. However, I minimised it by adjusting the schedule to 30 minutes.

Now that real results are being loaded, I have been asked to decrease the run interval to 10 minutes.

Can we consider altering docload so that it is capable of scheduling itself, ie it has a -i nn start argument that means 'do your stuff, then go to sleep for nn minutes and repeat'.  This way we would waste no time on initialisation on each check of the source directory.

For the moment, I will see what I can do to write some DOS commands to check if the folder contains new files.

Regards, Tim G

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Re: 1.7 5708 docload uses a lot of cpu to start

The following script does the trick for Windows:

 @echo off
echo %time%

for /F %%i in ('dir /b "c:\TestRes\Results\*.*"') do (
   rem echo Folder is NON empty
   goto DOLOAD
)
rem echo Folder is empty or does not exist
echo %time%
goto :EOF

:DOLOAD
cd \openvpms\current-release\bin
call docload -v --byid --type act.patientInvestigation --source c:\TestRes\Results --dest c:\TestRes\Loaded

move c:\TestRes\Results\*.* c:\TestRes\NotLoaded

echo %time% 

It runs docload only when the Results folder contains files, and moves any files remaining after docload runs to  the NotLoaded folder.

Conclusion: with this sort of processing, the improvement of docload is far less critical.  I have now switch this results processing to run every 5 minutes.

Regards, Tim G

Re: 1.7 5708 docload uses a lot of cpu to start

Another solution would be to integrate docload into the web app.

I've set up a project here: http://www.openvpms.org/project/integrate-docload

-Tim A

Syndicate content