public final class Platform extends Object
Modifier and Type | Class and Description |
---|---|
static class |
Platform.KeyType
Key size, key algorithm and signature algorithms used.
|
Modifier and Type | Method and Description |
---|---|
static void |
addCertificate(KeyStore ks,
String ksType,
String ksPath,
String alias,
char[] pwd,
String certPath)
Add the certificate in the specified path to the provided keystore; creating the keystore with the provided type
and path if it doesn't exist.
|
static int |
computeDefaultNumberOfReaderThreads()
Computes the optimal number of reader threads based on the number of CPUs in the system.
|
static int |
computeDefaultNumberOfSelectorThreads()
Computes the optimal number of selector (request handler) threads based on the number of CPUs in the system.
|
static int |
computeDefaultNumberOfWriterThreads()
Computes the optimal number of writer threads based on the number of CPUs in the system.
|
static void |
deleteAlias(KeyStore ks,
String ksPath,
String alias,
char[] pwd)
Delete the specified alias from the provided keystore.
|
static void |
generateSelfSignedCertificate(KeyStore ks,
String ksType,
String ksPath,
Platform.KeyType keyType,
String alias,
char[] pwd,
String dn,
int validity)
Generate a self-signed certificate using the specified alias, dn string and validity period.
|
public static void addCertificate(KeyStore ks, String ksType, String ksPath, String alias, char[] pwd, String certPath) throws KeyStoreException
ks
- The keystore to add the certificate to, may be null if it doesn't exist.ksType
- The type to use if the keystore is created.ksPath
- The path to the keystore if it is created.alias
- The alias to store the certificate under.pwd
- The password to use in saving the certificate.certPath
- The path to the file containing the certificate.KeyStoreException
- If an error occurred adding the certificate to the keystore.public static void deleteAlias(KeyStore ks, String ksPath, String alias, char[] pwd) throws KeyStoreException
ks
- The keystore to delete the alias from.ksPath
- The path to the keystore.alias
- The alias to use in the request generation.pwd
- The keystore password to use.KeyStoreException
- If an error occurred deleting the alias.public static void generateSelfSignedCertificate(KeyStore ks, String ksType, String ksPath, Platform.KeyType keyType, String alias, char[] pwd, String dn, int validity) throws KeyStoreException
ks
- The keystore to save the certificate in. May be null if it does not exist.keyType
- The keystore type to use if the keystore is created.ksPath
- The path to the keystore if the keystore is created.ksType
- Specify the key size, key algorithm and signature algorithms used.alias
- The alias to store the certificate under.pwd
- The password to us in saving the certificate.dn
- The dn string used as the certificate subject.validity
- The validity of the certificate in days.KeyStoreException
- If the self-signed certificate cannot be generated.public static int computeDefaultNumberOfReaderThreads()
The returned value is adapted for hyper-threaded machines which report double the processors they really have, hence we divide by two. Matching the number of threads to the number of cores optimizes for CPU intensive workloads (in memory read). However, it is possible to add a few additional threads in order to take up the slack when cores are blocked waiting for memory accesses, hence the additional N/8 fudge factor.
public static int computeDefaultNumberOfWriterThreads()
Testing found that the optimal value is similar to the number of reader threads. Adding more threads does not yield greater performance due to contention on the database transaction log. Beyond this the threads simply queue up behind other blocked threads and essentially become extensions to the work queue.
The replication replay thread pool is sized to the nearest power of two so, unlike the reader thread count, this method does not add a hyper-threading "fudge factor" in order to avoid further adjustment.
public static int computeDefaultNumberOfSelectorThreads()
The returned value is adapted for hyper-threaded machines which report double the processors they really have, hence we initially divide by two. In addition, we divide by a further factor of two in order to reduce the amount of context switching between selector threads and worker threads. Benchmarks indicate that performance is very sensitive to the number of selectors, such that small adjustments have a significant impact on performance.
Copyright 2010-2018 ForgeRock AS.