FaceTec Server Stress Testing
This guide provides an example of how to perform basic Stress/Load Testing against the FaceTec Server using the public npm package Artillery.
Prerequisites
To perform Stress/Load Testing on the FaceTec Server, Your Team will need to do the following:
- Generate a Set of Session Request Blobs for the API that Your Team is testing
Download the FaceTec Server Stress/Load Testing Example
- Install Node
Overview
The FaceTec Server Stress/Load Testing Example is a Node Script that includes the following:
- A sessionRequests folder that needs to include the Saved Set of Session Requests from Your FaceTec Server Webservice
- A processor.js file that has helpers to create requests using the JSON files above
- A test.yml file where Your FaceTec Server URL, Device Key Identifier, and Customizations can be set
By default, the test runs with 5 Virtual Users per second for 12 hours with no more than 50 concurrent users at a given time. These settings can be customized in the test.yml file under the phases section. See the Artillery Documentation for more information.
Usage
- Save a Set of Original Session Requests from a 3D Liveness Session in Your FaceTec Server Webservice.
- In SessionRequestProcessor.java, add the required imports.
import java.io.FileWriter; import java.io.IOException; - In
requestResultFuture.thenApply(requestResult -> {, add code to saverequestJSONto a file.// Write JSON to a file try (FileWriter writer = new FileWriter("sessionRequest_" + sessionRequest.hashCode() + "_" + requestResult.getLaunchId() + ".json")) { writer.write(requestJSON.toString(2)); writer.flush(); } catch (IOException e) { e.printStackTrace(); }
- In SessionRequestProcessor.java, add the required imports.
- Perform one full 3D Liveness Session against Your FaceTec Server.
- Copy the saved sessionRequest_<Launch ID>.json files into the Load Testing Sample sessionRequests folder.
- In the root of the FaceTec Server Stress/Load Testing Example, install the necessary dependencies by running
npm install. - In test.yml, specify Your Application's Device Key Identifier and Your FaceTec Server Webservice's Base URL.
- Start the Stress Test by running
npm start.
Important Note: When assessing Your Cluster's Performance, you can reuse a Session Request to send Subsequent Calls to Your FaceTec Server for Stress and Performance Testing. The FaceTec Server still performs all of the relevant processing for Stress and Performance Testing, even if the results of the Subsequent Calls change due to specific Security Checks failing. Please note that when performing Stress/Load Testing, FaceTec recommends creating Session Requests from multiple devices on each platform that Your Application supports in order to get a representative sampling of the type of data that Your FaceTec Server receives.