Engine opening time Spring v.10

Asked

Viewed 245 times

-1

Having puzzled the opening time of the V10 Spring engine in the extensibility solutions we developed (6 to 10 seconds, depending on the machine), I performed a debug log where I detected that by invoking the engine opening, the "solve" of the Spring libraries loads, if not all, almost all libraries available in the application’s "Apl" folder during engine opening.

In the V9, at the opening of the engine, only 2 (the necessary ones) were loaded: Interop.Erpbs900 and Interop.Stdbe900.

Below I let the opening code of the engine and the resolve:

var stdBeTrans = new StdPlatBS100.StdPlatBS();
erpAdminEngine = new ErpBS100.ErpBS();
erpAdminEngine.AbrePRIEMPRE((Interop.StdBE900.EnumTipoPlataforma)ErpAPI.ErpPlatformType, ErpAPI.ErpUser, ErpAPI.ErpUserPassword, stdBeTrans, ErpAPI.ErpInstance);

...

private static System.Reflection.Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args)
{
     var assemblyName = new System.Reflection.AssemblyName(args.Name);
     var assemblyFullName =
           System.IO.Path.Combine(
                    System.IO.Path.Combine(Environment.GetFolderPath(SYSTEM_FILES_FOLDER),
                    ERP_FILES_FOLDER),
                    assemblyName.Name + ".dll");

     if (System.IO.File.Exists(assemblyFullName))
         return System.Reflection.Assembly.LoadFile(assemblyFullName);
     else
         return null;
}

EDIT: For those interested, after some research I finally realized, and learn, that the loading of the dependencies via Reflection with Assembly.LoadFile scans the library and loads all its dependencies into the AppDomain before they were necessary. As in Spring v.10 I do not believe there is need to load libraries with the same identity of different paths, the big difference to the alternative, the solution is to use Assembly.LoadFrom. This change reduces the time taken by "Resolve" without compromising integration.

Having said that, just make the following substitution in the above code:

     if (System.IO.File.Exists(assemblyFullName))
         return System.Reflection.Assembly.LoadFrom(assemblyFullName);
         //return System.Reflection.Assembly.LoadFile(assemblyFullName);
     else
         return null;

Still, the time of the first engine opening is comparatively much higher than that of the spring v.9.

  • Make your edit turn an answer to your question. You can even answer it and mark as accepted.

1 answer

1

Hello,

It is not possible to make the comparison you refer to, since the Dlls in version 9 were COM and would never be "loaded" in the way you are observing.

The truth is that virtually all engine dlls are loaded when doing "New Erpbs", since this engine aggregates all the functionalities of all modules, both in version 9 and in version 10, but as the technology that has in version 10 is . NET, this resolve event will have MUCH more invocations, since the vb6 Dlls are "invisible" to this technology.

In version 9, only the "contact points" with the COM (or VB6) technology, i.e., the interops, as stated.

On the performance problems you mention, they need a more detailed analysis that you can request from the support of SPRING, however I leave only one suggestion:

  • Before making the Motorle.Abreempresatrabalho, if you have an open platform, associate it to the engine (Motorle.Platform = ...).

Avoid a new opening and save a few seconds.

  • Thank you for the reply.

  • I would add that the question of performance takes place both in my own and in the code of the Spring examples, with or without the platform opening before the engine opening. In the same Appdomain only happens in the first opening, not in the later ones. We have webservices for mobility solutions and in this context every time Apppool creates an Appdomain to respond to a request to the webservice the whole DLL upload process will occur. This means spending less than 1 second to 6 or more just to "solve". In other contexts it is a manageable question.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.