Pix APIs
General
-
Reuse sessions (benefit from session caching). Use the HSM session cache and gain performance by reusing HSM and HTTP sessions. In this case, it is recommended that you open a session, perform the operations you want and then close it, allowing the session to be reused quickly, thus reducing downtime.
-
Ensure that sessions are closed. Closing sessions guarantees the release of the resource, both in the HSM and on the client. Make sure that sessions are closed even for operations with a return code other than success.
-
Use concurrent sessions. Using concurrent/parallel sessions with the HSM helps to extract maximum performance. Attention should be paid to using too many sessions with HSMs, so as not to cause unnecessary use of resources. The throughput curve tends to rise and find a plateau.
HTTP requests Pix
-
Reuse the handle Pix. The handle created by
DPIXOpenHandle()stores the credentials and object identifiers and does not depend on an open HSM session. Keep the handle open for the duration of the application rather than opening and closing it with each request. -
Open one handle per thread. The handle can be used by multiple threads, but never simultaneously. In the default mode, this does not imply one connection per handle: all threads share the HTTP connection cache.
-
Set a connection limit only when the environment requires it. The default is unlimited, and the cache grows as application concurrency increases. Configure
HSM_PIX_POOL_MAX_HANDLESwhen there is a restriction on the number of concurrent connections to the peer. In this case, measure the cache counters first (usingDPIXGetCacheParam()) and set the limit based on the highest observed value, rather than estimating it. -
Clear the cache when the environment requires it to trigger a refresh of the objects. HSM objects are read during the handshake, so connections that are already open continue to use the previous objects until they are reestablished. If the refresh needs to take effect immediately, calling
`DPIXSetCacheParam()`with`PIXCP_CLEAR` causes the next request to reconnect and re-read the objects.Info
See more details in " HTTP Connection Cache" Pix and in the " env vars" topic.
Important Configurations
General
- Set the HSM connection timeouts. When the HSM timeout is not set, the default is that of the operating system. In the event of a connection failure, the application may wait too long. It is important to ALWAYS set the HSM send and receive timeouts (see the topic env vars). Other connection parameters can also be configured.
HTTP requests Pix
- Define the HTTP operation timeouts. When not defined, the default HTTP operation timeout is unlimited. In the event of an HTTP connection failure, the application may be put on hold indefinitely. It is important to ALWAYS set the timeout in HTTP request calls.