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
Option 1: Using vcpkg (Recommended)
The easiest way to install RocksDB on Windows is through vcpkg:1
Install vcpkg
If you haven’t already installed vcpkg:
2
Install RocksDB
3
Integrate with Visual Studio
Option 2: Building from Source with CMake
1
Clone repository
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
4
Build the project
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: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 forwardpthread_specific calls to Windows TLS interfaces, maintaining compatibility with the core RocksDB logic.
Platform Differences
File Operations
- pread/pwrite: Replaced with
WriteFile/ReadFileusingOVERLAPPEDstructure for atomic positioning - fallocate: Replaced with
SetFileInformationByHandlefor 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:
constexprlimitations- Zero-sized arrays
- Thread-local storage cleanup
std::chrononanoseconds 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
In-Memory Results
Troubleshooting
Build Errors
CMake can't find third-party libraries
CMake can't find third-party libraries
Edit
thirdparty.inc to specify the correct paths to zlib, snappy, lz4, and other compression libraries.C++20 support errors
C++20 support errors
Ensure you’re using Visual Studio 2017 or later. Update to the latest version if issues persist.
64-bit architecture errors
64-bit architecture errors
RocksDB on Windows only supports 64-bit builds. Ensure you’re targeting x64 architecture in CMake and Visual Studio.
Runtime Issues
Next Steps
Getting Started
Learn the basics of using RocksDB
Configuration
Optimize RocksDB for your workload