The following sections describe custom installation configurations and will not apply to all installs.
Modify the input constraints
The limits for the input parameters are in the file /rosapi/constraints.yaml
. Modify the values in this file to increase the limits on the maximum input character count and maximum input payload per call. You can also increase the number of names per list for each call to the name deduplication endpoint.
The default values were determined as optimal during early rounds of performance tests targeting < 2 second response times. Larger values may cause degradation of system performance.
Table 5. constraints.yaml
Parameter
|
Minimum
|
Maximum
|
Default Value
|
Description
|
maxInputRawByteSize
|
1
|
10,000,000
|
614400
|
The maximum number of input bytes per raw doc
|
maxInputRawTextSize
|
1
|
1,000,000
|
50000
|
The maximum number of input characters per submission
|
maxNameDedupeListSize
|
1
|
100,000
|
1000
|
The maximum number of names to be deduplicated.
|
To modify the input constraints:
-
Edit the file /rosapi/constraints.yaml
-
Modify the value for one or more parameters
Note
These instructions assume all workers are on a single machine. If Rosette Server is installed in an environment with distributed workers, contact Rosette support.
-
Generate an RSA key pair for the server.
This example is for evaluation purposes only. The generated key is good for seven days. Please work with your appropriate internal group to acquire your keys for production usage.
$JAVA_HOME/bin/keytool -genkeypair \
-validity 7 \
-alias myservicekey \
-keystore serviceKeystore.jks \
-dname "cn=exampleName, ou=exampleGroup, o=exampleCompany, c=us" \
-keypass skpass \
-storepass sspass \
-keyalg RSA \
-sigalg SHA256withRSA
-
Set the permissions for the keystore file to read only
chmod 400 serviceKeystore.jks
-
Rename the file launcher/config/rosapi/transport-rules.tsv
. Removing this file forces local transports for all endpoints. We recommend renaming the file, to have the original file as a backup.
mv launcher/config/rosapi/transport-rules.tsv launcher/config/rosapi/transport-rules.tsv.original
-
Change http
to https
in launcher/config/com.basistech.ws.cxf.cfg
.
urlBase=https://0.0.0.0:${rosapi.port}/rest
-
Edit the file launcher/config/org.apache.cxf.http.jetty-main.cfg
and add the following lines to use the generated keystore:
tlsServerParameters.keyManagers.keyPassword=skpass
tlsServerParameters.keyManagers.keyStore.file=<path_to_keystore>/serviceKeystore.jks
tlsServerParameters.keyManagers.keyStore.password=sspass
tlsServerParameters.keyManagers.keyStore.type=JKS
Optional: SSL with remote workers
To use remote workers, the certificate needs to be trusted.
For testing, import the certificate to the truststore file, cacerts.jks
, as trusted.
This example is for evaluation purposes only, continuing using the previously generated key. Please work with your appropriate internal group to acquire your keys for production usage. If your key is acquired from a trusted certificate authority, no further configuration may be required. As this example uses self-signed certificates, the following steps are necessary.
-
Export the certificate from the Java KeyStore.
keytool -exportcert \
-alias myservicekey \
-keystore serviceKeystore.jks \
-file server.cer \
-storepass sspass
-
Import the certificate into a trust store.
keytool -import \
-v \
-trustcacerts \
-alias localhost \
-file server.cer \
-keystore cacerts.jks \
-storepass capass
-
Instruct the JRE to trust the self-signed certificate by updating conf/wrapper.conf
.
wrapper.java.additional.201=-Djavax.net.ssl.trustStore=/path-to-cacerts/cacerts.jks
wrapper.java.additional.202=-Djavax.net.ssl.trustStorePassword=capass
Enable passing files to endpoints
Most endpoints can take either a text block, a file, or a link to a webpage as the input text. The webpage link is in the form of a URI. To enable passing a URI to an endpoint, the enableDTE
flag must be set in the file com.basistech.ws.worker.cfg
.
By default, the flag is set to True
; URI passing is enabled.
#download and text
extractorenableDte=true
Change Rosette RESTful server port
Note
Use this is to change the default port on Windows installations or to change the server port after installation on Linux and macOS. The Linux and macOS install script install_rosette.sh
appends this line to conf/wrapper.conf
during install if you override the default.
The default installation uses port 8181
for the Rosette endpoints. To change the default port, edit the file conf/wrapper.conf
; uncomment and modify the port value.
wrapper.java.additional.301=-Drosapi.port=8181
For example, change 8181 to 9191.
When changing the port, update the documentation hostname as well:
-
cd doc/swagger
-
Edit the file swagger.yaml
-
In the servers
section, replace localhost:8181
with the correct port.
servers:
- url: 'http://localhost:8181/rest/v1/'
Update documentation hostname
Note
Use this is to change the default port on Windows installations or to change the server port after installation on Linux and macOS. The Linux and macOS install script install_rosette.sh
appends this line to conf/wrapper.conf
during install if you override the default.
If you want to change the default port to execute the interactive documentation:
-
cd doc/swagger
-
Edit the file swagger.yaml
-
In the servers
section, replace localhost:8181
with the correct port.
servers:
- url: 'http://localhost:8181/rest/v1/'
Understanding the transport rules
The transport rules provide a means of mapping an endpoint along with some defined options (language, linked-entities, length) to a processing URL. Transport rules allow you to define a distributed deployment routing a subset of calls to different machines, balancing the load by routing high demand calls to separate machines.
Location: <version>/server/launcher/config/rosapi/transport-rules.tsv
The basic format of an entry is:
endpoint [tab] options [tab] URL
where:
-
endpoint
is any valid endpoint and may have one or more entries. Multiple rules for the same endpoint are processed in the order listed; if there is a conflict between rules, the first one processed prevails. The most specific rules should be listed first. The last rule should be general enough to match any remaining conditions. Conditions left without a valid routing will fail.
-
options
zero or more of:
-
lang=a|b|c
provides a list of languages for this particular rule. Zero or more entries are permitted.
-
the wildcard *
may be used to specify any languages
-
length > n
and length < n
where length is the number of UTF-16 characters in the input string. To define a range, you need to create 2 rules, a <
rule and a >
rule.
-
URL
valid URL for transport. There is a special URL, local:
. This is used to route /language
requests to be processed inside the front end, not sent over the network at all. The recommendation is to use local:
if the worker resides on the same machine and same JVM with the frontend.
An example of multiple endpoint entries:
/entities lang=eng|spa, http://localhost:${rosapi.port}/rest/worker/process
/entities linkEntities=false http://localhost:${rosapi.port}/rest/worker/process
/entities lang=ara|eng|jpn|spa|zho http://localhost:${rosapi.port}/rest/worker/process
/entities * http://localhost:${rosapi.port}/rest/worker/process
/language * local:
Install TensorFlow GPU support
Note
TensorFlow GPU is currently only available on the Linux and Windows operating systems.
To improve Rosette's performance, especially when invoking deep neural network based models, you may choose to run on a GPU.
Download TensorFlow
To make use of GPUs on your Linux system, you should download libtensorflow_jni_gpu-1.14.0.jar
Platform-dependent native code with GPU (CUDA) support for the TensorFlow Java library from http://repo1.maven.org/maven2/org/tensorflow/libtensorflow_jni_gpu/1.14.0/libtensorflow_jni_gpu-1.14.0.jar.
You can also compile your own version of libtensorflow_jni
, which may provide better performance than the pre-compiled version.
cd $ROSAPI
mkdir tf_jni_gpu
jar xf libtensorflow_jni_gpu-1.14.0.jar -C tf_jni_gpu
Edit conf/wrapper.conf
to modify java.library.path
to the following:
wrapper.java.library.path.1=../tf_jni_gpu/org/tensorflow/native/linux-x86_64
wrapper.java.library.path.2=../lib
Verify TensorFlow GPU Support
To verify TensorFlow GPU support, run Rosette
cd $ROSAPI/bin
./launch.sh console
And in an entity request with DNN modelType
options:
curl --request POST \
--url http://localhost:8181/rest/v1/entities \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data '{"content": "Barack Obama was born in Hawaii", \
"options": { "modelType": "DNN" }}'
Verify that you see Tensorflow found and create a GPU in your console output
jvm 1 | 2018-04-18 18:38:15.346273: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1344] Found device 0 with properties:
jvm 1 | name: Tesla K80 major: 3 minor: 7 memoryClockRate(GHz): 0.8235
jvm 1 | pciBusID: 0000:00:1e.0
jvm 1 | totalMemory: 11.17GiB freeMemory: 11.10GiB
jvm 1 | 2018-04-18 18:38:15.346291: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1423] Adding visible gpu devices: 0
jvm 1 | 2018-04-18 18:38:15.617319: I tensorflow/core/common_runtime/gpu/gpu_device.cc:911] Device interconnect StreamExecutor with strength\
1 edge matrix:
jvm 1 | 2018-04-18 18:38:15.617346: I tensorflow/core/common_runtime/gpu/gpu_device.cc:917] 0
jvm 1 | 2018-04-18 18:38:15.617351: I tensorflow/core/common_runtime/gpu/gpu_device.cc:930] 0: N
jvm 1 | 2018-04-18 18:38:15.617609: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1041] Created TensorFlow device (/job:localhost/repli\
ca:0/task:0/device:GPU:0 with 10764 MB memory) -> physical GPU (device: 0, name: Tesla K80, pci bus id: 0000:00:1e.0, compute capability: 3.7)
jvm 1 | 2018-04-18 18:38:15.941174: I tensorflow/cc/saved_model/loader.cc:161] Restoring SavedModel bundle.
jvm 1 | 2018-04-18 18:38:16.094135: I tensorflow/cc/saved_model/loader.cc:196] Running LegacyInitOp on SavedModel bundle.
jvm 1 | 2018-04-18 18:38:16.131329: I tensorflow/cc/saved_model/loader.cc:291] SavedModel load for tags { serve }; Status: success. Took 986\
397 microseconds.
Known Limitations
Tensorflow does not provide GPU support for Java macOS as of Tensorflow 1.14