milvus-logo

Milvus Server Configuration

Configuration overview

The configurations apply to both Milvus Standalone and Cluster solutions.

Milvus file structure

After successfully starting Milvus server, you can see a Milvus folder at home/$USER/milvus, which contains the following files:

  • milvus/db (database storage)
  • milvus/logs (log storage)
  • milvus/conf (configuration file folder)
    • server_config.yaml (server configuration)

Updating configurations

Editing the configuration file

You can directly edit the configuration file. You must restart Milvus every time a configuration file is updated.

$ docker restart <container_id>

Here we use Milvus' system configuration file server_config.yaml as an example to demonstrate how to modify the log level and log path:

logs:
  level: info
  path: /var/lib/milvus/logs

Updating configurations during runtime

You can update parameters in server_config.yaml from a Milvus client. See Client Reference for more information.

Changes to the following parameters take effect immediately without the need to restart Milvus.

  • Section cache
    • cache_size
    • insert_buffer_size
  • Section gpu
    • enable
    • cache_size
    • gpu_search_threshold
    • search_devices
    • build_index_devices

For other parameters, you still need to restart Milvus for the changes to take effect.

server_config.yaml parameters

Before changing these settings, welcome to consult Milvus team on GitHub issues or our Slack channel.

Section cluster

Parameter Description Type Default
enable Whether to enable cluster mode.
  • true: Enable cluster mode.
  • false: Disable cluster mode.
Boolean false
role Milvus deployment role:
  • rw: Read and write.
  • ro: Read only.
Role rw

Section general

Parameter Description Type Default
timezone Uses UTC-x or UTC+x to specify a time zone. For example, use UTC+8 to represent China Standard Time. Timezone UTC+8
meta_uri URI for metadata storage, using SQLite (for single server Milvus) or MySQL (for distributed cluster Milvus). Format: dialect://username:password@host:port/database. dialect can be either sqlite or mysql. Replace the other fields with real values. URI sqlite://:@:/

Section network

Parameter Description Type Default
bind.address IP address that Milvus server monitors. IP 0.0.0.0
bind.port Port that Milvus server monitors. Range: [1025, 65534]. Integer 19530
http.enable Whether to enable HTTP server.
  • true: Enable HTTP server.
  • false: Disable HTTP server.
Boolean true
http.port Port that Milvus HTTP server monitors. Range: [1025, 65534]. Integer 19121

Section storage

Parameter Description Type Default
path path to Milvus data files, including vector data files, index files, and the metadata. Path /var/lib/milvus
auto_flush_interval The interval, in seconds, at which Milvus automatically flushes data to disk. Range: [0, 3600]. 0 means disabling the regular flush. Integer 1

Section wal

Parameter Description Type Default
enable Whether to enable write-ahead logging (WAL) in Milvus. If enabled, Milvus writes all data changes to log files in advance before implementing data changes. WAL ensures the atomicity and durability for Milvus operations.
  • true: Enable WAL.
  • false: Disable WAL.
Boolean true
recovery_error_ignore Whether to ignore logs with errors that happens during WAL recovery.
  • true: Ignore errors in log files during WAL recovery.
  • false: Milvus fails to restart if log files have any error.
Boolean true
buffer_size Total size of the read and write WAL buffer in Bytes. Range: 64MB ~ 4096MB. If the value you specified is out of range, Milvus automatically uses the boundary value closest to the specified value. It is recommended you set buffer_size to a value greater than the inserted data size of a single insert operation for better performance. String 256MB
wal_path path to WAL log files. String /var/lib/milvus/wal

Section cache

Parameter Description Type Default
cache_size The size of the CPU memory for caching data for faster query. The sum of cache_size and insert_buffer_size must be less than the system memory size. String 4GB
insert_buffer_size Buffer size used for data insertion. The sum of insert_buffer_size and cache_size must be less than the system memory size. String 1GB
preload_collection A comma-separated list of collection names to load when Milvus server starts up.
  • '*' means preload all existing tables (single-quote or double-quote required).For example: preload_collection='*'.
  • To load specific collections, list the collection names that need to be loaded (enclose each collection name with single-quote or double-quote, and separate adjacent collections with a comma). For example: preload_collection=['collection1','collection2'].
StringList N/A

Section gpu

This section determines whether to enable GPU support/usage in Milvus. GPU support, which uses both CPU and GPUs for optimized resource utilization, can achieve accelerated search performance on very large datasets.

Parameter Description Type Default
enable Whether to enable GPU usage in Milvus.
  • true: Enable GPU usage.
  • false: Disable GPU usage.
Boolean false
cache_size Size of the GPU memory for caching data. It must be less than the total memory size of the graphics card. String 1GB
gpu_search_threshold The threshold of GPU search. If nq represents the number of vectors to be searched for a single batch of queries, the search stragety is as follows:
  • nqgpu_search_threshold: The search will be executed on GPUs only.
  • nq < gpu_search_threshold: The search will be executed on both CPUs and GPUs.
Integer 1000
search_devices A list of GPU devices used for search computation. Must be in format: gpux, where x is the GPU number, such as gpu0. DeviceList gpu0
build_index_devices A list of GPU devices used for index building. Must be in format: gpux, where x is the GPU number, such as gpu0. DeviceList gpu0
In Milvus, index building and search computation are separate processes, which can be executed on CPU, GPU, or both. You can assign index building and search computation to multiple GPUs by adding GPUs under search_devices or build_index_devices. See the following YAML sample code:
    search_devices:
      - gpu0
      - gpu1
    build_index_devices:
      - gpu0
      - gpu1

Section logs

Parameter Description Type Default
level Log level in Milvus. Log Levels: debug < info < warning < error < fatal. String debug
trace.enable Whether to enable trace level logging.
  • true: Enable trace level logging.
  • false: Disable trace level logging.
Boolean true
path Absolute path to the folder holding the log files. String /var/lib/milvus/logs
max_log_file_size The maximum size of each log file. Range: 512MB ~ 4096MB. String 1024MB
log_rotate_num The maximum number of log files that Milvus keeps for each logging level. Range: [0, 1024]. 0 means that the number of stored log files does not have an upper limit. Integer 0

Section metric

Parameter Description Type Default
enable Whether to enable the monitoring function of Prometheus.
  • true: Enable monitoring function.
  • false: Disable monitoring function.
Boolean false
address IP address of Prometheus Pushgateway. IP 127.0.0.1
port Port of Prometheus Pushgateway. Range: [1025, 65534]. Integer 9091
In the Milvus configuration file, space size should be written in the format of "number+unit", such as "4GB".
  • Do not add a space between the number and its unit.
  • The number must be an integer.
  • Available units include GB, MB, and KB.

FAQ

Besides the configuration file, how can I tell Milvus is using GPU for search?

Use any of the following methods:

If I have set preload_collection, does Milvus service start only after all collections are loaded to the memory? Yes. If you have set preload_collection in server_config.yaml, Milvus' service is not available until it loads all specified collections.
Why is my GPU always idle?

It is very likely that Milvus is using CPU for query. If you want to use GPU for query, you need to set the value of gpu_search_threshold in server_config.yaml to be less than nq (number of vectors per query).

You can use gpu_search_threshold to set the threshold: when nq is less than this value, Milvus uses CPU for queries; otherwise, Milvus uses GPU instead.

We do not recommend enabling GPU when the query number is small.

Why is the time in the log files different from the system time? The log files in the Docker container use UTC time by default. If your host machine does not use UTC time, then the time in the log files is different. We recommend that you mount the log files onto your host machine to keep the time consistent between the log and the host.
On this page