Skip to main content
RocksDB provides native Windows support through CMake and Visual Studio, enabling high-performance key-value storage on Windows platforms.

Prerequisites

System Requirements

  • Operating System: Windows Server 2012 R2 or later, Windows Vista or later
  • Architecture: 64-bit (32-bit is not supported)
  • Visual Studio: 2017 or later
  • CMake: 3.5 or higher

Compiler Support

RocksDB requires C++20 support, which is available in:
  • Visual Studio 2017 or later
  • MSVC compiler with C++20 language features

Installation Methods

The easiest way to install RocksDB on Windows is through vcpkg:
1

Install vcpkg

If you haven’t already installed vcpkg:
git clone https://github.com/microsoft/vcpkg.git
cd vcpkg
.\bootstrap-vcpkg.bat
2

Install RocksDB

vcpkg install rocksdb:x64-windows
3

Integrate with Visual Studio

vcpkg integrate install

Option 2: Building from Source with CMake

1

Clone repository

git clone https://github.com/facebook/rocksdb.git
cd rocksdb
2

Configure third-party libraries

Edit thirdparty.inc at the root level to point to your third-party library locations (zlib, snappy, lz4, etc.).
3

Generate Visual Studio solution

mkdir build
cd build
cmake .. -G "Visual Studio 16 2019" -A x64
For Visual Studio 2017:
cmake .. -G "Visual Studio 15 2017" -A x64
4

Build the project

cmake --build . --config Release

Windows-Specific Features

Unbuffered I/O

Windows implements disk caching differently from Linux. RocksDB on Windows supports unbuffered I/O to gain control over memory consumption:
rocksdb::Options options;
options.use_os_buffer = false;  // Disable OS disk buffering
When use_os_buffer=false, Windows imposes alignment restrictions on disk offsets, buffers, and data amounts. This may reduce disk throughput but provides better memory control.

Memory-Mapped Files

RocksDB on Windows supports memory-mapped files, random access, and rate-limiter functionality equivalent to POSIX platforms.

Thread-Local Storage

Windows port uses inline wrappers that forward pthread_specific calls to Windows TLS interfaces, maintaining compatibility with the core RocksDB logic.

Platform Differences

File Operations

  • pread/pwrite: Replaced with WriteFile/ReadFile using OVERLAPPED structure for atomic positioning
  • fallocate: Replaced with SetFileInformationByHandle for file truncation and pre-allocation
  • File locking: Windows allows concurrent file access with relaxed permissions to support RocksDB’s file handling patterns

C++ Standard Library

Some C++20 features have limited support in older MSVC versions. RocksDB includes compatibility shims for:
  • constexpr limitations
  • Zero-sized arrays
  • Thread-local storage cleanup
  • std::chrono nanoseconds support

Performance Benchmarks

Performance results from Windows Server 2012 R2 Datacenter:

Test Environment

  • CPU: 2x Intel Xeon E5 2450 @ 2.10 GHz (16 cores total)
  • Storage: 2x SSD devices (894GB free)
  • RAM: 128 GB
  • Dataset: 100M keys, 10-byte keys, 800-byte values (~76GB total)

Flash Storage Results

OperationPerformance
Bulk Load (Random)182,465 ops/sec (142.0 MB/s)
Bulk Load (Sequential)202,000 ops/sec (157.4 MB/s)
Random Write18,900 ops/sec (14.8 MB/s)
Random Read63,600 ops/sec (49.5 MB/s)
Read While Writing39,700 ops/sec

In-Memory Results

OperationWrite RateRead Performance
Point Lookup (80K writes/sec)40,500 writes/sec3.1M reads/sec (364.8 MB/s)
Point Lookup (10K writes/sec)5,800 writes/sec4.0M reads/sec (464.9 MB/s)
Prefix Range (80K writes/sec)46,300 writes/sec2.7M reads/sec (316.4 MB/s)
Prefix Range (10K writes/sec)5,780 writes/sec3.7M reads/sec (425.3 MB/s)

Troubleshooting

Build Errors

Edit thirdparty.inc to specify the correct paths to zlib, snappy, lz4, and other compression libraries.
Ensure you’re using Visual Studio 2017 or later. Update to the latest version if issues persist.
RocksDB on Windows only supports 64-bit builds. Ensure you’re targeting x64 architecture in CMake and Visual Studio.

Runtime Issues

If you encounter file access errors, ensure your application has appropriate file permissions. RocksDB requires the ability to rename, copy, and delete files that may be open.

Next Steps

Getting Started

Learn the basics of using RocksDB

Configuration

Optimize RocksDB for your workload

Build docs developers (and LLMs) love