Page 1 of 1

Insufficient Memory Error with Next Supervisor

PostPosted: July 13th, 2012, 2:12 pm
by karenkazun
Hi, I apologize in advance because I don't really understand computer hardware, and may get some terms mixed up.

I'm running a process that is multi-threaded, where very large variables are sent to the different threads. I've been running this process for a couple months now on a machine with 4 processors and 8 GB of RAM. When I do this with 4 threads, my computer has no problem, and uses about 3.3 GB of RAM.

The process can take more than 3 hours to run with 4 threads, so we've been trying to experiment with our IT department to see if more computing power will speed up this process. We've been given a dedicated server with 16 processors and 16 GB of RAM to test this out. I've been trying different numbers of threads, and it never works with 16 threads. It sometimes works with 10, but other times, even though the size of the variables sent to the threads will be about the same, it will bomb citing not enough memory after as little as 5 threads are started. I'm not understanding why there is so much volatility in my testing, as no one else is using this server. When I've been running these tests, the most memory used by my computer before it crashes is about 4 GB, and CPU usage is around 50%.

I'm wondering if APL Next Supervisor is equipped to handle variables needing this much memory, or if anyone has any suggestions of what to check, or what needs to be improved? Again, I am new to this, and any help will be greatly appreciated.



Out of memory error

PostPosted: July 20th, 2012, 4:55 pm
by joe_blaze
Hi Karen,

Sorry for the delayed response.

It would be helpful if you could provide the exact text of the error message you are receiving.

FYI, the APLNext Supervisor is a C# program which queues up requests (including processId, wsId, fnname, rarg, larg) until they can be handled by APL+Win ActiveX server instances which it automatically spawns. The total memory available for this queue is limited by Windows constraints. I will check on the explicit limitations of this queue and report back.

It might be more productive to modify your control program to submit (using BeginCall) the processing requests in batches rather than all at once if you are not already doing so. This will avoid submitting many large data sets into the queue at one time which may be exhausting the memory available to the APLNext Supervisor queue. Your program could submit a few data sets (the number to be determined to avoid the out of memory error), then check the QueueSize and as it is diminished, submit more data sets, continuing in this fashion until all data sets have been processed. If your control program is written in APL+Win, be sure to include a []wgive 0 in strategic locations when submitting data sets and checking the QueueSize.

The APLNext Supervisor is a recently-developed feature, so we are very interested in learning more about your application for it and helping you improve your application's performance.

The volatility in the memory limitation is likely due to the variable time it takes for the spawned APL+Win ActiveX servers to complete processing of a specific request.

Joe Blaze

Re: Insufficient Memory Error with Next Supervisor

PostPosted: July 24th, 2012, 3:16 pm
by joe_blaze
Hi Karen,

Here is a good suggestion from Jairo Lopez which might help to minimize the memory limitation inherent in the 32-bit APL+Win program.

Since the data argument to your APL+Win kernel function is large, instead of passing the actual data to the BeginCall method of the Supervisor, put the data argument into an APL+Win component file and pass the BeginCall method the APL+Win component file component number. The APL+Win kernel function would need modification to get the input data from the specified file component.

This modification would mean that the Supervisor request queue would now have a much smaller memory footprint because it would contain file component number and not the actual large data arguments.

If the result of your APL+Win kernel function is also a large data object, you could consider analogous modifications to have the kernel function put its results into an APL+Win component file instead of passing them back directly through the Supervisor Completed Event. This would also reduce the memory footprint of the Supervisor queue.

Normally using a file in a multi-threaded application is avoided by design, but in this case considering that the memory size of the data argument is large and that each execution of the APL+Win kernel function performs significant work, the component file read/write time is probably not going to be significant. The benefit will be that you should be able to enable more Supervisor threads, thus reducing the overall processing time.

Joe Blaze

Re: Insufficient Memory Error with Next Supervisor

PostPosted: July 27th, 2012, 12:27 pm
by karenkazun
Hi Joe,

Thanks a lot for your help. I haven't had a chance to even look at this in the last 2 weeks. I'm hoping to try the second suggestion this afternoon, and I'll let you know how it goes.

The exact error message I'm having with too many threads is:

Error: ¯1 Insufficient memory to continue the execution of the program. at APLW.WSEngineClass.Call(String FunctionName, Object Argument, Object LeftArgument)

at APLNext.APLProcessInfo.APLProcess()

Thanks again,