MCR execution very slow on Windows 2012

1 view (last 30 days)
Gurpreet Singh
Gurpreet Singh on 2 Dec 2015
Edited: Gurpreet Singh on 7 Dec 2015
I have a Matlab function that I packaged using Compiler SDK (Java Builder) and invoking the java wrapped function via a REST web service. Script execution time is as follows:
Test Environment 1: Windows 7 Professional x64 (Physical Computer) RAM: 16 GB Execution time: 1 minute
Test Environment 2: Windows Server 12 R2 Standard x64 (Virtual Machine) RAM: 8 GB Execution time: 9+ minutes
I am using MCR runtime version 8.5 . I am not sure if any additional configurations are required on Windows 2012 server/VM to speed up the execution.

Answers (1)

Yuebin Zhou
Yuebin Zhou on 7 Dec 2015
1) First of all, MATLAB, as other software, on a virtual machine is definitely slower than the host machine. You can verify that by running the BENCH command on both host and virtual machine.
2) MATLAB and MCR is not guaranteed to perform well on virtual environments, especially in the case of external interface connectivity (like in this case a REST Web service). You can find more information on the following link: http://www.mathworks.com/matlabcentral/answers/96411
3) Your application uses web services. This might make the MATLAB application further slower if there is large amount of data transmission, since there are extra layers to cross in operating systems before each data fetch operation.
  1 Comment
Gurpreet Singh
Gurpreet Singh on 7 Dec 2015
Edited: Gurpreet Singh on 7 Dec 2015
Thanks Yuebin for the inputs.
Some further test details: I used the 'tic'-'toc' functionality to get the actual execution time of the script so that I can narrow down to specifics for troubleshooting. Following were the execution times on the machines with "toc" at different places in the execution workflow (script):
a. Development machine recorded time
  • Elapsed time is 0.057247 seconds.
  • Elapsed time is 0.604774 seconds.
  • Elapsed time is 39.256450 seconds.
  • Elapsed time is 39.258309 seconds.
  • Elapsed time is 39.263077 seconds.
  • Elapsed time is 42.843977 seconds.
  • Elapsed time is 61.574791 seconds.
  • Elapsed time is 61.576531 seconds.
b. Windows 2012 VM recorded time
  • Elapsed time is 0.288114 seconds.
  • Elapsed time is 2.523487 seconds.
  • Elapsed time is 347.202639 seconds.
  • Elapsed time is 347.208594 seconds.
  • Elapsed time is 347.233405 seconds.
  • Elapsed time is 389.359889 seconds.
  • Elapsed time is 558.057613 seconds.
  • Elapsed time is 558.062946 seconds.
Execution time for script seems to be approx 10x on the VM. My script uses certain functions like normrnd, mvnrnd and chol. So it has a dependency on Statistics and Machine Learning Toolbox. Not sure if this toolbox is causing the delay on the VM. I tested the same workflow (with web services) with a simple a+b=c function script and it executed lighting fast on the VM!

Sign in to comment.

Categories

Find more on Java Package Integration in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!