# Connection and health checks (IRPCTest)

Location: [gRPC API](https://developer.m-files.com/APIs/gRPC-API/index.md) > [Vault API](https://developer.m-files.com/APIs/gRPC-API/vault/index.md)

HTML version: https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCTest/

An interface for testing connection between a client and the server.

This interface offers simple methods to test if a connection is valid,
either to the server (without a need to login) or to a specific vault
(requires login).

- **gRPC service:** `MFiles.IRPCTest`
- **Book and level:** [Vault API](https://developer.m-files.com/APIs/gRPC-API/vault/index.md), standard
- **Methods:** 9
- **Proto file:** [`mfiles/IRPCTest.proto`](https://developer.m-files.com/APIs/gRPC-API/downloads/proto/mfiles/IRPCTest.proto)

<a id="overview"></a>

## Overview

Connectivity, throughput and health checks. Each method checks one thing and returns; none of them
reads or changes objects or metadata, and several need no session at all.

| Job | Methods | Session |
|---|---|---|
| Round-trip time to the server | `TestConnectionToServer` | None |
| Is the vault session still valid? | `TestConnectionToVault` | Vault |
| Download and upload throughput | `DownloadTestFile_Begin`, `UploadTestFile_Begin` | Vault |
| Is a vault ready? (load balancers) | `CheckVaultHealthAnonymous`, `TestVaultAvailability` | None |
| Is the server ready? | `CheckServerHealthAnonymous` | None |
| Which server check fails? | `GetServerHealth` | Any |
| Connection from this server to another | `TestConnectionToRemoteServer` | None |

Where another service is the better choice:

- To find out whether the server answers and which version it runs, call
  [QueryVersion](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCQueryVersion/QueryVersion/index.md). It needs no session either and is
  the usual first call of a client. Use `TestConnectionToServer` when you want to time repeated
  round trips with an empty request and response.
- To keep a session from expiring, call [KeepAlive](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCLogin/KeepAlive/index.md).
  `TestConnectionToVault` checks the session but does not extend its lifetime.

Errors follow the usual pattern: a missing, invalid or logged-out session is reported as gRPC
status `UNAUTHENTICATED` without error trailers, and every other failure as `UNKNOWN` with the
M-Files error stack in the `mfiles-error-serialized-bin` trailer. See
[Errors](https://developer.m-files.com/APIs/gRPC-API/runtime/errors/index.md) and
[Connecting to the server](https://developer.m-files.com/APIs/gRPC-API/runtime/connecting/index.md).

<a id="highlighted"></a>

## Highlighted methods

| Method | Summary | Facts |
|---|---|---|
| [TestConnectionToServer](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCTest/TestConnectionToServer/index.md) | Does nothing and returns at once. Use it to check that calls reach the server and to measure the round-trip time. | `write` `no session` |
| [TestConnectionToVault](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCTest/TestConnectionToVault/index.md) | Checks that the session is a valid vault session, and does nothing else. | `write` `session` `idempotent` |
| [CheckVaultHealthAnonymous](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCTest/CheckVaultHealthAnonymous/index.md) | Succeeds when a vault on this server is ready for use; fails otherwise. No session needed. Made for load balancer health probes. | `read` `no session` `idempotent` |
| [DownloadTestFile_Begin](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCTest/DownloadTestFile_Begin/index.md) | Creates a file of random bytes on the server and opens a download session for it, for measuring download throughput. | `read` `session` `idempotent` `returns metadata structure version` |

<a id="methods"></a>

## Other methods

| Method | Summary | Facts |
|---|---|---|
| [CheckServerHealthAnonymous](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCTest/CheckServerHealthAnonymous/index.md) | Succeeds when the server and all its vaults have finished starting; fails otherwise. No session needed. | `read` `no session` `idempotent` |
| [GetServerHealth](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCTest/GetServerHealth/index.md) | Runs the server health checks you select and returns the result of each. | `read` `session` `idempotent` |
| [TestConnectionToRemoteServer](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCTest/TestConnectionToRemoteServer/index.md) | Asks this server to connect to another M-Files Server and call `TestConnectionToServer` there. Normally disabled. | `write` `no session` |
| [TestVaultAvailability](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCTest/TestVaultAvailability/index.md) | Checks that a vault on this server is online and that its database and file data storage can be accessed. No session needed. | `write` `no session` |
| [UploadTestFile_Begin](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCTest/UploadTestFile_Begin/index.md) | Starts an upload whose bytes the server discards, for measuring upload throughput. | `write` `session` `idempotent` |
