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:Option 2: Building from Source with CMake
Configure third-party libraries
Edit
thirdparty.inc at the root level to point to your third-party library locations (zlib, snappy, lz4, etc.).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
| Operation | Performance |
|---|---|
| Bulk Load (Random) | 182,465 ops/sec (142.0 MB/s) |
| Bulk Load (Sequential) | 202,000 ops/sec (157.4 MB/s) |
| Random Write | 18,900 ops/sec (14.8 MB/s) |
| Random Read | 63,600 ops/sec (49.5 MB/s) |
| Read While Writing | 39,700 ops/sec |
In-Memory Results
| Operation | Write Rate | Read Performance |
|---|---|---|
| Point Lookup (80K writes/sec) | 40,500 writes/sec | 3.1M reads/sec (364.8 MB/s) |
| Point Lookup (10K writes/sec) | 5,800 writes/sec | 4.0M reads/sec (464.9 MB/s) |
| Prefix Range (80K writes/sec) | 46,300 writes/sec | 2.7M reads/sec (316.4 MB/s) |
| Prefix Range (10K writes/sec) | 5,780 writes/sec | 3.7M reads/sec (425.3 MB/s) |
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