Memory usage

The system relies heavily on HashMaps to quickly find the rules that need to be fired.

Some fields only require a handful of rules where others have a lot of them. This means that it depends on the fields that have been requested how many rules are kept in the system and thus how much memory is used to store the rules in. To get an idea of the relative memory impact of the rules needed for a specific field.

This table was constructed by running all testcases against the engine where we only request 1 field. Then after forcing a GC in the JVM we retrieve the memory footprint. The DeviceClass field is always extracted and as such can be seen as the baseline against not having this engine running at all.

Because most rules determine several fields there is a lot of overlap in the rules used. If you keep all rules we see that version 5.6 uses about 37 MiB of memory for all rules on top of the rules for the DeviceClass (which is always extracted).

Extracting everything will currently have a memory impact (without caching!) of about 114 MiB

FieldRelative Memory usage
DeviceClass (required)90.8 MiB
DeviceName10.0 MiB
DeviceBrand9.1 MiB
DeviceCpu0.7 MiB
DeviceCpuBits0.5 MiB
DeviceFirmwareVersion1.1 MiB
DeviceVersion0.4 MiB
OperatingSystemClass1.2 MiB
OperatingSystemName1.3 MiB
OperatingSystemVersion1.3 MiB
OperatingSystemVersionMajor1.5 MiB
OperatingSystemNameVersion2.0 MiB
OperatingSystemNameVersionMajor2.2 MiB
OperatingSystemVersionBuild0.4 MiB
LayoutEngineClass2.8 MiB
LayoutEngineName2.8 MiB
LayoutEngineVersion2.8 MiB
LayoutEngineVersionMajor3.0 MiB
LayoutEngineNameVersion3.2 MiB
LayoutEngineNameVersionMajor3.4 MiB
LayoutEngineBuild0.6 MiB
AgentClass5.0 MiB
AgentName5.2 MiB
AgentVersion5.1 MiB
AgentVersionMajor5.3 MiB
AgentNameVersion5.7 MiB
AgentNameVersionMajor5.8 MiB
AgentBuild0.5 MiB
AgentLanguage0.4 MiB
AgentLanguageCode0.4 MiB
AgentInformationEmail0.1 MiB
AgentInformationUrl0.1 MiB
AgentSecurity0.2 MiB
AgentUuid0.3 MiB
WebviewAppName1.0 MiB
WebviewAppVersion1.0 MiB
WebviewAppVersionMajor1.0 MiB
WebviewAppNameVersionMajor1.1 MiB
FacebookCarrier0.2 MiB
FacebookDeviceClass0.2 MiB
FacebookDeviceName0.2 MiB
FacebookDeviceVersion0.2 MiB
FacebookFBOP0.2 MiB
FacebookFBSS0.5 MiB
FacebookOperatingSystemName0.5 MiB
FacebookOperatingSystemVersion0.5 MiB
Anonymized0.1 MiB
HackerAttackVector0.1 MiB
HackerToolkit0.1 MiB
KoboAffiliate0.1 MiB
KoboPlatformId0.1 MiB
IECompatibilityVersion0.4 MiB
IECompatibilityVersionMajor0.4 MiB
IECompatibilityNameVersion0.4 MiB
IECompatibilityNameVersionMajor0.4 MiB
Carrier0.2 MiB
GSAInstallationID0.1 MiB
NetworkType0.1 MiB