/
instance_performance_test ()

instance_performance_test ()

Function prototype

instance_performance_test (session, test_type, timestamp, upload_packet)

API Version

All

Supported interfaces

SOAP, REST (from API Version 2.7.26)

Returns statistics about server performance. This operation is only allowed if a valid session is provided (for security reasons)

Input

parameters:

  • session: a token obtained by calling session_init ()

  • test_type: Type of test. Values accepted (can be combined by a sum):

    • 0: Latency test. The function does nothing and returns inmediately. Used to test latency between the client and the server.

    • 1: Download speed test. Returns a packet of bytes of size 10KB

    • 2: CPU test(1): Performs a 1000 times loop encryption of a 1024 byte string (AES 256)

    • 4: Database performance test(1)

      • Inserts 1000 rows in a table

      • Inserts 100 rows in a table with a long CLOB field (10KB)

    (1) For security reasons, CPU and Database tests are allowed only if the session provided has ADMIN role. This operation can generate a considerable overload in the server and must be used with caution

  • timestamp: This parameter is provided specially for those cases where the function is invoked asynchronously. On reception of web service response, the client can use this parameter to determine to which invocation it corresponds.
    Usually the client will use this parameter to be able to measure the latency. The most common case would be to set a timestamp calculated just before invoking instance_performance_time(). The function returns this value in the response. On return of the function, the client can calculate a new timestamp and subtract the initial one to obtain the TotalTime.

  • upload_packet: Packet of bytes that can be sent by the client to the server to calculate upload time.

Output

parameters:

  • result: Performance statistics. The values returned are:

    • client_timestamp: always returned. Is the same "timestamp" value provided as a parameter in the call to this function

    • cpu_time: expressed in milliseconds. Time spent in calculating the encryption of a 1024 byte string (1000 times). This value is calculated if test_type=2

    • database_insert_time: expressed in milliseconds. Time spent in inserting 1000 rows in a table (without long data). This value is calculated if test_type=4

    • database_insert_CLOB_time: expressed in milliseconds. Time spent in inserting 100 rows with a large object (10KB) in a table. This value is calculated if test_type=4

    • download_packet: random string (10KB) returned by the server to test download time. This value is calculated if test_type=1

    • function_time: expressed in milliseconds. Total time to execute the function (including all the mentioned above)

    • init_transaction_time: expressed in milliseconds. Each invocation to a WS-API (transaction) function requires a initialization time. This value is time spent to initialize the transaction.

    • db_connect_time: expressed in milliseconds. Time to establish a connection to the Database

    • db_audit_connect_time: expressed in milliseconds. Time to establish a connection to the Audit Database

    • redis_connect_time: expressed in milliseconds. Time to establish a connection to the Redis Cache Server

    • total_server_time: expressed in milliseconds. Total time spent in the server. This includes function_time plus other internal processes of the server calculated from the moment that the incoming function call arrives (database connections, load of resources...)

  • ErrorMsg: any fault in the call, either in the validation of input parameters, errors in the connection to the database or any other error, this parameter returns the error message produced

  • ErrorCode: the code of the error (if any)

 

Calculation formulas

The following formulas can be used to calculate communication performance:

Formula

test_type

upload_packet

Comments

Formula

test_type

upload_packet

Comments

latency = TotalTime - total_server_time

0 (latency)

""

In this mode the function does not receive nor return any packet of data, so the total communication time can be considered as the latency.

uploadSpeed = sizeof(upload_packet) / (TotalTime - TotalServerTime - latency)

0 (latency)

controlled size but array

Providing an upload_packet will allow to measure the communication time used to send a packet. In this case, the communication time consist of the latency and the upload time.

downloadSpeed = sizeof(download_packet) / (TotalTime - TotalServerTime - latency)

1 (download speed)

""

In this mode the function does not receive any packet, but returns a packet of data of controlled size, so the total communication time consists of the latency and the download time.


Request example

instance_performance_test ("LC5899bcff074af1.33078860", 7, 123312231, "")

Reponse

The response format is XML when the function has been invoked via the SOAP API, and JSON when it has been invoked via the REST API



Related content