我们之前使用的是drools 5.3中的包构建器。 现在升级到6.5.0之后..我们正在使用kie api。 drl的编译时间增加到10倍。 例如。以下代码。
1>------ Build started: Project: Test1z, Configuration: Debug Win32 ------
1>main.cpp
1>c:\program files (x86)\microsoft visual studio\2017\community\vc\tools\msvc\14.10.25017\include\xmemory0(774): error C2528: 'pointer': pointer to reference is illegal
1>c:\program files (x86)\microsoft visual studio\2017\community\vc\tools\msvc\14.10.25017\include\xmemory0(984): note: see reference to class template instantiation 'std::allocator<_Ty>' being compiled
1> with
1> [
1> _Ty=int &
1> ]
1>c:\program files (x86)\microsoft visual studio\2017\community\vc\tools\msvc\14.10.25017\include\vector(441): note: see reference to class template instantiation 'std::_Wrap_alloc<std::allocator<_Ty>>' being compiled
1> with
1> [
1> _Ty=int &
1> ]
1>c:\program files (x86)\microsoft visual studio\2017\community\vc\tools\msvc\14.10.25017\include\vector(493): note: see reference to class template instantiation 'std::_Vec_base_types<_Ty,_Alloc>' being compiled
1> with
1> [
1> _Ty=int &,
1> _Alloc=std::allocator<int &>
1> ]
1>c:\program files (x86)\microsoft visual studio\2017\community\vc\tools\msvc\14.10.25017\include\vector(701): note: see reference to class template instantiation 'std::_Vector_alloc<std::_Vec_base_types<_Ty,_Alloc>>' being compiled
1> with
1> [
1> _Ty=int &,
1> _Alloc=std::allocator<int &>
1> ]
1>c:\users\skilz80\documents\visual studio 2017\projects\test1z\test1z\main.cpp(15): note: see reference to class template instantiation 'std::vector<int &,std::allocator<_Ty>>' being compiled
1> with
1> [
1> _Ty=int &
1> ]
1>c:\program files (x86)\microsoft visual studio\2017\community\vc\tools\msvc\14.10.25017\include\xmemory0(775): error C2528: 'const_pointer': pointer to reference is illegal
1>c:\program files (x86)\microsoft visual studio\2017\community\vc\tools\msvc\14.10.25017\include\xmemory0(798): error C2535: 'int &(*std::allocator<_Ty>::address(int &) noexcept const)': member function already defined or declared
1> with
1> [
1> _Ty=int &
1> ]
1>c:\program files (x86)\microsoft visual studio\2017\community\vc\tools\msvc\14.10.25017\include\xmemory0(792): note: see declaration of 'std::allocator<_Ty>::address'
1> with
1> [
1> _Ty=int &
1> ]
1>c:\program files (x86)\microsoft visual studio\2017\community\vc\tools\msvc\14.10.25017\include\xmemory0(918): error C2528: 'pointer': pointer to reference is illegal
1>c:\program files (x86)\microsoft visual studio\2017\community\vc\tools\msvc\14.10.25017\include\xmemory0(988): note: see reference to class template instantiation 'std::allocator_traits<_Alloc>' being compiled
1> with
1> [
1> _Alloc=std::allocator<int &>
1> ]
1>c:\program files (x86)\microsoft visual studio\2017\community\vc\tools\msvc\14.10.25017\include\xmemory0(919): error C2528: 'const_pointer': pointer to reference is illegal
1>c:\program files (x86)\microsoft visual studio\2017\community\vc\tools\msvc\14.10.25017\include\xmemory0(938): error C2528: '<template-parameter>': pointer to reference is illegal
1>c:\program files (x86)\microsoft visual studio\2017\community\vc\tools\msvc\14.10.25017\include\xmemory0(944): error C2528: '<template-parameter>': pointer to reference is illegal
1>c:\program files (x86)\microsoft visual studio\2017\community\vc\tools\msvc\14.10.25017\include\xmemory0(1031): error C2535: 'int &(*std::_Wrap_alloc<std::allocator<_Ty>>::address(int &) const)': member function already defined or declared
1> with
1> [
1> _Ty=int &
1> ]
1>c:\program files (x86)\microsoft visual studio\2017\community\vc\tools\msvc\14.10.25017\include\xmemory0(1025): note: see declaration of 'std::_Wrap_alloc<std::allocator<_Ty>>::address'
1> with
1> [
1> _Ty=int &
1> ]
1>c:\program files (x86)\microsoft visual studio\2017\community\vc\tools\msvc\14.10.25017\include\xmemory0(159): error C2528: 'abstract declarator': pointer to reference is illegal
1>c:\program files (x86)\microsoft visual studio\2017\community\vc\tools\msvc\14.10.25017\include\vector(444): note: see reference to class template instantiation 'std::_Is_simple_alloc<std::_Wrap_alloc<std::allocator<_Ty>>>' being compiled
1> with
1> [
1> _Ty=int &
1> ]
1>c:\program files (x86)\microsoft visual studio\2017\community\vc\tools\msvc\14.10.25017\include\xmemory0(159): error C2528: '<template-parameter>': pointer to reference is illegal
1>c:\program files (x86)\microsoft visual studio\2017\community\vc\tools\msvc\14.10.25017\include\xmemory0(161): error C2528: 'abstract declarator': pointer to reference is illegal
1>c:\program files (x86)\microsoft visual studio\2017\community\vc\tools\msvc\14.10.25017\include\xmemory0(161): error C2528: '<template-parameter>': pointer to reference is illegal
1>c:\program files (x86)\microsoft visual studio\2017\community\vc\tools\msvc\14.10.25017\include\vector(452): error C2528: '<template-parameter>': pointer to reference is illegal
1>c:\program files (x86)\microsoft visual studio\2017\community\vc\tools\msvc\14.10.25017\include\xmemory0(176): error C2528: 'pointer': pointer to reference is illegal
1>c:\program files (x86)\microsoft visual studio\2017\community\vc\tools\msvc\14.10.25017\include\vector(497): note: see reference to class template instantiation 'std::_Simple_types<int &>' being compiled
1>c:\program files (x86)\microsoft visual studio\2017\community\vc\tools\msvc\14.10.25017\include\xmemory0(177): error C2528: 'const_pointer': pointer to reference is illegal
1>c:\program files (x86)\microsoft visual studio\2017\community\vc\tools\msvc\14.10.25017\include\vector(951): error C2535: 'void std::vector<int &,std::allocator<_Ty>>::push_back(_Ty)': member function already defined or declared
1> with
1> [
1> _Ty=int &
1> ]
1>c:\program files (x86)\microsoft visual studio\2017\community\vc\tools\msvc\14.10.25017\include\vector(945): note: see declaration of 'std::vector<int &,std::allocator<_Ty>>::push_back'
1> with
1> [
1> _Ty=int &
1> ]
1>c:\program files (x86)\microsoft visual studio\2017\community\vc\tools\msvc\14.10.25017\include\vector(1033): error C2535: 'std::_Vector_iterator<std::_Vector_val<std::_Simple_types<int &>>> std::vector<int &,std::allocator<_Ty>>::insert(std::_Vector_const_iterator<std::_Vector_val<std::_Simple_types<int &>>>,_Ty)': member function already defined or declared
1> with
1> [
1> _Ty=int &
1> ]
1>c:\program files (x86)\microsoft visual studio\2017\community\vc\tools\msvc\14.10.25017\include\vector(1027): note: see declaration of 'std::vector<int &,std::allocator<_Ty>>::insert'
1> with
1> [
1> _Ty=int &
1> ]
1>c:\program files (x86)\microsoft visual studio\2017\community\vc\tools\msvc\14.10.25017\include\vector(1634): error C2528: 'data': pointer to reference is illegal
1>c:\program files (x86)\microsoft visual studio\2017\community\vc\tools\msvc\14.10.25017\include\vector(1639): error C2528: 'data': pointer to reference is illegal
1>Done building project "Test1z.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
//以下行现在需要150秒才能完成428条规则。早些时候需要10秒钟。
KieServices ks = KieServices.Factory.get();
KieFileSystem kfs = ks.newKieFileSystem();
kfs.write(resource);
KieBuilder kb = ks.newKieBuilder(kfs);
早期的drools版本5.3,jdk 1.7
新版本6.5.0,jdk 1.8
关于这一点的几个问题:
kie api在编制规则时需要更长的时间吗?
是否可以采取任何措施来提高性能,例如增加RAM。
我们在DRL中调用java类/方法,这可能是个问题吗?
PackageBuilder Api in drools 5.3编译速度更快,相同的DRL,我们是否需要修改我们的DRL以获得更好的性能..任何链接?
答案 0 :(得分:0)
我遇到了同样的问题。我将我的drools版本从6.2.0.Final更新为6.5.0.Final(均使用java 1.8),并且在创建新的KieSession所花费的时间增加了10倍。我们有约1800条规则,其中包括83个决策表。
在版本6.2.0中。最终的newKieSession花了大约2分钟。 在版本6.5.0.Final和7.0.0.Final中,newKieSession需要20分钟,我认为我们的规则处理也会挂起/停止。
您可以尝试使用6.2.0.Final,6.3.0.Final或6.4.0.Final(虽然在版本6.4.0.Final版本中,我在规则触发期间收到NullPointerException。)
我设置了我的kieSession并使用以下
设置了我的kieBaseTable Device
----------
deviceId (pk)
name
deviceType (fk to DeviceType)
...
Table Processor
-----------
deviceId (pk)
ProcessorName
Clockspeed
...
Table RAM
-----------
deviceId (pk)
Size
Manufacturer
...
Table DeviceType
------------
deviceTypeId(pk)
DeviceType
...
这将读取包含
的类路径中的kmodule.xml文件KieContainer kieContainer = KieServices.Factory.get().newKieClasspathContainer();
KieSession kSession = kieContainer.newKieSession("my-rules");
答案 1 :(得分:0)
您报告的编译时性能下降很可能是由于此处报告的问题https://issues.jboss.org/browse/DROOLS-1581已在主服务器上修复。作为附注,不管这个问题如何,我强烈建议避免在你的规则中使用evals:它们在99.9%的情况下无用,会恶化规则的可读性,也可能对运行时性能产生负面影响。