fiftyone.device.example.batch
Class Controller

java.lang.Object
  extended by fiftyone.device.example.batch.Controller

public class Controller
extends Object

Demonstration of 51Degrees detection, with benchmarking outputs.

Prerequisites
useragents : A file containing HTTP User-Agent strings to detect, one per line
detection : A detection dataset file

An example test file and "Lite" detection file can be found in the data/ directory in the root of this repo. By default this example will try to find files ../data/20000 User Agents.csv and ../data/51Degrees-LiteV3.2.dat relative to its working directory.

By default this example carries out 6 iterations of detecting the HTTP User-Agents in the supplied file. The first iteration serves to warm up the JVM and will populate the 51 degrees data structures and cache if one is specified. Subsequent iterations provide a better indication of actual detection performance in live operation.

A results file is generated on the last iteration. This records the detailed detection results of each HTTP User-Agent detected and by default is placed in the working directory.

For the Lite dataset a heap of 500 MBytes is recommended, for the Enterprise dataset 1GByte - i.e. run with -Xmx500m or -Xmx1g as appropriate.

To compile, from the project root directory execute mvn clean install (or equivalent in your IDE).

To run this example from the command line, first compile the source (above) switch to the device-detection-examples directory, then mvn exec:java@batch. Maven 3.3 is required. This will run the example in the same process as maven and hence shares its heap etc. If you want to add command line options then e.g. mvn exec:java@batch -Dexec.args="--cache=0 --iterations=10"

In the following command line options can be abbreviated e.g. --cache=1000000 is the same as -c1000000

   Option                  Description
   ------                  -----------
 --useragents <File>      file path of useragents file (default: ../data/20000 User Agents.csv)
 --detection <File>       file path of detection file (default: ../data/51Degrees-LiteV3.2.dat)
 --results <File>         file path for results file (default: results-<iso date time of test>.txt)
 --cache <Integer>        size of detection cache in bytes (default: 50000)
 --iterations <Integer>   number of times to do the detection (default: 6)                        
 --limit <Integer>        max lines to read from source file (default: Integer.MAX_VALUE)
 --mode <Controller$Mode> memory or stream mode processing (default: memory)                   
 --preinit <Boolean>      warm up the detection engine on load if mode = memory (default: false)
 --sleep <Integer>        time to sleep between iterations in msec (default: 1000)
 --threads <Integer>      number of threads to use when doing the detections (default: 2)         
 --wait <Integer>         time to wait after initialization and before starting the tests in msec (default: 0)
                                increase if you want e.g. to run JConsole after starting the process
 


Nested Class Summary
static class Controller.Mode
           
 
Constructor Summary
Controller()
           
 
Method Summary
static void main(String[] args)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Controller

public Controller()
Method Detail

main

public static void main(String[] args)
                 throws Exception
Parameters:
args - Command line arguments as explained above
Throws:
IOException - if there was a problem accessing data file.
Exception


Copyright © 2017 51Degrees. All rights reserved.