hello
I am having a problem with the initialization of my modules, its taking too long (10-15 seconds) to load, is it normal ?
here's the Log:
[DEBUG]-[2016-05-18 12:16:15,255] AbpModuleManager - Loading Pine modules... [DEBUG]-[2016-05-18 12:16:20,112] AbpModuleManager - Found 26 Pine modules in total.
The first 5 or more seconds is on this code :
var moduleTypes = AddMissingDependedModules(_moduleFinder.FindAll());
That goes to class WebAssemblyFinder to get all assemblies
List<Assembly> GetAllAssembliesInternal()
Then logs all my modules names
[DEBUG]-[2016-05-18 12:16:20,123] AbpModuleManager - 26 modules loaded.
But then more 7+ seconds until this part:
[DEBUG]-[2016-05-18 12:16:27,257] LocalizationManager - Initializing 2 localization sources.
That is on the PreInitialize, initialize and postInitialize methods for every module
var sortedModules = _modules.GetSortedModuleListByDependency();
sortedModules.ForEach(module => module.Instance.PreInitialize());
sortedModules.ForEach(module => module.Instance.Initialize());
sortedModules.ForEach(module => module.Instance.PostInitialize());
Is 26 too many modules ? or my configuration is wrong in some part ?
Thanks
3 Answer(s)
-
0
Well, I gained 2 seconds by adding this filter:
Class: WebAssemblyFinder - Method: GetAllAssembliesInternal
Before:
List<Assembly> allReferencedAssemblies = BuildManager.GetReferencedAssemblies().Cast<Assembly>().ToList();
After:
List<Assembly> allReferencedAssemblies = BuildManager.GetReferencedAssemblies().Cast<Assembly>().Where(a => !a.GlobalAssemblyCache).ToList();
How can I optimize more ? should I make it async ?
Thanks
-
0
The more third party libraries you have referenced, the more slow it gets. We had this extact problem and we did this quick hack in the class WebAssemblyFinder. It reads only Abp .dlls and our own .dlls which all starts by 'PMP' in our case. So if you can find a similar pattern to read only your app .dlls, you should gain a lot of speed.
// Filters out non-applicative dll to improve startup performance dllFiles = dllFiles.Where(x => Path.GetFileName(x).StartsWith("Abp", StringComparison.OrdinalIgnoreCase) || Path.GetFileName(x).StartsWith("PMP", StringComparison.OrdinalIgnoreCase)).ToList();
-
0
Hello
Tks GuillaumeMorin, that filter helped to reduce the time a lot, and with the GlobalAssemblyCache filter its now acceptable
Now I will see I can do something on the Modules PreInitialize, Initialize and PostInitialize, its taking 2-3 seconds for 26 modules.
thanks again