HI David,
As you've noticed working with geofences within the GeoEvent Extension can get tricky depending on the polygons your're working with. I'll be answering the questions you posed as well as outlining the steps you'll need to take in order to ensure all polygons can be consumed within GeoEvent. Currently, when importing geofences in GeoEvent it stores the geometry information inside the system RAM. This is shown as an increase in consumed RAM utilization by the java.exe process (as you've seen in the Task Manager). The answers to your questions can be found below:
1. Since geofence geometry is stored in memory and can be constantly read and interpreted, more complex polygons will consume more system RAM until the 4 GB limit is reached. In many situations, the finite limit of polygons is actually variable, and I've seen the default max be as low as 100 polygons (very complex geometry) or as high as 20,000 (simplistic small geometry).
2. There is a way to increase the java.exe process heap size limit which will allow more geofences to be imported. However, doing so is at your own risk as any increased RAM usage could cause unintended consequences on the machine. That being said, I would start with increasing the limit to 8192 MB (8 GB) and assess the performance of the machine at that point. While you certainly could set the limit to 12 GB, it would be best to start small and continually test and assess in line with your organization's IT policy. Below are the steps needed to change the heap size from the 4 GB default to an 8 GB testing size:.
a. Log in to the GeoEvent server machine, as we'll need to modify a configuration file in the installation directory
b. Stop the ArcGIS GeoEvent Windows Service
c. Navigate to the following directory:
C:\Program Files\ArcGIS\Server\GeoEvent\etc
d. Edit the "ArcGISGeoEvent.cfg" file, which is typically the second file in the directory
e. About halfway down the file, you'll find a listing of Java parameters that GeoEvent uses. The parameter you want to change is commented with "# Maximum Java Heap Size" and is typically Java parameter 15.
f. Change the value from -Xmx4096m to -Xmx8192m, save and exit the file
g. Start the ArcGIS GeoEvent Windows Service
h. Attempt to re-import the same block of geofences that you received the failure on before. These should now import successfully
3. Along with changing the Java Heap Size, another good trick for ensuring that geofences are imported successfully is to simplify the geometry as best as you can. Limiting the amount of vertices in each polygon will greatly improve the changes of it being imported into GeoEvent.
4. You are absolutely realistic in your logic pertaining to geofences. The 4 GB limit is in place by default and intended to work with the minimum system requirements for ArcGIS Server and the GeoEvent Extension. This may not be enough for some testing and production environments depending on the scope of the project you're working on. The maximum amount of unique geofences that I've seen in a production environment is just shy of 70,000. They consumed over 16 GB of system RAM and were incorporated into 22 different GeoEvent Services. That's not to say that it's the upper limit, just the most I've personally encountered.
5. Start with increasing the Java Heap Size as well as being mindful of the polygon complexity over time. Since you have more than 36,000 total polygons, you may not have enough system RAM installed to accomplish importing them all at the same time. This is why small batch testing is important, as your testing results can be used as a justification if the installed machine resources need to be increased over time.
- Chris