本文介绍了如何使MCR启动时间快的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将我的MATLAB程序转换成.NET程序集,即一个dll文件。我做了一个控制台C#应用程序中添加DLL文件,并从PHP的说法。 MCR就被称为每次.exe文件被调用。我怎样才能让MCR初始化在启动服务器,而不是关闭每次即使exe文件被调用后,在一定的时间?如果有任何其他的方法,使这个过程快请建议。

I converted my matlab program into a .net assembly i.e a dll file. I have made a console C# application adding the dll file and called it from php. The MCR is called everytime the .exe is called. How can I make the MCR to initialize on the starting up of server and not closing everytime even if the exe is called after a certain time??And if there are any other methods to make this process fast please suggest.

推荐答案

不是一大堆,你可以直接在这里做。该MCR架构具有较高的启动成本;这不是伟大的反复所谓的短期运行的程序。

Not a whole lot you can do here directly. The MCR architecture has a high startup cost; it's not great for repeatedly-called short running programs.

您可以让它更快:

  • 确保将MCR在本地安装在每台机器上的运行它
  • pre-扩大CTF存档已编译的Matlab程序
  • 在每台机器上本地部署已编译的程序在运行它
  • 在购买固态硬盘
  • 定期做你的程序的虚在后台运行,以确保它的文件留在了磁盘缓存温暖。

但这些可能不会让您超快速;几乎可以肯定的速度不够快合理的页面加载时间。

But these probably won't get you super fast; almost certainly not fast enough for reasonable page load times.

要真正得到它快,你可能需要你的程序架构更改为客户机/服务器之一,在那里你火了一个持久的服务器进程,有你的MCR code运行它,和它服务请求您PHP客户端。你需要做额外的编码,以确保请求的方式中的一个干净的环境。

To really get it fast, you may need to change your program architecture to a client/server one, where you fire up a persistent server process that has your MCR code running in it, and it serves requests to your PHP clients. You'll need to do additional coding to make sure the requests are serviced in a "clean" context.

您也可以加载DLL MCR到你的Web服务器,因此整个服务器生命周期仍然存在。这将是一个简单的设置,但你可以通过单线程Matlab的会议上受到限制,就必须处理得到一个干净的起点,为每个请求。

You could also load the MCR dll into your web server so it persists across the server lifetime. This would be a simpler setup, but you might be limited by the single-threaded Matlab session, and would have to deal with getting a clean starting point for each request.

The MathWorks公司的解决方案,这是新的 Matlab的生产服务器,可装载编译MCR code到一个工作池,服务客户M- code,从暖机$ P $请求ploaded Matlab的工人情况。它完全解决了这个问题,MCR应用程序。这还是一个DIY的客户机/服务器方式的关键是前的客户端请求发生在旋的MCR code在Matlab会议的,让你的客户永远看高MCR启动成本。

The MathWorks solution to this is the new Matlab Production Server, which can load up compiled MCR code in to a worker pool and service client M-code requests from warmed-up preloaded Matlab worker instances. It addresses exactly this problem with MCR apps. The point of this or a DIY client/server approach is to "spin up" your MCR code in Matlab sessions before the client requests happen, so your clients never see the high MCR startup costs.

编辑:有一个关于部署MCR组件到网络时, MATLAB应用程序部署的Web举例整体MathWorks的指南指南,这并不只使用Matlab的生产服务器。看起来,他们大多是说去客户机/服务器,但你也可以直接在Web服务器低负荷水平加载你的MCR组成部分。

There's a whole MathWorks guide on deploying MCR components to the web, the MATLAB Application Deployment Web Example Guide, that doesn't use just the Matlab Production Server. Looks like they mostly say to go client/server, but you can also load up your MCR component directly in the web server for low load levels.

这篇关于如何使MCR启动时间快的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-15 22:51